function gen_SNAC($type) { if ($type == "login") { $SNAC = pack("N", 1). $this->gen_TLV(0x01, $this->uin). $this->gen_TLV(0x02, xor_encrypt($this->password)). $this->gen_TLV(0x03, $this->client["name"]). $this->gen_TLV(0x16, 266, 2). $this->gen_TLV(0x17, $this->client["major"], 2). $this->gen_TLV(0x18, $this->client["minor"], 2). $this->gen_TLV(0x19, $this->client["lesser"], 2). $this->gen_TLV(0x1A, $this->client["build"], 2). $this->gen_TLV(0x14, 85, 4). $this->gen_TLV(0x0F, $this->client["language"]). $this->gen_TLV(0x0E, $this->client["country"]); $channel = 1; } if ($type == "cookie") { $SNAC = pack("N", 1). $this->gen_TLV(0x06, $this->TLV[0x06]); $channel = 1; } if ($type == "ready") { // SNAC(01,02) - CLI_READY $SNAC = "\x00\x01\x00\x02\x00\x00\x00\x00\x00\x02\x00\x01\x00\x03\x01\x10". "\x02\x8A\x00\x02\x00\x01\x01\x01\x02\x8A\x00\x03\x00\x01\x01\x10". "\x02\x8A\x00\x15\x00\x01\x01\x10\x02\x8A\x00\x04\x00\x01\x01\x10". "\x02\x8A\x00\x06\x00\x01\x01\x10\x02\x8A\x00\x09\x00\x01\x01\x10". "\x02\x8A\x00\x0A\x00\x01\x01\x10\x02\x8A"; $channel = 2; } if ($type == "message") { // SNAC(04,06) channel 1 - CLI_SEND_ICBM_CH1 $this->TLV[0x0501] = pack("C", 1); $this->TLV[0x0101] = pack("N", 0).$this->message; $this->TLV[0x02] = $this->gen_TLV(0x0501, $this->TLV[0x0501]). $this->gen_TLV(0x0101, $this->TLV[0x0101]); $SNAC = pack("nnnNdnca*", 0x04, 0x06, 0, 0, microtime(), 1, strlen($this->uin_sendto), $this->uin_sendto). $this->gen_TLV(0x02, $this->TLV[0x02]). $this->gen_TLV(0x06, ""); $channel = 2; } if ($type == "userinfo") { // SNAC(02,05) - CLI_LOCATION_INFO_REQ $SNAC = pack("nnnNnca*", 0x02, 0x05, 0, 0, 1, strlen($this->uin_sendto), $this->uin_sendto); $channel = 2; } return array($channel, $SNAC); }
<?php $defaultdata = array("showpassword" => "yes", "bgcolor" => "#000000"); //$defaultdata = array( "showpassword"=>"no", "bgcolor"=>"#ffffff"); function xor_encrypt($in) { $key = 'qw8J'; $text = $in; $outText = ''; // Iterate through each character for ($i = 0; $i < strlen($text); $i++) { print $text[$i] . " ^ " . $key[$i % strlen($key)] . "\n"; $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } if (preg_match('/^#(?:[a-f\\d]{6})$/i', $defaultdata['bgcolor'])) { $res = base64_encode(xor_encrypt(json_encode($defaultdata))); print "{$res}\n"; $orig = json_decode(xor_encrypt(base64_decode($res)), true); print $orig['showpassword'] . " " . $orig['bgcolor'] . "\n"; }
<?php $cookie = base64_decode('ClVLIh4ASCsCBE8lAxMacFMZV2hdVVotEhhUJQNVAmhSEV4sFxFeaAw'); function xor_encrypt($in) { $text = $in; $key = json_encode(array("showpassword" => "no", "bgcolor" => "#ffffff")); $outText = ''; for ($i = 0; $i < strlen($text); $i++) { $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } print xor_encrypt($cookie); function xor_encrypt_mod() { $text = json_encode(array("showpassword" => "yes", "bgcolor" => "#ffffff")); $key = 'qw8J'; $outText = ''; for ($i = 0; $i < strlen($text); $i++) { $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } print base64_encode(xor_encrypt_mod()); ?>
function do_encrypt($data) { return base64_encode(xor_encrypt(json_encode($data))); }