Package: noscrypto
NosCryptoA reverse engineered packet cryptography - encryption and decryption routines to emulate NosTale client or server.AbstractThe goal of this project is to recreate an algorithm that is used to encrypt/decrypt net packets that are exchanged between NosTale client and server. I've seen many public cryptos but I think none of them were producing exactly the same output as real client or server (especially when it comes to special characters likeÄ…Ĺ›ĹĽĹşetc). The problem of a majority of those libraries is an incorrect mask generation algorithm. If you ever encounter output produced by this library that is different from the original produced by game client or server, please report it immediately.InstallationPlease use pypi to install this library:pip install noscryptoTestsUnit tests are available undernoscrypto/testsUsageAll the functions acceptbytesas input and returnbytesas output. Keep in mind that each function should accept and output only single packet. It is extremely important when you are, for example decrypting world packets as a client, because sometime the server sends multiple packets in one call (they are splited by 0xFF, and you should decrypt the packets chunk by chunk)ClientFunctions can be imported likefromnoscryptoimportClientClient.LoginEncryptEncrypts your packet so the login server can read it. Automatically adds the\ncharacter at the end of packet if not present.>>>Client.LoginEncrypt("hey".encode("ascii"))b'\xba\xb5\xc9\xd8'Client.LoginDecryptDecrypts your login result packet, so you can read it>>>Client.LoginDecrypt(b'\x75\x70\x78\x7B\x72\x2F\x44\x19').decode("ascii")'failc 5\n'Client.WorldEncryptEncrypts your pakcet so the world server can read it. Besidepacketyou also need to supply yoursession(that one you received from login server). The last parameteris_first_packet(defaultFalse) must be set toTrueonly if you are sending your first packet to the world server (the session packet)>>>Client.WorldEncrypt("hey!".encode("ascii"),1337,False)b'}\x10\x13\xffWx'Client.WorldDecryptDecrypts your wolrd packet sent by server, so you can read it>>>Client.WorldDecrypt(b'\x04\x8C\x8B\x9E\x8B\x96\x16\x65\x16\x65\x1A\x41\xA4\x14\x15\x46\x8E\xFF')b'stat 221 221 60 60 0 1024\n'ServerFunctions can be imported likefromnoscryptoimportServerServer.LoginEncryptEncrypts your packet so the client can read it. Automatically adds the\ncharacter at the end of packet if not present.>>>Server.LoginEncrypt("hello world".encode("ascii"))b'wt{{~/\x86~\x81{s\x19'Server.LoginDecryptDecrypts login packet from client, so you can read it>>>Server.LoginDecrypt(b'\xba\xb5\xc9\xd8').decode("ascii")'hey\n'Server.WorldEncryptEncrypt world packet, so the client can read it>>>Server.WorldEncrypt("stat 221 221 60 60 0 1024\n".encode("ascii"))b'\x04\x8c\x8b\x9e\x8b\x96\x16e\x16e\x1aA\xa4\x14\x15F\x8e\xff'Server.WorldDecryptDecrypts client pakcet so the world server can read it. Besidepacketyou also need to supply clientsession. The last parameteris_first_packet(defaultFalse) must be set toTrueonly if you didn't recv the first packet from client yet (the session packet).>>>Server.WorldDecrypt(b'}\x10\x13\xffWx',1337,False).decode("ascii")'hey!'