Skip to main content

NosCrypto

A reverse engineered packet cryptography - encryption and decryption routines to emulate NosTale client or server.

Abstract

The 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.

Installation

Please use pypi to install this library:

pip install noscrypto

Tests

Unit tests are available under noscrypto/tests

Usage

All the functions accept bytes as input and return bytes as 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)

Client

Functions can be imported like

from noscrypto import Client

Client.LoginEncrypt

Encrypts your packet so the login server can read it. Automatically adds the \n character at the end of packet if not present.

>>> Client.LoginEncrypt("hey".encode("ascii"))
b'\xba\xb5\xc9\xd8'

Client.LoginDecrypt

Decrypts 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.WorldEncrypt

Encrypts your pakcet so the world server can read it. Beside packet you also need to supply your session (that one you received from login server). The last parameter is_first_packet (default False) must be set to True only 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.WorldDecrypt

Decrypts 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'

Server

Functions can be imported like

from noscrypto import Server

Server.LoginEncrypt

Encrypts your packet so the client can read it. Automatically adds the \n character at the end of packet if not present.

>>> Server.LoginEncrypt("hello world".encode("ascii"))
b'wt{{~/\x86~\x81{s\x19'

Server.LoginDecrypt

Decrypts login packet from client, so you can read it

>>> Server.LoginDecrypt(b'\xba\xb5\xc9\xd8').decode("ascii")
'hey\n'

Server.WorldEncrypt

Encrypt 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.WorldDecrypt

Decrypts client pakcet so the world server can read it. Beside packet you also need to supply client session. The last parameter is_first_packet (default False) must be set to True only 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!'

Metadata

Release files for noscrypto 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for noscrypto 0.2.0
File Interpreter ABI Platform
noscrypto-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / noscrypto-0.2.0-py3-none-any.whl

Download URL noscrypto-0.2.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba8c3daca511d65fe7402322478b821485f7f43e9f0e835491f7231daf11e3dc
BLAKE2b-256 checksum
How to use checksums
1bd7793fb74c8eccfab21dad1edf132134cc665b6eacc1e07ff9f0950400d20a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page