Skip to main content

Library that lets you obtain auth token so you can login to NosTale official servers

Project description

NosTale-Auth

Simple library that lets you generate "magic" value for the NoS0577 login packet

The packet

New login packet NoS0577 is used when you login with Gameforge launcher

That's how it looks like: "NoS0577 " + SESSION_TOKEN + " " + INSTALLATION_GUID + " 003662BF" + " " + REGION_CODE + char(0xB) + "0.9.3.3126" + " 0 " + MD5_STR(MD5_FILE("NostaleClientX.exe") + MD5_FILE("NostaleClient.exe"))

  • NoS0577 - The header of the packet, const value
  • SESSION_TOKEN - Value generated by this library, after the value there are two spaces in the login packet
  • INSTALLATION_GUID - Id that is generated during installation, for login purposes it probably may be random, stored in the windows registry under key name InstallationId in SOFTWARE\\WOW6432Node\\Gameforge4d\\TNTClient\\MainApp
  • 003662BF - Random value converted to HEX
  • REGION_CODE - GF code of your region - 4 for PL
  • char(0xB) - Single character with ASCII code 0xB
  • 0.9.3.3114 - Current version of client, may be obtained from the NostaleClientX.exe file version
  • 0 - const value
  • MD5_STR(MD5_FILE("NostaleClientX.exe") + MD5_FILE("NostaleClient.exe")) - MD5 generated from concatenation of MD5 uppercase strings of NostaleClientX.exe and NostaleClient.exe

The useless stuff

The client makes some useless stuff (at least - for us) like

  1. When you press "Start" The launcher generates mostly like pseudo-random GUID and saves it to the environment variable called _TNT_SESSION_ID
  2. Launcher launches the client with gf parameter
  3. Client reads the _TNT_SESSION_ID value from the system environment variables, the value is further used to identify the client in the launcher (in case you run multiple NosTale clients)
  4. Now the client and the launcher talk over newly created pipe using JSON-RPC protocol.
  5. The client queries the launcher using the _TNT_SESSION_ID value, the client requests info such as USERNAME and code, then it translates the code into SESSION_TOKEN using simple algorithm and sends it along with login packet

Core part

Auth

To obtain the token first you need to auth yourself. To do so you need to send POST request to https://spark.gameforge.com/api/v1/auth/sessions, you send it only once.

In the request header you need to specify TNT-Installation-Id from the windows registry. In the body of the request you need to specify JSON content:

  • email - your email
  • locale - example: pl_PL
  • password - your password

In the response you will get JSON content:

  • token - value that is used later in API requests, it is NOT that one to use in login packet

Accounts

Since some time you may bind multiple game accounts to your GF account. To handle it you need to make GET request to https://spark.gameforge.com/api/v1/user/accounts

In the request header you need to specify:

  • TNT-Installation-Id - value from windows registry
  • User-Agent - Eg. Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
  • Authorization - Bearer + TOKEN_FROM_AUTH_REQUEST

In the response you get JSON array of all the accounts. Top level keys in the list are account ids.

Almost done

To obtain the right token you need to make POST request to https://spark.gameforge.com/api/v1/auth/thin/codes In the request header you need to specify:

  • TNT-Installation-Id - value from windows registry
  • User-Agent - Changes over time, eg. GameforgeClient/2.0.48
  • Authorization - Bearer + TOKEN_FROM_AUTH_REQUEST

In the request JSON body you need to specify:

  • platformGameAccountId - the id of selected account from previous section

In the response you get JSON content with:

  • code - The value you are looking for

You may call the api/v1/auth/thin/codes multiple times with the auth token obtained from api/v1/auth/thin/sessions

Finally, the SESSION_TOKEN

To use the code in login packet you need to convert it to SESSION_TOKEN. The conversion is very simple. It changes the code into hex string.

Lets say you got code equal to a857263a-3fc1-4c60-ad78-9b6d9a2a0691, after the conversion it will look like 61383537323633612D336663312D346336302D616437382D396236643961326130363931 because you convert characters from code element by element into hexstring, so:

  • a -> 97 -> 0x61 -> 61
  • 8 -> 56 -> 0x38 -> 38

and so on, so the string will look like 6138...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nosauth-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

nosauth-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file nosauth-0.1.0.tar.gz.

File metadata

  • Download URL: nosauth-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for nosauth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 83024d199126f74d0b40ff2d9c1515e2b946bf34435b16a5e9452698e5710fc2
MD5 598232468026922679e477cb0394093e
BLAKE2b-256 7c7a1eb335613411eaca3261eb33fe0f7971293a771688c444fbdd1fdd277daf

See more details on using hashes here.

Provenance

File details

Details for the file nosauth-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nosauth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for nosauth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4782e246264d54c78292ba853de5bd0cc089361d26d3a7baf7531af1de1ebd75
MD5 cf9f4ba4f9c5193902bab0aa4ae21656
BLAKE2b-256 afe494a363f2157881276f636b30011caeaa5280b6117b6606ed9a2b5e0a3105

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page