Updated utilities

This commit is contained in:
Shoghi Cervantes Pueyo
2012-12-01 01:17:32 +01:00
parent 8a26a4d858
commit c71801145e
6 changed files with 3804 additions and 262 deletions

View File

@ -49,6 +49,75 @@ class CustomPacketHandler{
$this->offset = 0;
$this->c = (bool) $create;
switch($pid){
case 0x09:
if($this->c === false){
$this->data["clientID"] = $this->get(8);
$this->data["unknown1"] = $this->get(4);
$this->data["session"] = $this->get(2);
$this->data["unknown2"] = $this->get(2);
}else{
$this->raw .= $this->data["clientID"];
$this->raw .= "\x00\x00\x00\x00\x00";
$this->raw .= $this->data["session"];
$this->raw .= "\x19\x00";
}
break;
case 0x10:
if($this->c === false){
$this->data["cookie"] = $this->get(4); // 043f57ff
$this->data["unknown1"] = $this->get(1);
$this->data["port"] = Utils::readShort($this->get(2), false);
$this->data["dataArray"] = Utils::readDataArray($this->get(true, false), 10, $offset);
$this->get($offset);
$this->data["unknown2"] = $this->get(8);
$this->data["unknown3"] = $this->get(2);
$this->data["unknown4"] = $this->get(5);
$this->data["session"] = $this->get(2);
}else{
$this->raw .= "\x04\x3f\x57\xff";
$this->raw .= "\x3f";
$this->raw .= Utils::writeShort($this->data["port"]);
$this->raw .= Utils::writeDataArray(array(
"\x80\xff\xff\xfe",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
));
$this->raw .= "\x00\x00\x00\x00\x00\x00\x00\x00";
$this->raw .= "\x0c\x98";
$this->raw .= "\x00\x00\x00\x00\x00\x00\x00\x00";
$this->raw .= $this->data["session"];
}
break;
case 0x13:
if($this->c === false){
$this->data["cookie"] = $this->get(4); // 043f57ff
$this->data["unknown1"] = $this->get(1);
$this->data["port"] = Utils::readShort($this->get(2), false);
$this->data["dataArray0"] = $this->get(ord($this->get(1)));
$this->data["dataArray"] = Utils::readDataArray($this->get(true, false), 9, $offset);
$this->get($offset);
$this->data["unknown2"] = $this->get(13);
}else{
$this->raw .= "\x04\x3f\x57\xff";
$this->raw .= "\x3e";
$this->raw .= Utils::writeShort($this->data["port"]);
$w = array_shift($this->data["dataArray"]);
$this->raw .= chr(strlen($w)).$w;
$this->raw .= Utils::writeDataArray($this->data["dataArray"]);
$this->raw .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
$this->raw .= $this->data["session"]."\x5e";
}
break;
case 0x15:
//null
break;
case 0x82:
if($this->c === false){
$this->data["username"] = $this->get(Utils::readShort($this->get(2), false));
@ -106,73 +175,6 @@ class CustomPacketHandler{
$this->raw .= Utils::writeShort(strlen($this->data["message"])).$this->data["message"];
}
break;
case 0x09:
if($this->c === false){
$this->data["clientID"] = $this->get(8);
$this->data["unknown1"] = $this->get(1);
$this->data["unknown2"] = $this->get(4);
$this->data["session"] = $this->get(4);
}else{
$this->raw .= $this->data["clientID"];
$this->raw .= "\x00";
$this->raw .= "\x00\x00\x00\x00";
$this->raw .= $this->data["session"];
}
break;
case 0x10:
if($this->c === false){
$this->data["cookie"] = $this->get(4); // 043f57ff
$this->data["unknown1"] = $this->get(1);
$this->data["port"] = Utils::readShort($this->get(2), false);
$this->data["dataArray"] = Utils::readDataArray($this->get(true, false), 10, $offset);
$this->get($offset);
$this->data["unknown2"] = $this->get(7);
$this->data["session"] = $this->get(4);
$this->data["unknown3"] = $this->get(7);
}else{
$this->raw .= "\x04\x3f\x57\xff";
$this->raw .= "\x00";
$this->raw .= Utils::writeShort($this->data["port"]);
$this->raw .= Utils::writeDataArray(array(
"\x80\xff\xff\xfe",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
"\xff\xff\xff\xff",
));
$this->raw .= "\x00\x00\x00\x00\x00\x00\x00";
$this->raw .= $this->data["session"];
$this->raw .= "\x00\x00\x00\x00\x00\x00\x00";
}
break;
case 0x13:
if($this->c === false){
$this->data["cookie"] = $this->get(4); // 043f57ff
$this->data["unknown1"] = $this->get(1);
$this->data["port"] = Utils::readShort($this->get(2), false);
$this->data["dataArray0"] = $this->get(ord($this->get(1)));
$this->data["dataArray"] = Utils::readDataArray($this->get(true, false), 9, $offset);
$this->get($offset);
$this->data["unknown2"] = $this->get(13);
}else{
$this->raw .= "\x04\x3f\x57\xff";
$this->raw .= "\x3e";
$this->raw .= Utils::writeShort($this->data["port"]);
$w = array_shift($this->data["dataArray"]);
$this->raw .= chr(strlen($w)).$w;
$this->raw .= Utils::writeDataArray($this->data["dataArray"]);
$this->raw .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
$this->raw .= "\x00\xae\x21\x4e";
}
break;
case 0x15:
//null
break;
case 0x00:
if($this->c === false){
$this->data["payload"] = $this->get(8);