• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[Tutorial] How to find out whats OTS or Tibia public RSA key?

Ashwalker

Member
Joined
Jun 27, 2016
Messages
37
Reaction score
8
Required:
1. node.js https://nodejs.org/en/download/
2. Tibia client that you want to get RSA key from

In time of writing this (Tibia 10.94, May 31, 2016) RSA key is
132127743205872284062295099082293384952776326496165507967876361843343953435544496682053323833394351797728954155097012103928360786959821132214473291575712138800495033169914814069637740318278150290733684032524174782740134357629699062987023311132821016569775488792221429527047321331896351555606801473202394175817

How I can know or how it was first found out?
I don't know how it was found out and never tested it, but I've compared my results with otclient hardcoded value from https://github.com/edubart/otclient...29c42c354/modules/gamelib/const.lua#L232-L236 which is
OTSERV_RSA = "1091201329673994292788609605089955415282375029027981291234687579" ..
"3726629149257644633073969600111060390723088861007265581882535850" ..
"3429057592827629436413108566029093628212635953836686562675849720" ..
"6207862794310902180176810615217550567108238764764442605581471797" ..
"07119674283982419152118103759076030616683978566631413"

CIPSOFT_RSA = "1321277432058722840622950990822933849527763264961655079678763618" ..
"4334395343554449668205332383339435179772895415509701210392836078" ..
"6959821132214473291575712138800495033169914814069637740318278150" ..
"2907336840325241747827401343576296990629870233111328210165697754" ..
"88792221429527047321331896351555606801473202394175817"

Step by step tutorial:
1. in empty directory open terminal console
2. verify that you have node installed by executting command
Code:
node -v
- if not than please install node.js - have problems with that? Search help in node.js community
3. create new project with command (accept all default configs by pressing ENTER)
Code:
npm init
4. execute next command to install required dependencies
Code:
npm install fs-sync binstring --save
5. create file "findRSAkey.js" and edit it in your favourite text editor
6. paste there following code and save the file
Code:
// import dependencies
var fs = require('fs-sync');
var binstring = require('binstring');

// define all options here
var options = {
    // where to save RSA key
    outputFile: 'RSA.txt',

    // where is your Tibia client
    inputFile: 'C:/Program Files (x86)/Tibia/Tibia.exe',

    // convert binary file to human readable utf8 format
    conversionOptions: { in: 'bin', out:'utf8' },

    // this is most important, it assumes that RSA key is string of 245 digits long or longer and no other string is so long like this one,
    // if there will be more matches like this we have a problem
    RSApattern: /\d{245,}/g
};

// humanize
var humanData = binstring(fs.read(options.inputFile), options.conversionOptions);

// extract RSA with RegEXP
var RSA = humanData.match(options.RSApattern);

// assume only 1 match found
try {
    RSA[0] ? RSA = RSA[0] : null;
} catch (e) {
    console.log('no match');
}

// save it to output file
fs.write(options.outputFile, RSA);

// confirm by outputing result to console
console.log(RSA);

7. in your console that you have previously opened run command
Code:
node findRSAkey.js
and you are done ;-)
 
Last edited:
Good job.

But to make it easier, you could provide the script and package.json as a bundle, then we would just need to run npm install and node findRSAkey.js.

Edit:
Btw, are you on reddit? I recognize your name.
 
doesnt work for me and I have no idea what I am doing wrong :(
 
i can detect the rsa of the tibianic client dll with this tutorial?
edit: can I*?

edit @Ashwalker

Error: Cannot find module 'fs-sync'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\felip\findRSAkey.js:2:10)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
 
Last edited:
i can detect the rsa of the tibianic client dll with this tutorial?

edit @Ashwalker

Error: Cannot find module 'fs-sync'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\felip\findRSAkey.js:2:10)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
can you send me or upload the file (exe I guess) to test :p
also try to use "/" instead of "\"
 
can you send me or upload the file (exe I guess) to test :p
also try to use "/" instead of "\"
i did that bro, i might be doing something wrong, but im not sure.. i changed "\" to "/" after i copy pasted the folder direction
i followed it step by step
Code:
// import dependencies
var fs = require('fs-sync');
var binstring = require('binstring');

// define all options here
var options = {
    // where to save RSA key
    outputFile: 'RSA.txt',

    // where is your Tibia client
        inputFile: ' C:/Users/felip/OneDrive/Escritorio/old-ultra//Old-Ultra.exe',

    // convert binary file to human readable utf8 format
    conversionOptions: { in: 'bin', out:'utf8' },

    // this is most important, it assumes that RSA key is string of 245 digits long or longer and no other string is so long like this one,
    // if there will be more matches like this we have a problem
    RSApattern: /\d{245,}/g
};

// humanize
var humanData = binstring(fs.read(options.inputFile), options.conversionOptions);

// extract RSA with RegEXP
var RSA = humanData.match(options.RSApattern);

// assume only 1 match found
try {
    RSA[0] ? RSA = RSA[0] : null;
} catch (e) {
    console.log('no match');
}

// save it to output file
fs.write(options.outputFile, RSA);

// confirm by outputing result to console
console.log(RSA);
;
i put the requeried command with the exe opened also i redirected the cmd to the req folder after the first failure but the error was the same
PS: im not sure if its struggling because the RSA is encrypted inside a dll file / i tried to change the .exe to the dll extension but it didn't worked anyway
 
Last edited:
I had the unknow encoding error... solved by changing bin to binary in ConversionOptions, just posting if anyone get stuck in the same place. It worked for tibia, but for otclient is returning null.
 
i can detect the rsa of the tibianic client dll with this tutorial?
edit: can I*?

edit @Ashwalker

Error: Cannot find module 'fs-sync'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\felip\findRSAkey.js:2:10)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
To solve this

I just did npm install fs-sync

then i got error
cannot find module binstring

and i just wrote npm install binstring

and boom it said well cant find tibia.exe ....

i just moved the tibia client to C and change script to inputFile: 'C:\Tibia.exe',

and it worked
 
To solve this

I just did npm install fs-sync

then i got error
cannot find module binstring

and i just wrote npm install binstring

and boom it said well cant find tibia.exe ....

i just moved the tibia client to C and change script to inputFile: 'C:\Tibia.exe',

and it worked
Thank you
 
@ralke

check the latest command

it asks for package name

try binstring as package name and proceed
Post automatically merged:




This doesnt work for Otclient tho, just Original tibia client and Custom Original Tibia Clients

my guess you need another script or another system to get it.
hit me up if you know a way. i would love that :)
 
Back
Top