PDA

View Full Version : Server only Allows Specific Client.



Faab234
June 22nd, 2010, 16:07
Give me ideas how to do it, that the server only allows specific Client. Give me Ideas, Examples or Tutorials.


Thanks :)

Coder2
June 22nd, 2010, 16:20
Give the client a specific id, then make the server only accept a client with that certain id. (This is how creativescape did it i believe, not sure if they did it like that though) but it could happen.

Faab234
June 22nd, 2010, 17:59
Give the client a specific id, then make the server only accept a client with that certain id. (This is how creativescape did it i believe, not sure if they did it like that though) but it could happen.

Yes, but to simple because i can give a other client the same idea, but thanks.

jrune_
June 24th, 2010, 23:23
The UID allows the server to communicate with the client, if we take a look at wintelove's server the if(inStream.readUnsignedByte() != 255 should always be a 255, especially for the 317 revisions. If we change the value the client will retrieve wrong packets causing the game client to crash. However there are several ways of doing this.

samuraiblood2
June 25th, 2010, 00:16
The UID allows the server to communicate with the client, if we take a look at wintelove's server the if(inStream.readUnsignedByte() != 255 should always be a 255, especially for the 317 revisions. If we change the value the client will retrieve wrong packets causing the game client to crash. However there are several ways of doing this.

That made me laugh lol. Winterlove servers simply check for all default values being sent, if its anything different then it (usually) stops the client from connecting. Also, that one byte has literally nothing do with packets. Changing it will have no repercussions for the client or server (though it needs to be changed due to the reason stated above) and the same can be said for a few other things in the login protocol. Here's a snippet of that byte being sent in the client,

aStream_847.putByte(255);
and the entire login protocol.

socketStream = new RSSocket(this, openSocket(UIWrapper.port + portOff));
long l = TextClass.longForName(s);
int i = (int) (l >> 16 & 31L);
stream.currentOffset = 0;
stream.putByte(14);
stream.putByte(i);
socketStream.queueBytes(2, stream.buffer);
for (int j = 0; j < 8; j++)
socketStream.read();

int k = socketStream.read();
int i1 = k;
if (k == 0) {
socketStream.flushInputStream(inStream.buffer, 8);
inStream.currentOffset = 0;
serverKey = inStream.getLong();
int ai[] = new int[4];
ai[0] = (int) (Math.random() * 99999999D);
ai[1] = (int) (Math.random() * 99999999D);
ai[2] = (int) (serverKey >> 32);
ai[3] = (int) serverKey;
stream.currentOffset = 0;
stream.putByte(10);
stream.putInt(ai[0]);
stream.putInt(ai[1]);
stream.putInt(ai[2]);
stream.putInt(ai[3]);
stream.putInt(1337);
stream.putString(s);
stream.putString(s1);
stream.doKeys();
aStream_847.currentOffset = 0;
if (flag)
aStream_847.putByte(18);
else
aStream_847.putByte(16);
aStream_847.putByte(stream.currentOffset + 40);
aStream_847.putByte(255);
aStream_847.putShort(317);
aStream_847.putByte(lowMem ? 1 : 0);
for (int l1 = 0; l1 < 9; l1++)
aStream_847.putInt(expectedCRCs[l1]);

aStream_847.putBytes(stream.buffer, stream.currentOffset, 0);
stream.encryption = new ISAACRandomGen(ai);
for (int j2 = 0; j2 < 4; j2++)
ai[j2] += 50;

encryption = new ISAACRandomGen(ai);
socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
k = socketStream.read();
}
In fact the only thing that has anything to do with packets is the ISAAC encryption/decryption if I remember correctly.

Faab234
June 25th, 2010, 07:03
Thanks samuraiblood2.

jrune_
June 25th, 2010, 11:17
That made me laugh lol. Winterlove servers simply check for all default values being sent, if its anything different then it (usually) stops the client from connecting. Also, that one byte has literally nothing do with packets. Changing it will have no repercussions for the client or server (though it needs to be changed due to the reason stated above) and the same can be said for a few other things in the login protocol. Here's a snippet of that byte being sent in the client,

