Skip to content

Feature Request: support ISAAC + RSA for 235 server compatibility #4

Description

@Hubcapp

// TODO toggle ISAAC
/*seedIsaac(seed) {
//this.isaacIncoming = new ISAAC(seed);
//this.isaacOutgoing = new ISAAC(seed);
}*/

Not sure what else is needed here to enable ISAAC.

Also in

async login(u, p, reconnecting) {
if (this.worldFullTimeout > 0) {
this.showLoginScreenStatus('Please wait...', 'Connecting to server');
await sleep(2000);
this.showLoginScreenStatus('Sorry! The server is currently full.', 'Please try again later');
return;
}
try {
this.username = u;
u = Utility.formatAuthString(u, 20);
this.password = p;
p = Utility.formatAuthString(p, 20);
if (u.trim().length === 0) {
this.showLoginScreenStatus('You must enter both a username', 'and a password - Please try again');
return;
}
if (reconnecting) {
this.drawTextBox('Connection lost! Please wait...', 'Attempting to re-establish');
} else {
this.showLoginScreenStatus('Please wait...', 'Connecting to server');
}
this.packetStream = new PacketStream(await this.createSocket(this.server, this.port), this);
this.packetStream.maxReadTries = GameConnection.maxReadTries;
let l = Utility.usernameToHash(u);
this.packetStream.newPacket(clientOpcodes.SESSION);
this.packetStream.putByte(l.shiftRight(16).and(31).toInt());
this.packetStream.flushPacket();
let sessId = await this.packetStream.getLong();
this.sessionID = sessId;
if (sessId.equals(0)) {
this.showLoginScreenStatus('Login server offline.', 'Please try again in a few mins');
return;
}
console.log('Verb: Session id: ' + sessId);
let ai = new Int32Array(4);
ai[0] = (Math.random() * 99999999) | 0;
ai[1] = (Math.random() * 99999999) | 0;
ai[2] = sessId.shiftRight(32).toInt();
ai[3] = sessId.toInt();
this.packetStream.newPacket(clientOpcodes.LOGIN);
if (reconnecting) {
this.packetStream.putByte(1);
} else {
this.packetStream.putByte(0);
}
this.packetStream.putShort(GameConnection.clientVersion);
this.packetStream.putByte(0); // limit30
this.packetStream.putByte(10);
this.packetStream.putInt(ai[0]);
this.packetStream.putInt(ai[1]);
this.packetStream.putInt(ai[2]);
this.packetStream.putInt(ai[3]);
this.packetStream.putInt(0); // uuid
this.packetStream.putString(u);
this.packetStream.putString(p);
this.packetStream.flushPacket();
//this.packetStream.seedIsaac(ai);
let resp = await this.packetStream.readStream();
console.log('login response:' + resp);
if (resp === 25) {
this.moderatorLevel = 1;
this.autoLoginTimeout = 0;
this.resetGame();
return;
}
if (resp === 0) {
this.moderatorLevel = 0;
this.autoLoginTimeout = 0;
this.resetGame();
return;
}
if (resp === 1) {
this.autoLoginTimeout = 0;
, the login packet isn't encapsulated in RSA, so it won't work for a 235 server. Might be correct for a 204 server, haven't looked into that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions