amgineyoc
Banned
Messaggi : 15
Registrato dal : Oct 2013
Stato : Offline
Premi :
|
Ha copiato la mia idea in pieno, a parte il fatto che l'avevo già rilasciata su epvp qualche settimana fa..
C++ - CLIENT - LOGIN
Codice:
// RETURN A RANDOM NUMBER
int Random(int start, int end) { return rand()%(end-start)+start; }
// RETURN ENCRYPTED PASSWORD
std::string pwEncrypt(std::string password)
{
const unsigned char secondtable[] = { 0x2E, 0x2A, 0x17, 0x4F, 0x20, 0x24, 0x47, 0x11, 0x5B, 0x37, 0x53,
0x43, 0x15, 0x34, 0x45, 0x25, 0x4B, 0x1D, 0x2F, 0x58, 0x2B, 0x32, 0x63 };
std::string hex, temp;
std::stringstream ss;
short pos = Random(0, 23);
char low, high;
for(unsigned int i = 0; i < password.size(); i++)
ss << std::uppercase << std::hex << (int)password[i];
temp += ss.str();
ss.str("");
ss << std::uppercase << std::hex << (int)secondtable[Random(0, 23)];
for(unsigned int i = 0; i < temp.size(); i += 2)
{
high = secondtable[pos] & 0xF;
low = (secondtable[pos] & 0xF0) >> 4;
ss << std::uppercase << std::hex << (int)low;
ss << std::uppercase << temp[i];
ss << std::uppercase << std::hex << (int)high;
ss << std::uppercase << temp[i + 1];
pos == 22 ? pos = 0 : pos++;
}
return ss.str();
}
// RETURN ENCRYPTED AUTHENTICATION PACKET
std::string Encrypt(std::string str)
{
std::string str_enc;
for(unsigned int i = 0; i < str.size(); i++)
str_enc += (str[i] ^ 0xC3) + 0xF; }
return str_enc += 0xD8;
}
// RETURN DECRYPTED AUTHENTICATION RESPONSE ( SERVERS/CHANNELS )
std::string Decrypt(std::string str)
{
std::string str_dec;
for(unsigned int i = 0; i < str.size(); i++)
str_dec += str[i] - 0xF;
return str_dec.substr(0, str_dec.size() - 1);
}
C++ - CLIENT - GAME
Codice:
std::string sessionEncrypt(std::string identifier, std::string session)
{
const unsigned char table[] = { 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C,
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C,
0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C,
0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C,
0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C,
0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC,
0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC,
0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC,
0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC,
0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC };
std::string str_enc;
str_enc += 0x9A;
std::stringstream ss;
ss << identifier[0] << identifier[1];
str_enc += table[atoi(ss.str().c_str())];
ss.str("");
ss << identifier[2] << identifier[3];
str_enc += table[atoi(ss.str().c_str())];
ss.str("");
ss << identifier[4];
switch (atoi(ss.str().c_str()))
{
case 0:
str_enc += 0x50;
break;
case 1:
str_enc += 0x60;
break;
case 2:
str_enc += 0x70;
break;
case 3:
str_enc += 0x80;
break;
case 4:
str_enc += 0x90;
break;
case 5:
str_enc += 0xA0;
break;
case 6:
str_enc += 0xB0;
break;
case 7:
str_enc += 0xC0;
break;
case 8:
str_enc += 0xD0;
break;
case 9:
str_enc += 0xE0;
break;
}
ss.str("");
ss << session[0] << session[1];
str_enc += table[atoi(ss.str().c_str())];
ss.str("");
ss << session[2] << session[3];
str_enc += table[atoi(ss.str().c_str())];
ss.str("");
ss << session[4];
switch (atoi(ss.str().c_str()))
{
case 0:
str_enc += 0x4F;
break;
case 1:
str_enc += 0x5F;
break;
case 2:
str_enc += 0x6F;
break;
case 3:
str_enc += 0x7F;
break;
case 4:
str_enc += 0x8F;
break;
case 5:
str_enc += 0x9F;
break;
case 6:
str_enc += 0xAF;
break;
case 7:
str_enc += 0xBF;
break;
case 8:
str_enc += 0xCF;
break;
case 9:
str_enc += 0xDF;
break;
}
ss.str("");
return str_enc += 0x0E;
}
C++ - CLIENT - ESEMPIO DI UTILIZZO DELLA SESSION ENCRYPT
Codice:
sessionEncrypt("53061", "26705")
PHP - CLIENT - LOGIN
Codice:
// encrypt 'NoS0575..' packet
function packet_enc($packet)
{
$str_enc = "";
for($i = 0; $i < strlen($packet); $i++)
$str_enc .= chr((ord($packet[$i])^195) + 15);
return $str_enc .= chr(216);
}
// encrypt password of login
function password_enc($password)
{
$pos = rand(0, 22);
$str_hex = strtoupper(ToHex($password));
$secondtable = array(46, 42, 23, 79, 32, 36, 71, 17, 91, 55, 83, 67, 21, 52, 69, 37, 75, 29, 47, 88, 43, 50, 99);
$pw_enc = strtoupper(ToHex(chr($secondtable[$pos])));
for($i = 0; $i < strlen($str_hex); $i += 2)
{
$pw_enc .= strtoupper(ToHex(chr(($secondtable[$pos] & 240) >> 4)));
$pw_enc .= $str_hex[$i];
$pw_enc .= strtoupper(ToHex(chr($secondtable[$pos] & 15)));
$pw_enc .= $str_hex[$i + 1];
$pos == 22 ? $pos = 0 : $pos++;
}
return $pw_enc;
}
// decrypt response received from server
function packet_dec($packet)
{
$str_dec = "";
for($i = 0; $i < strlen($packet); $i++)
$str_dec .= chr(ord($packet[$i]) - 15);
return $str_dec .= chr(25);
}
PHP - CLIENT - GAME
Codice:
<?php
function sessionEncrypt($identifier, $session)
{
$table = array( 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
131, 132, 133, 134, 135, 136, 137, 138, 139, 140,
147, 148, 149, 150, 151, 152, 153, 154, 155, 156,
163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
211, 212, 213, 214, 215, 216, 217, 218, 219, 220,
227, 228, 229, 230, 231, 232, 233, 234, 235, 236 );
$str_enc = chr(154); // 0x9A
$temp = $identifier[0].$identifier[1];
$str_enc .= chr($table[(int)$temp]); // example --> 0xA6
$temp = $identifier[2].$identifier[3];
$str_enc .= chr($table[(int)$temp]); // example --> 0x84
switch((int)$identifier[4])
{
case 0:
$str_enc .= chr(80); // 0x50
break;
case 1:
$str_enc .= chr(96); // 0x60 <-- example
break;
case 2:
$str_enc .= chr(112); // 0x70
break;
case 3:
$str_enc .= chr(128); // 0x80
break;
case 4:
$str_enc .= chr(144); // 0x90
break;
case 5:
$str_enc .= chr(160); // 0xA0
break;
case 6:
$str_enc .= chr(176); // 0xB0
break;
case 7:
$str_enc .= chr(192); // 0xC0
break;
case 8:
$str_enc .= chr(208); // 0xD0
break;
case 9:
$str_enc .= chr(224); // 0xE0
break;
}
$temp = $session[0].$session[1];
$str_enc .= chr($table[(int)$temp]); // example --> 0x64
$temp = $session[2].$session[3];
$str_enc .= chr($table[(int)$temp]); // example --> 0x86
switch((int)$session[4])
{
case 0:
$str_enc .= chr(79); // 0x4F
break;
case 1:
$str_enc .= chr(95); // 0x5F
break;
case 2:
$str_enc .= chr(111); // 0x6F
break;
case 3:
$str_enc .= chr(127); // 0x7F
break;
case 4:
$str_enc .= chr(143); // 0x8F
break;
case 5:
$str_enc .= chr(159); // 0x9F <-- example
break;
case 6:
$str_enc .= chr(175); // 0xAF
break;
case 7:
$str_enc .= chr(191); // 0xBF
break;
case 8:
$str_enc .= chr(207); // 0xCF
break;
case 9:
$str_enc .= chr(223); // 0xDF
break;
}
return $str_enc .= chr(14);
}
// 54321 = identifier
// 12345 = session
$encryptedSession = sessionEncrypt("54321", "12345");
?>
PS. Controlla il tuo Encrypt, hai dimenticato di aggiungere 0xD8 alla fine della stringa criptata ( byte fondamentale per il riconoscimento )
(Questo messaggio è stato modificato l'ultima volta il: 28-10-2013 06:14 PM da amgineyoc.)
|
|