-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi.txt
391 lines (364 loc) · 12.4 KB
/
api.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
Stanza Size - 16bit int
List Size -- byte - if 0, size == 0. if 248, next byte = size, if 249, next 2 bytes = size
Tag - should be 1 - STREAM_START
(AttribCount = (List Size - 2 + List Size % 2) / 2)
Attributes:
Key = readString();
Value = readString();
readString:
if next byte > 4 && < 245, return getToken(token)
if next byte 0 return None
if next byte 252: next byte = size of array to fillArray
if next byte 253: next 3 bytes = size of array to fillArray
if next byte 254: return getToken(245 + next byte)
if next byte 250: readString(user), readString(server) return jid == user+"@"+server
getToken:
if(token >= 0 && token < tokenMap.length) return tokenMap[token]
else error
fillArray:
fills up an array with data from "read2" somewhere or other
https://r.whatsapp.net/v1/code.php -- retrieve a registration code from the server
cc = Area (Country?) Code without 0's (1 for US? google nation-name dialing code for more?) (length 1-3)
in = Phone Number w/o preceeding 0's
to = (cc + in) ? // not required
lc = "US" // locale? - not required
lg = "en" // language? - not required
mcc = ? "Mobile Country Code" (0?) (length mcc required 3)
mnc = ? "Mobile Network Code" (0?) (length mnc required 3)
imsi = ? "Mobile Subscriber Identification Number" (0?) - not required
method = How to receive the code: sms, voice, self
expected response: <code><response status="success-sent" result="30"></code>
sent:
https://r.whatsapp.net/v1/code.php?cc=1&in=9519993267&to=19519993267&lc=US&lg=en&mcc=000&mnc=000&imsi=0&method=sms
received:
<code>
<response status="success-sent" result="60"/>
</code>
https://r.whatsapp.net/v1/exist.php
cc = Country code for user to check?
in = Phone number for user to check?
udid = (device udid? / password?)
sent:
https://r.whatsapp.net/v1/exist.php?udid=1&cc=1&in=9519993267
received:
<exist>
<response status="fail" result="incorrect"/>
</exist>
https://r.whatsapp.net/v1/register.php - register account (use after code.php)
cc = See code.php
in = See code.php
udid = (password? device udid?)
code = The code given from the call to code.php
expected response: <register><response status="ok" login="(your loginid)" result="new" /></register>
sent:
https://r.whatsapp.net/v1/register.php?cc=1&in=7342235060&udid=1&code=60
received:
<register>
<response status="mismatch" login="17342235060" result="me=17342235060 code=60"/>
</register>
https://sro.whatsapp.net/client/iphone/bbq.php
u (array) = contact numbers
me = my phone number
cc = ?
/*** Successful? account creation, using code.node.js and register.node.js:
F:\src\whazaa>node test.node.js
statusCode 200
headers { 'x-powered-by': 'PHP/5.3.5',
'content-type': 'text/xml',
connection: 'close',
'transfer-encoding': 'chunked',
date: 'Tue, 12 Jun 2012 09:51:51 GMT',
server: 'lighttpd/1.4.28' }
<?xml version="1.0" encoding="UTF-8"?>
<code>
<response status="success-sent" result="60"/>
</code>
F:\src\whazaa>ren test.node.js code.node.js
F:\src\whazaa>copy code.node.js register.node.js
1 file(s) copied.
F:\src\whazaa>node register.node.js
statusCode 200
headers { 'x-powered-by': 'PHP/5.3.5',
'content-type': 'text/xml',
connection: 'close',
'transfer-encoding': 'chunked',
date: 'Tue, 12 Jun 2012 09:56:29 GMT',
server: 'lighttpd/1.4.28' }
<?xml version="1.0" encoding="UTF-8"?>
<register>
<response status="ok" login="19519993267" result="new"/>
</register>
***/
connection: (may be any of these?)
bin-nokia.whatsapp.net port 443
s.whatsapp.net
bin-short.whatsapp.net
startup:
open bin-short.whatsapp.net port 5222
Login:
send: "WA"."\x01\x00\x00\x19\xf8\x05\x01\xa0\x8a\x84\xfc\x11"."iPhone-2.6.9-5222".
"\x00\x08\xf8\x02\x96\xf8\x01\xf8\x01\x7e\x00\x07\xf8\x05\x0f\x5a\x2a\xbd\xa7";
$Buffer = $this->read();
$Response = base64_decode( substr( $Buffer, 26 ) );
$arrResp = explode( ",", $Response );
$authData = array();
foreach( $arrResp AS $Key => $Value )
{
$resData = explode( "=", $Value );
$authData[ $resData[0] ] = str_replace( '"', '', $resData[1] );
}
$ResData = $this -> _authenticate( $authData['nonce'] );
$Response = "\x01\x31\xf8\x04\x86\xbd\xa7\xfd\x00\x01\x28" . base64_encode( $ResData );
$this->send($Response);
$rBuffer =$this->read();
$this->read();
// this packet contains the name
$next = "\x00\x12\xf8\x05\x74\xa2\xa3\x61\xfc\x0a\x41\x68\x6d\x65\x64\x20\x4d\x6f\x68\x64\x00\x15\xf8\x06\x48\x43\x05\xa2\x3a\xf8\x01\xf8\x04\x7b\xbd\x4d\xf8\x01\xf8\x03\x55\x61\x24\x00\x12\xf8\x08\x48\x43\xfc\x01\x32\xa2\x3a\xa0\x8a\xf8\x01\xf8\x03\x1f\xbd\xb1";
$stream = $this->send($next);
$this->read();
/* Token Dictionary:
$dic[0] = 0;
$dic[1] = 0;
$dic[2] = 0;
$dic[3] = 0;
$dic[4] = 0;
$dic[5] = "1";
$dic[6] = "1.0";
$dic[7] = "ack";
$dic[8] = "action";
$dic[9] = "active";
$dic[10] = "add";
$dic[11] = "all";
$dic[12] = "allow";
$dic[13] = "apple";
$dic[14] = "audio";
$dic[15] = "auth";
$dic[16] = "author";
$dic[17] = "available";
$dic[18] = "bad-request";
$dic[19] = "basee64";
$dic[20] = "Bell.caf";
$dic[21] = "bind";
$dic[22] = "body";
$dic[23] = "Boing.caf";
$dic[24] = "cancel";
$dic[25] = "category";
$dic[26] = "challenge";
$dic[27] = "chat";
$dic[28] = "clean";
$dic[29] = "code";
$dic[30] = "composing";
$dic[31] = "config";
$dic[32] = "conflict";
$dic[33] = "contacts";
$dic[34] = "create";
$dic[35] = "creation";
$dic[36] = "default";
$dic[37] = "delay";
$dic[38] = "delete";
$dic[39] = "delivered";
$dic[40] = "deny";
$dic[41] = "DIGEST-MD5";
$dic[42] = "DIGEST-MD5-1";
$dic[43] = "dirty";
$dic[44] = "en";
$dic[45] = "enable";
$dic[46] = "encoding";
$dic[47] = "error";
$dic[48] = "expiration";
$dic[49] = "expired";
$dic[50] = "failure";
$dic[51] = "false";
$dic[52] = "favorites";
$dic[53] = "feature";
$dic[54] = "field";
$dic[55] = "free";
$dic[56] = "from";
$dic[57] = "g.us";
$dic[58] = "get";
$dic[59] = "Glas.caf";
$dic[60] = "google";
$dic[61] = "group";
$dic[62] = "groups";
$dic[63] = "g_sound";
$dic[64] = "Harp.caf";
$dic[65] = "http://etherx.jabber.org/streams";
$dic[66] = "http://jabber.org/protocol/chatstates";
$dic[67] = "id";
$dic[68] = "image";
$dic[69] = "img";
$dic[70] = "inactive";
$dic[71] = "internal-server-error";
$dic[72] = "iq";
$dic[73] = "item";
$dic[74] = "item-not-found";
$dic[75] = "jabber:client";
$dic[76] = "jabber:iq:last";
$dic[77] = "jabber:iq:privacy";
$dic[78] = "jabber:x:delay";
$dic[79] = "jabber:x:event";
$dic[80] = "jid";
$dic[81] = "jid-malformed";
$dic[82] = "kind";
$dic[83] = "leave";
$dic[84] = "leave-all";
$dic[85] = "list";
$dic[86] = "location";
$dic[87] = "max_groups";
$dic[88] = "max_participants";
$dic[89] = "max_subject";
$dic[90] = "mechanism";
$dic[91] = "mechanisms";
$dic[92] = "media";
$dic[93] = "message";
$dic[94] = "message_acks";
$dic[95] = "missing";
$dic[96] = "modify";
$dic[97] = "name";
$dic[98] = "not-acceptable";
$dic[99] = "not-allowed";
$dic[100] = "not-authorized";
$dic[101] = "notify";
$dic[102] = "Offline Storage";
$dic[103] = "order";
$dic[104] = "owner";
$dic[105] = "owning";
$dic[106] = "paid";
$dic[107] = "participant";
$dic[108] = "participants";
$dic[109] = "participating";
$dic[110] = "fail";
$dic[111] = "paused";
$dic[112] = "picture";
$dic[113] = "ping";
$dic[114] = "PLAIN";
$dic[115] = "platform";
$dic[116] = "presence";
$dic[117] = "preview";
$dic[118] = "probe";
$dic[119] = "prop";
$dic[120] = "props";
$dic[121] = "p_o";
$dic[122] = "p_t";
$dic[123] = "query";
$dic[124] = "raw";
$dic[125] = "receipt";
$dic[126] = "receipt_acks";
$dic[127] = "received";
$dic[128] = "relay";
$dic[129] = "remove";
$dic[130] = "Replaced by new connection";
$dic[131] = "request";
$dic[132] = "resource";
$dic[133] = "resource-constraint";
$dic[134] = "response";
$dic[135] = "result";
$dic[136] = "retry";
$dic[137] = "rim";
$dic[138] = "s.whatsapp.net";
$dic[139] = "seconds";
$dic[140] = "server";
$dic[141] = "session";
$dic[142] = "set";
$dic[143] = "show";
$dic[144] = "sid";
$dic[145] = "sound";
$dic[146] = "stamp";
$dic[147] = "starttls";
$dic[148] = "status";
$dic[149] = "stream:error";
$dic[150] = "stream:features";
$dic[151] = "subject";
$dic[152] = "subscribe";
$dic[153] = "success";
$dic[154] = "system-shutdown";
$dic[155] = "s_o";
$dic[156] = "s_t";
$dic[157] = "t";
$dic[158] = "TimePassing.caf";
$dic[159] = "timestamp";
$dic[160] = "to";
$dic[161] = "Tri-tone.caf";
$dic[162] = "type";
$dic[163] = "unavailable";
$dic[164] = "uri";
$dic[165] = "url";
$dic[166] = "urn:ietf:params:xml:ns:xmpp-bind";
$dic[167] = "urn:ietf:params:xml:ns:xmpp-sasl";
$dic[168] = "urn:ietf:params:xml:ns:xmpp-session";
$dic[169] = "urn:ietf:params:xml:ns:xmpp-stanzas";
$dic[170] = "urn:ietf:params:xml:ns:xmpp-streams";
$dic[171] = "urn:xmpp:delay";
$dic[172] = "urn:xmpp:ping";
$dic[173] = "urn:xmpp:receipts";
$dic[174] = "urn:xmpp:whatsapp";
$dic[175] = "urn:xmpp:whatsapp:dirty";
$dic[176] = "urn:xmpp:whatsapp:mms";
$dic[177] = "urn:xmpp:whatsapp:push";
$dic[178] = "value";
$dic[179] = "vcard";
$dic[180] = "version";
$dic[181] = "video";
$dic[182] = "w";
$dic[183] = "w:g";
$dic[184] = "w:p:r";
$dic[185] = "wait";
$dic[186] = "x";
$dic[187] = "xml-not-well-formed";
$dic[188] = "xml:lang";
$dic[189] = "xmlns";
$dic[190] = "xmlns:stream";
$dic[191] = "Xylophone.caf";
$dic[192] = "account";
$dic[193] = "digest";
$dic[194] = "g_notify";
$dic[195] = "method";
$dic[196] = "password";
$dic[197] = "registration";
$dic[198] = "stat";
$dic[199] = "text";
$dic[200] = "user";
$dic[201] = "username";
$dic[202] = "event";
$dic[203] = "latitude";
$dic[204] = "longitude";
$dic[205] = "true";
$dic[206] = "after";
$dic[207] = "before";
$dic[208] = "broadcast";
$dic[209] = "count";
$dic[210] = "features";
$dic[211] = "first";
$dic[212] = "index";
$dic[213] = "invalid-mechanism";
$dic[214] = "l$dict";
$dic[215] = "max";
$dic[216] = "offline";
$dic[217] = "proceed";
$dic[218] = "required";
$dic[219] = "sync";
$dic[220] = "elapsed";
$dic[221] = "ip";
$dic[222] = "microsoft";
$dic[223] = "mute";
$dic[224] = "nokia";
$dic[225] = "off";
$dic[226] = "pin";
$dic[227] = "pop_mean_time";
$dic[228] = "pop_plus_minus";
$dic[229] = "port";
$dic[230] = "reason";
$dic[231] = "server-error";
$dic[232] = "silent";
$dic[233] = "timeout";
$dic[234] = "lc";
$dic[235] = "lg";
$dic[236] = "bad-protocol";
$dic[237] = "none";
$dic[238] = "remote-server-timeout";
$dic[239] = "service-unavailable";
$dic[240] = "w:p";
$dic[241] = "w:profile:picture";
$dic[242] = "notification";
$dic[248] = "XXX";
*/