Salve ospite, se leggi questo messaggio vuol dire che non sei registrato, cosa aspetti ? Premi qui per registrarti La registrazione è completamente gratuita e ti permetterà di usufruire di tutte le funzionalità del nostro forum. Buona navigazione.


Vendo, Compro, Scambio NosTale! Riapre il Black Market, concludi i tuoi scambi NosTale gratuitamente! Più info  -   Accedi alla sezione
Download file Server : File Retro Server NosTale
Visita la nuova sezione di BorderGame dedicata a Blade & Soul! Sezione Blade and Soul

 
Valutazione discussione:
  • 13 voti - 4.85 media
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] NosTale Client Encryption & Decryption [LOGIN]
28-10-2013 10:53 AM
Messaggio: #1
[Release] NosTale Client Encryption & Decryption [LOGIN]
~Giorigo1~
*
Minecraft
NosTale
Utente Saggio
Utente Storico

NosMerda D:

Messaggi : 704

Registrato dal : Feb 2012

Reputazione : 109

Stato : Offline


Premi :



E' da un po' di tempo che non rilascio niente, e questo che sto per scrivere
non è nulla di chissà cosa ma se a qualcuno può essere utile, ecco qui le Encryption&Decryption
del Login del client di NosTale.
Il Linguaggio in cui sono scritte è il c++.

NosTale Client Login-packet Decryption :
Spoiler:
std::string ClientDecryptLoginPacket(std::string encrypted_str) {
std::string decrypted_string;
for (int i = 0; i < encrypted_str.length()-1; i++) { decrypted_string += (encrypted_str[i] - 15); }
return decrypted_string; }

NosTale Client Login-Packet Encryption (Fixed by amgineyoc):
Spoiler:
std::string ClientEncryptLoginPacket(std::string decrypted_str) {
std::string encrypted_string;
for (int i = 0; i < decrypted_str.length(); i++) { encrypted_string += (decrypted_str[i] ^ 195) + 15; }
return encrypted_string += 0xD8; }

Enjoy Wink
I Negri sono pregati di stare lontani dalla mia firma.
(Questo messaggio è stato modificato l'ultima volta il: 28-10-2013 04:43 PM da ~Giorigo1~.)
Torna al primo messaggio
Email Cerca Rispondi
28-10-2013 04:18 PM
Messaggio: #2
RE: [Release] NosTale Client Encryption & Decryption [LOGIN]
amgineyoc
Bannati

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.)
Torna al primo messaggio
Email Cerca Rispondi
28-10-2013 04:33 PM
Messaggio: #3
RE: [Release] NosTale Client Encryption & Decryption [LOGIN]
~Giorigo1~
*
Minecraft
NosTale
Utente Saggio
Utente Storico

NosMerda D:

Messaggi : 704

Registrato dal : Feb 2012

Reputazione : 109

Stato : Offline


Premi :



che dire complimenti per le altre encrypt/decrypt, ma sinceramente non vado su epvp da almeno qualche mese quindi non sapevo fosse stata gia rilasciata
I Negri sono pregati di stare lontani dalla mia firma.
Torna al primo messaggio
Email Cerca Rispondi
28-10-2013 04:35 PM
Messaggio: #4
RE: [Release] NosTale Client Encryption & Decryption [LOGIN]
amgineyoc
Bannati

Banned

Messaggi : 15

Registrato dal : Oct 2013


Stato : Offline


Premi :



Lo so che non hai copiato, appunto non avresti commesso quell'errore fatale..
Quindi si capisce che è frutto del tuo brain, non ho nulla contro di te.. anzi.. se posso aiutarti mi fa piacere !

Prova a sviluppare l'ultima parte mancante ( l'encrypt dei pacchetti di gioco ), ci sto lavorando da qualche giorno e ti assicuro che non è facile..

Ma resta un bel progetto per irrobustire le proprie conoscenze *-*
Fregatene della gente se ti dice che è inutile, tanto non capiscono il senso di tutto ciò..

Vero ernilos ? so che leggerai questo messaggio Tongue

Sostituisci
return encrypted_string;
Con
return encrypted_string += 0xD8;

Almeno questo è fondamentale altrimenti non viene riconosciuto..
(Questo messaggio è stato modificato l'ultima volta il: 28-10-2013 05:28 PM da amgineyoc.)
Torna al primo messaggio
Email Cerca Rispondi
28-10-2013 04:40 PM
Messaggio: #5
RE: [Release] NosTale Client Encryption & Decryption [LOGIN]
~Giorigo1~
*
Minecraft
NosTale
Utente Saggio
Utente Storico

NosMerda D:

Messaggi : 704

Registrato dal : Feb 2012

Reputazione : 109

Stato : Offline


Premi :



Certo ^^, già ho dato un occhiatina alle encryption/decryption del game che utilizza il server di nostale ed in effetti a prima vista rispetto alla crittografia del login che è una cavolata la cosa sembra un po più complessa, stasera ci inciarmo su e vedo cosa riesco a combinare Wink
I Negri sono pregati di stare lontani dalla mia firma.
Torna al primo messaggio
Email Cerca Rispondi
28-10-2013 04:48 PM
Messaggio: #6
RE: [Release] NosTale Client Encryption & Decryption [LOGIN]
amgineyoc
Bannati

Banned

Messaggi : 15

Registrato dal : Oct 2013


Stato : Offline


Premi :



Ma non si può nemmeno definire complesso, personalmente considererei la crittografia lato server ( rilasciata in precedenza ) inreversabile per via delle perdite ( bytes ) durante il percorso..
Bisogna ricostruire intere tabelle e scrivere un algoritmo per la codifica..

Tutto ciò si fa solo sperimentando, da un occhiata alla session encrypt per capire meglio il mio concetto..

Comunque, eccoti la mia crittografia di login se vuoi sistemare la tua nel miglior modo possibile..

CLIENT - LOGIN CRYPTOGRAPHY

Qua invece rilascio la crittografia del game, sempre lato client.. per il momento ti ho messo la session encrypt ( pulita )..

CLIENT - GAME CRYPTOGRAPHY
(Questo messaggio è stato modificato l'ultima volta il: 28-10-2013 06:08 PM da amgineyoc.)
Torna al primo messaggio
Email Cerca Rispondi

PubblicitàLa tua pubblicità qui, clicca per informazioni e per le offerte!

Stanno visualizzando la discussione : 1 Ospite(i)

  • Versione stampabile
  • Invia ad un amico
  • Sottoscrivi questa discussione