From 32e6d36198d93bd1519db801c559a3cd6650e811 Mon Sep 17 00:00:00 2001 From: LGBTyoraze <38854160+LGBTyarovoy@users.noreply.github.com> Date: Tue, 5 Nov 2019 07:56:43 +0700 Subject: [PATCH] Attempt to make antibot --- src/raklib/protocol/Packet.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/raklib/protocol/Packet.php b/src/raklib/protocol/Packet.php index 69357a064..ef2e3dd66 100755 --- a/src/raklib/protocol/Packet.php +++ b/src/raklib/protocol/Packet.php @@ -78,11 +78,28 @@ protected function getAddress(&$addr, &$port, &$version = null){ if($version === 4){ $addr = ((~$this->getByte()) & 0xff) .".". ((~$this->getByte()) & 0xff) .".". ((~$this->getByte()) & 0xff) .".". ((~$this->getByte()) & 0xff); $port = $this->getShort(false); + + } elseif($version === 6) { + //http://man7.org/linux/man-pages/man7/ipv6.7.html + + Binary::readLShort($this->get(2)); //Family, AF_INET6 + + $port = $this->getShort(false); + + $this->getInt(); //flow info + + $addr = inet_ntop($this->get(16)); + + $this->getInt(); //scope ID + }else{ - //TODO: IPv6 + + throw new \UnexpectedValueException("Unknown IP address version $version"); + } - } + } + protected function feof(){ return !isset($this->buffer{$this->offset}); }