Hello everyone,
Just releasing my Silkroad Security API wrapper for node.js, it's not something big but you can do whatever you want with it, first of all I was rewritting all SilkroadSecurityAPI with javascript but it wasn't stable so I prefered to use the current API written in C++, biggest credits goes to Drew and WeeMan.
With this lib you can do whatever you want, I did a proxy but have to test all the performance, also a real clientless, moving share ect.. from a website. It can make your creation more extensible.
The main purpose of this system is to run the lib from an other operating system than Windows, then you can make your own proxy on a linux server which will handle all the network traffic.
You can read the readme.md or follow those step:
Then you can do whatever you want, "--ignore-scripts" in installation will skip the build stuff, if you want to use the compiled file directly.
Here an example of clientless which work:
With a bit more code, you can make it login into game world, move ect..
I also tested it for make proxy between modules, it worked well, if you want to change the identity, there is 2 way:
Or
By default it'll use the SR_Client identity
Here the npm link -> [Only registered and activated users can see links. Click Here To Register...]
Just releasing my Silkroad Security API wrapper for node.js, it's not something big but you can do whatever you want with it, first of all I was rewritting all SilkroadSecurityAPI with javascript but it wasn't stable so I prefered to use the current API written in C++, biggest credits goes to Drew and WeeMan.
With this lib you can do whatever you want, I did a proxy but have to test all the performance, also a real clientless, moving share ect.. from a website. It can make your creation more extensible.
The main purpose of this system is to run the lib from an other operating system than Windows, then you can make your own proxy on a linux server which will handle all the network traffic.
You can read the readme.md or follow those step:
- Install node.js with npm (node >= 12)
- run: npm install silkroad-security --ignore-scripts
Then you can do whatever you want, "--ignore-scripts" in installation will skip the build stuff, if you want to use the compiled file directly.
Here an example of clientless which work:
Code:
const { SilkroadSecurityJS, stream } = require('silkroad-security'),
net = require('net');
let silkroad = {
ip: '127.0.0.1',
port: 15779,
version: 201,
local: 22
},
security = new SilkroadSecurityJS(),
client = new net.Socket()
client.connect({
host: silkroad.ip,
port: silkroad.port,
onread: {
buffer: Buffer.alloc(8 * 1024)
}
});
client.on('data', (data) => {
security.Recv(data)
});
setInterval(() => {
let packToSend = security.GetPacketToSend()
for (let y = 0; y < packToSend.length; y++) {
let data = Buffer.from(packToSend[y])
client.write(data)
}
let packetToRecv = security.GetPacketToRecv()
for (let i = 0; i < packetToRecv.length; i++) {
HandlePacketGateway(security, packetToRecv[i])
}
}, 1)
client.on('close', () => {
console.log('Connection closed');
});
function HandlePacketGateway(security, packet) {
let reader = new stream.reader(packet['data'])
console.log((packet['opcode']).toString(16))
if (packet['opcode'] == 0x2001) {
let server = reader.string()
if (server == 'GatewayServer') {
let rep = new stream.writer();
rep.uint8(silkroad.local);
rep.string("SR_Client");
rep.uint32(silkroad.version);
security.Send(0x6100, rep, true, false)
}
} else if (packet['opcode'] == 0xA100) {
security.Send(0x6101, [], true, false)
} else if (packet['opcode'] == 0xA101) {
while (reader.uint8() == 1) {
reader.uint8();
reader.string('ascii');
}
var servers = []
while (reader.uint8() == 1) {
var server = {
serverID: reader.uint16(),
Name: reader.string('ascii'),
ratio : reader.float(),
status: reader.uint8()
};
server.players = Math.round(server.ratio * 3500.0);
servers.push(server);
}
console.log('--- Servers ---')
console.log(servers);
}
}
I also tested it for make proxy between modules, it worked well, if you want to change the identity, there is 2 way:
Code:
let ssjs = new SilkroadSecurityJS("SR_Client", 0)
Code:
let ssjs = new SilkroadSecurityJS()
ssjs.ChangeIdentity("SR_Client", 0)
Here the npm link -> [Only registered and activated users can see links. Click Here To Register...]