aStream_847.putByte(255);
and the entire login protocol.

socketStream = new RSSocket(this, openSocket(UIWrapper.port + portOff));
long l = TextClass.longForName(s);
int i = (int) (l >> 16 & 31L);
stream.currentOffset = 0;
stream.putByte(14);
stream.putByte(i);
socketStream.queueBytes(2, stream.buffer);
for (int j = 0; j < 8; j++)
socketStream.read();

int k = socketStream.read();
int i1 = k;
if (k == 0) {
socketStream.flushInputStream(inStream.buffer, 8);
inStream.currentOffset = 0;
serverKey = inStream.getLong();
int ai[] = new int[4];
ai[0] = (int) (Math.random() * 99999999D);
ai[1] = (int) (Math.random() * 99999999D);
ai[2] = (int) (serverKey >> 32);
ai[3] = (int) serverKey;
stream.currentOffset = 0;
stream.putByte(10);
stream.putInt(ai[0]);
stream.putInt(ai[1]);
stream.putInt(ai[2]);
stream.putInt(ai[3]);
stream.putInt(1337);
stream.putString(s);
stream.putString(s1);
stream.doKeys();
aStream_847.currentOffset = 0;
if (flag)
aStream_847.putByte(18);
else
aStream_847.putByte(16);
aStream_847.putByte(stream.currentOffset + 40);
aStream_847.putByte(255);
aStream_847.putShort(317);
aStream_847.putByte(lowMem ? 1 : 0);
for (int l1 = 0; l1 < 9; l1++)
aStream_847.putInt(expectedCRCs[l1]);

aStream_847.putBytes(stream.buffer, stream.currentOffset, 0);
stream.encryption = new ISAACRandomGen(ai);
for (int j2 = 0; j2 < 4; j2++)
ai[j2] += 50;

encryption = new ISAACRandomGen(ai);
socketStream.queueBytes(aStream_847.currentOffset, aStream_847.buffer);
k = socketStream.read();
}
In fact the only thing that has anything to do with packets is the ISAAC encryption/decryption if I remember correctly.

I never said it had anything to do with packets, i'm simply complying that the default id for 317 servers is 255. Lets' take the magic ID for example.


aClass30_Sub2_Sub2_847.method398(255);
aClass30_Sub2_Sub2_847.method399(317);

the 255 will be the ID, now if we change that to something else and declare it it will send different packets.


if(inStream.readUnsignedByte() != 255 || inStream.readUnsignedWord() != 317) {
shutdownError("Wrong login packet magic ID (expected 255, 317)");
return;
}
hence it will stop other clients from connecting to your server

samuraiblood2
June 25th, 2010, 16:20
I never said it had anything to do with packets, i'm simply complying that the default id for 317 servers is 255. Lets' take the magic ID for example.


aClass30_Sub2_Sub2_847.method398(255);
aClass30_Sub2_Sub2_847.method399(317);

the 255 will be the ID, now if we change that to something else and declare it it will send different packets.


if(inStream.readUnsignedByte() != 255 || inStream.readUnsignedWord() != 317) {
shutdownError("Wrong login packet magic ID (expected 255, 317)");
return;
}
hence it will stop other clients from connecting to your serverRight, if you say so.

Codeusa
June 25th, 2010, 22:56
Why put so much work into it? Just change the client version the servers reads for EX: 508 to something like 09528595829582

change the clients version to that same number and done.

Ryan
June 25th, 2010, 23:50
Packet sizes or head icons, or change the integer port name and change the port to like 43597. Or, sometimes servers read what version it is like Codeusa just stated.

Faab234
June 26th, 2010, 10:52
Why put so much work into it? Just change the client version the servers reads for EX: 508 to something like 09528595829582

change the clients version to that same number and done.

Nice Idea.