issy123 / agario-protocol

Protocol for agar.io version 2.1.5
8 stars 2 forks source link

Packet 112 and 113 #5

Open kscc25 opened 8 years ago

kscc25 commented 8 years ago

Packet 112 is sent from server to client, example data:

[112, 49, 55, 55, 55, 52, 49, 52, 52, 57, 56, 51, 53, 57, 51, 55, 50, 55, 57, 54, 55]

Client musts send back packet 112 to complete authentication (without this client cannot spawn), example data:

[113, 124, 3, -106, 47, -90, 92, 16, 78, 119, 97, 73, -13, 9, 75, 104, 100, -8, -75, -27, 123]

Note that packet 113 is calculated from packet 112, if client sends wrong data for packet 113, the server will close the socket by sending back packet 128, see #4

The algorithm is quite complicated, I tried debugging but didn't get much.

mb1969 commented 8 years ago

112 looks like some ASCII numbers, right?

wishstorage commented 8 years ago

I write my examples, may be somebode can detect rule In hex 1) 70:35:34:33:32:32:30:31:34:39:38:34:30:30:36:36:30:31:33:32 the answer was 71:ca:2b:0a:f9:48:5e:1b:7e:25:93:1f:58:bc:00:68:59:31:ba:9d:0a 2) 70:31:32:37:36:37:36:32:30:39:30:34:33:36:33:34:38:39:34:33:35 the answer was 71:c4:61:dd:69:3b:b9:d8:ef:d7:38:22:07:1c:78:d9:9b:e5:eb:1f:e8 3) 70:37:34:32:34:36:36:31:33:33:37:38:35:34:38:34:34:31:34:35 the answer was 71:e5:11:9d:a3:58:a2:20:1b:2f:23:0d:73:16:3e:59:b6:84:78:5d:8a

I noticed that all data in packet 112 begin on digit 3

wishstorage commented 8 years ago

70:31:37:32:33:37:37:39:34:39:36:31:37:37:33:39:34:32:39:34 the answer was 71:75:73:e5:2e:40:92:24:fd:ba:d8:3e:a1:06:46:34:2c:b0:fd:96:10

wishstorage commented 8 years ago

Does anybody know in what line in agario.core.js we get 112 packet?

kscc25 commented 8 years ago

@wishstorage use this tool to debug: https://github.com/SNSA/agario-code. Set breakpoint if needed.

wishstorage commented 8 years ago

@heroandtn3 Do you get this algorithm?

kscc25 commented 8 years ago

Just found a workaround for this (just an idea and havent checked yet).

As you know, when agario.core.js receives packet 112, it will calculate and return packet 113. Assume that this is the same for all websocket connection, that means we can consider this as a function with input is packet 112 and output is packet 113. Here is the proposal:

wishstorage commented 8 years ago

So, If I must calculate it on node.js, I have to load all agario.core.js file as a lib? Does it help me?

kscc25 commented 8 years ago

Yes, it can run on node.js

http://i.imgur.com/X7kE1kh.png

cppCoderGuy commented 7 years ago

112 is the number written as string. After processing the numbers, client get's something like this : '66646197c09ef92595c09907ecc59fe463c05c40:1753632391' and then simply using sha1 on this string, the result is sent in 113 packet.

cppCoderGuy commented 7 years ago

@MasonBurdette https://ru.wikipedia.org/wiki/SHA-1

issy123 commented 7 years ago

So you're saying you can authenticate by sending the sha1 version of packet 112?

issy123 commented 7 years ago

I think there is salt added to it because every hour you have a new key

cppCoderGuy commented 7 years ago

actually it's not that simple. the value from 112 is being processed by a client (possibly some xor operation, and bitshifting) after that the result is being put on sha1, and the result of sha1 is sended back to server.

cppCoderGuy commented 7 years ago

@issy123 you are right, the values sended by a client in 255 or 254 packets, is used in some way to generate the answer to 112 packet.

cppCoderGuy commented 7 years ago

@MasonBurdette i'm currently working on the answer to 112 packet. I thought that this information might be helpful in some way.

NuclearC commented 7 years ago

@cppCoderGuy anything new? :D