@erfan_bahramali/tping 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -55
- package/dist/crypto/x25519.d.ts +10 -0
- package/dist/crypto/x25519.d.ts.map +1 -0
- package/dist/crypto/x25519.js +51 -0
- package/dist/crypto/x25519.js.map +1 -0
- package/dist/index.js +82 -39
- package/dist/index.js.map +1 -1
- package/dist/lib/attempt.d.ts +31 -0
- package/dist/lib/attempt.d.ts.map +1 -0
- package/dist/lib/attempt.js +94 -0
- package/dist/lib/attempt.js.map +1 -0
- package/dist/lib/checker.d.ts +21 -3
- package/dist/lib/checker.d.ts.map +1 -1
- package/dist/lib/checker.js +133 -49
- package/dist/lib/checker.js.map +1 -1
- package/dist/lib/datacenters.d.ts +15 -0
- package/dist/lib/datacenters.d.ts.map +1 -0
- package/dist/lib/datacenters.js +20 -0
- package/dist/lib/datacenters.js.map +1 -0
- package/dist/lib/parser.d.ts +18 -3
- package/dist/lib/parser.d.ts.map +1 -1
- package/dist/lib/parser.js +174 -78
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/ping.d.ts +13 -6
- package/dist/lib/ping.d.ts.map +1 -1
- package/dist/lib/ping.js +44 -44
- package/dist/lib/ping.js.map +1 -1
- package/dist/mtproto/exchange.d.ts +10 -0
- package/dist/mtproto/exchange.d.ts.map +1 -0
- package/dist/mtproto/exchange.js +20 -0
- package/dist/mtproto/exchange.js.map +1 -0
- package/dist/mtproto/fake-tls.d.ts +36 -44
- package/dist/mtproto/fake-tls.d.ts.map +1 -1
- package/dist/mtproto/fake-tls.js +174 -148
- package/dist/mtproto/fake-tls.js.map +1 -1
- package/dist/mtproto/messages.d.ts +23 -36
- package/dist/mtproto/messages.d.ts.map +1 -1
- package/dist/mtproto/messages.js +64 -90
- package/dist/mtproto/messages.js.map +1 -1
- package/dist/mtproto/obfuscation.d.ts +23 -20
- package/dist/mtproto/obfuscation.d.ts.map +1 -1
- package/dist/mtproto/obfuscation.js +64 -64
- package/dist/mtproto/obfuscation.js.map +1 -1
- package/dist/mtproto/secret.d.ts +28 -0
- package/dist/mtproto/secret.d.ts.map +1 -0
- package/dist/mtproto/secret.js +68 -0
- package/dist/mtproto/secret.js.map +1 -0
- package/dist/mtproto/transport.d.ts +28 -0
- package/dist/mtproto/transport.d.ts.map +1 -0
- package/dist/mtproto/transport.js +78 -0
- package/dist/mtproto/transport.js.map +1 -0
- package/dist/net/http-client.d.ts +37 -0
- package/dist/net/http-client.d.ts.map +1 -0
- package/dist/net/http-client.js +93 -0
- package/dist/net/http-client.js.map +1 -0
- package/dist/net/http-proxy.d.ts +26 -0
- package/dist/net/http-proxy.d.ts.map +1 -0
- package/dist/net/http-proxy.js +71 -0
- package/dist/net/http-proxy.js.map +1 -0
- package/dist/net/socks5.d.ts +15 -0
- package/dist/net/socks5.d.ts.map +1 -0
- package/dist/net/socks5.js +112 -0
- package/dist/net/socks5.js.map +1 -0
- package/dist/net/stream.d.ts +54 -0
- package/dist/net/stream.d.ts.map +1 -0
- package/dist/net/stream.js +142 -0
- package/dist/net/stream.js.map +1 -0
- package/dist/net/websocket.d.ts +19 -0
- package/dist/net/websocket.d.ts.map +1 -0
- package/dist/net/websocket.js +123 -0
- package/dist/net/websocket.js.map +1 -0
- package/dist/types/index.d.ts +40 -17
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/format.d.ts +7 -14
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +101 -87
- package/dist/utils/format.js.map +1 -1
- package/dist/webproxy/check.d.ts +15 -0
- package/dist/webproxy/check.d.ts.map +1 -0
- package/dist/webproxy/check.js +423 -0
- package/dist/webproxy/check.js.map +1 -0
- package/dist/webproxy/frames.d.ts +30 -0
- package/dist/webproxy/frames.d.ts.map +1 -0
- package/dist/webproxy/frames.js +59 -0
- package/dist/webproxy/frames.js.map +1 -0
- package/dist/webproxy/link.d.ts +27 -0
- package/dist/webproxy/link.d.ts.map +1 -0
- package/dist/webproxy/link.js +107 -0
- package/dist/webproxy/link.js.map +1 -0
- package/package.json +16 -11
- package/dist/mtproto/connection.d.ts +0 -59
- package/dist/mtproto/connection.d.ts.map +0 -1
- package/dist/mtproto/connection.js +0 -198
- package/dist/mtproto/connection.js.map +0 -1
- package/dist/mtproto/socks5.d.ts +0 -36
- package/dist/mtproto/socks5.d.ts.map +0 -1
- package/dist/mtproto/socks5.js +0 -148
- package/dist/mtproto/socks5.js.map +0 -1
package/dist/mtproto/fake-tls.js
CHANGED
|
@@ -1,175 +1,201 @@
|
|
|
1
|
-
import { createHmac, randomBytes } from 'crypto';
|
|
1
|
+
import { createHmac, randomBytes, randomInt } from 'crypto';
|
|
2
|
+
import { generateX25519PublicKey } from '../crypto/x25519.js';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* @param secretHex - Hex-encoded secret (with or without dd/ee prefix)
|
|
4
|
+
* Fake TLS layer for MTProto proxies (secret with "ee" prefix), implemented
|
|
5
|
+
* like Telegram Desktop (mtproto_tls_socket.cpp) and Android (tgnet).
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (secret.length !== 16) {
|
|
12
|
-
throw new Error('dd secret must be 16 bytes');
|
|
13
|
-
}
|
|
14
|
-
return { secret, isFakeTLS: false };
|
|
15
|
-
}
|
|
16
|
-
if (hex.startsWith('ee')) {
|
|
17
|
-
const rest = hex.slice(2);
|
|
18
|
-
if (rest.length < 32) {
|
|
19
|
-
throw new Error('ee secret must have at least 16 bytes');
|
|
20
|
-
}
|
|
21
|
-
const secret = Buffer.from(rest.slice(0, 32), 'hex');
|
|
22
|
-
const domain = rest.length > 32 ? Buffer.from(rest.slice(32), 'hex').toString('ascii') : undefined;
|
|
23
|
-
return { secret, domain, isFakeTLS: true };
|
|
24
|
-
}
|
|
25
|
-
const secret = Buffer.from(hex, 'hex');
|
|
26
|
-
if (secret.length !== 16) {
|
|
27
|
-
throw new Error('Secret must be 16 bytes');
|
|
7
|
+
export class FakeTlsError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'FakeTlsError';
|
|
28
11
|
}
|
|
29
|
-
return { secret, isFakeTLS: false };
|
|
30
12
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
13
|
+
/** Offset of the 32-byte random field inside the ClientHello / ServerHello packet. */
|
|
14
|
+
export const RANDOM_OFFSET = 11;
|
|
15
|
+
const RANDOM_LENGTH = 32;
|
|
16
|
+
/** Official clients pad the ClientHello to 517 bytes, like Chrome. */
|
|
17
|
+
const PADDING_TARGET = 513;
|
|
18
|
+
/** Official clients split outgoing data into records of at most this size. */
|
|
19
|
+
export const MAX_CLIENT_RECORD = 2878;
|
|
20
|
+
const MAX_SERVER_RECORD = 16384 + 256;
|
|
21
|
+
const SERVER_HELLO_HEADER = Buffer.from('160303', 'hex');
|
|
22
|
+
const SERVER_HELLO_MIDDLE = Buffer.from('140303000101170303', 'hex');
|
|
23
|
+
const CLIENT_PREFIX = Buffer.from('140303000101', 'hex');
|
|
24
|
+
const APP_DATA_HEADER = Buffer.from('170303', 'hex');
|
|
25
|
+
const TLS_ALERT = 0x15;
|
|
26
|
+
const hex = (value) => Buffer.from(value.replace(/\s+/g, ''), 'hex');
|
|
27
|
+
const u16 = (value) => {
|
|
28
|
+
const out = Buffer.alloc(2);
|
|
29
|
+
out.writeUInt16BE(value, 0);
|
|
30
|
+
return out;
|
|
48
31
|
};
|
|
49
|
-
const u24 = (
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
return
|
|
32
|
+
const u24 = (value) => {
|
|
33
|
+
const out = Buffer.alloc(3);
|
|
34
|
+
out.writeUIntBE(value, 0, 3);
|
|
35
|
+
return out;
|
|
53
36
|
};
|
|
54
|
-
const extension = (type, data) => Buffer.concat([u16(type), u16(data.length), data]);
|
|
55
37
|
/**
|
|
56
|
-
*
|
|
38
|
+
* Seven GREASE values (RFC 8701), consecutive pairs forced to differ.
|
|
57
39
|
*/
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
40
|
+
const generateGrease = () => {
|
|
41
|
+
const grease = randomBytes(7);
|
|
42
|
+
for (let i = 0; i < grease.length; i++) {
|
|
43
|
+
grease[i] = (grease[i] & 0xf0) + 0x0a;
|
|
44
|
+
}
|
|
45
|
+
for (let i = 1; i < grease.length; i += 2) {
|
|
46
|
+
if (grease[i] === grease[i - 1]) {
|
|
47
|
+
grease[i] ^= 0x10;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return grease;
|
|
51
|
+
};
|
|
52
|
+
const shuffle = (items) => {
|
|
53
|
+
const result = [...items];
|
|
54
|
+
for (let i = result.length - 1; i > 0; i--) {
|
|
55
|
+
const j = randomInt(i + 1);
|
|
56
|
+
[result[i], result[j]] = [result[j], result[i]];
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
62
59
|
};
|
|
63
60
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* @param secret - 16-byte proxy secret
|
|
61
|
+
* Build the ClientHello exactly like the official clients: Chrome-like cipher
|
|
62
|
+
* suites and extensions (shuffled), GREASE, a valid x25519 key share, padding
|
|
63
|
+
* to 517 bytes, and the client random set to HMAC-SHA256(secret, packet) with
|
|
64
|
+
* the last 4 bytes XORed with the current UNIX time.
|
|
69
65
|
*/
|
|
70
|
-
export
|
|
71
|
-
const
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
export const buildClientHello = (domain, key, nowMs = Date.now()) => {
|
|
67
|
+
const g = generateGrease();
|
|
68
|
+
const grease = (index) => Buffer.from([g[index], g[index]]);
|
|
69
|
+
const host = Buffer.from(domain, 'utf8');
|
|
70
|
+
const extensions = shuffle([
|
|
71
|
+
Buffer.concat([hex('0000'), u16(host.length + 5), u16(host.length + 3), hex('00'), u16(host.length), host]),
|
|
72
|
+
hex('0005 0005 01 0000 0000'),
|
|
73
|
+
Buffer.concat([hex('000a 000a 0008'), grease(4), hex('001d 0017 0018')]),
|
|
74
|
+
hex('000b 0002 01 00'),
|
|
75
|
+
hex('000d 0012 0010 0403 0804 0401 0503 0805 0501 0806 0601'),
|
|
76
|
+
hex('0010 000e 000c 02 6832 08 687474702f312e31'),
|
|
77
|
+
hex('0012 0000'),
|
|
78
|
+
hex('0017 0000'),
|
|
79
|
+
hex('001b 0003 02 0002'),
|
|
80
|
+
hex('0023 0000'),
|
|
81
|
+
Buffer.concat([hex('002b 0007 06'), grease(6), hex('0304 0303')]),
|
|
82
|
+
hex('002d 0002 01 01'),
|
|
83
|
+
Buffer.concat([hex('0033 002b 0029'), grease(4), hex('0001 00 001d 0020'), generateX25519PublicKey()]),
|
|
84
|
+
hex('4469 0005 0003 02 6832'),
|
|
85
|
+
hex('ff01 0001 00'),
|
|
84
86
|
]);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
extension(0x000b, Buffer.concat([u16(2), Buffer.from([0x01, 0x00])])), // ec_point_formats: uncompressed
|
|
90
|
-
extension(0x000d, Buffer.concat([u16(4), u16(0x0804), u16(0x0401)])), // signature_algorithms
|
|
91
|
-
extension(0x002b, Buffer.concat([u16(4), Buffer.from([0x03, 0x04, 0x03, 0x03])])), // supported_versions: TLS1.3, TLS1.2
|
|
92
|
-
extension(0x0033, Buffer.concat([u16(2 + 2 + keyShare.length), u16(0x001d), u16(keyShare.length), keyShare])), // key_share x25519
|
|
93
|
-
extension(0x0016, Buffer.alloc(0)), // encrypt_then_mac
|
|
94
|
-
extension(0x0017, Buffer.alloc(0)), // extended_master_secret
|
|
87
|
+
let extensionBlock = Buffer.concat([grease(2), hex('0000'), ...extensions, grease(3), hex('0001 00')]);
|
|
88
|
+
const cipherSuites = Buffer.concat([
|
|
89
|
+
grease(0),
|
|
90
|
+
hex('1301 1302 1303 c02b c02f c02c c030 cca9 cca8 c013 c014 009c 009d 002f 0035'),
|
|
95
91
|
]);
|
|
92
|
+
// record header + handshake header + version + random + session id + suites + compression + ext length
|
|
93
|
+
const fixedLength = 5 + 4 + 2 + RANDOM_LENGTH + 1 + 32 + 2 + cipherSuites.length + 2 + 2;
|
|
94
|
+
const unpadded = fixedLength + extensionBlock.length;
|
|
95
|
+
if (unpadded < PADDING_TARGET) {
|
|
96
|
+
const size = PADDING_TARGET - unpadded;
|
|
97
|
+
extensionBlock = Buffer.concat([extensionBlock, hex('0015'), u16(size), Buffer.alloc(size)]);
|
|
98
|
+
}
|
|
96
99
|
const body = Buffer.concat([
|
|
97
|
-
|
|
98
|
-
Buffer.alloc(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
Buffer.from([TLS_RECORD.HANDSHAKE, 0x03, 0x01]), u16(handshake.length), handshake,
|
|
100
|
+
hex('0303'),
|
|
101
|
+
Buffer.alloc(RANDOM_LENGTH),
|
|
102
|
+
hex('20'),
|
|
103
|
+
randomBytes(32),
|
|
104
|
+
u16(cipherSuites.length),
|
|
105
|
+
cipherSuites,
|
|
106
|
+
hex('0100'),
|
|
107
|
+
u16(extensionBlock.length),
|
|
108
|
+
extensionBlock,
|
|
107
109
|
]);
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
digest
|
|
110
|
+
const handshake = Buffer.concat([hex('01'), u24(body.length), body]);
|
|
111
|
+
const packet = Buffer.concat([hex('160301'), u16(handshake.length), handshake]);
|
|
112
|
+
const digest = createHmac('sha256', key).update(packet).digest();
|
|
113
|
+
const timestamp = Math.floor(nowMs / 1000) >>> 0;
|
|
114
|
+
digest.writeUInt32LE((digest.readUInt32LE(28) ^ timestamp) >>> 0, 28);
|
|
111
115
|
digest.copy(packet, RANDOM_OFFSET);
|
|
112
|
-
return packet;
|
|
113
|
-
}
|
|
116
|
+
return { packet, clientRandom: Buffer.from(digest) };
|
|
117
|
+
};
|
|
114
118
|
/**
|
|
115
|
-
*
|
|
119
|
+
* Check the proxy's ServerHello: HMAC-SHA256(secret, clientRandom || response
|
|
120
|
+
* with the random field zeroed) must equal the random field.
|
|
116
121
|
*/
|
|
117
|
-
export
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
for (let i = 0; i < data.length; i += MAX_CHUNK_SIZE) {
|
|
121
|
-
const chunk = data.subarray(i, Math.min(i + MAX_CHUNK_SIZE, data.length));
|
|
122
|
-
const record = Buffer.alloc(5 + chunk.length);
|
|
123
|
-
record.writeUInt8(TLS_RECORD.APPLICATION_DATA, 0);
|
|
124
|
-
record.writeUInt16BE(0x0303, 1);
|
|
125
|
-
record.writeUInt16BE(chunk.length, 3);
|
|
126
|
-
chunk.copy(record, 5);
|
|
127
|
-
chunks.push(record);
|
|
122
|
+
export const verifyServerHello = (response, clientRandom, key) => {
|
|
123
|
+
if (response.length < RANDOM_OFFSET + RANDOM_LENGTH) {
|
|
124
|
+
return false;
|
|
128
125
|
}
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
const zeroed = Buffer.from(response);
|
|
127
|
+
zeroed.fill(0, RANDOM_OFFSET, RANDOM_OFFSET + RANDOM_LENGTH);
|
|
128
|
+
const expected = createHmac('sha256', key).update(clientRandom).update(zeroed).digest();
|
|
129
|
+
return expected.equals(response.subarray(RANDOM_OFFSET, RANDOM_OFFSET + RANDOM_LENGTH));
|
|
130
|
+
};
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
132
|
+
* TLS record wrapper used after the handshake.
|
|
133
|
+
* Outgoing: one ChangeCipherSpec prefix, then Application Data records of at most 2878 bytes.
|
|
134
|
+
* Incoming: only Application Data records are accepted.
|
|
135
135
|
*/
|
|
136
|
-
export
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
export class FakeTlsPipe {
|
|
137
|
+
inner;
|
|
138
|
+
prefixSent = false;
|
|
139
|
+
incoming = Buffer.alloc(0);
|
|
140
|
+
constructor(inner) {
|
|
141
|
+
this.inner = inner;
|
|
142
|
+
}
|
|
143
|
+
write(data) {
|
|
144
|
+
const parts = [];
|
|
145
|
+
if (!this.prefixSent) {
|
|
146
|
+
parts.push(CLIENT_PREFIX);
|
|
147
|
+
this.prefixSent = true;
|
|
148
|
+
}
|
|
149
|
+
for (let offset = 0; offset < data.length; offset += MAX_CLIENT_RECORD) {
|
|
150
|
+
const chunk = data.subarray(offset, Math.min(offset + MAX_CLIENT_RECORD, data.length));
|
|
151
|
+
parts.push(APP_DATA_HEADER, u16(chunk.length), chunk);
|
|
152
|
+
}
|
|
153
|
+
this.inner.write(Buffer.concat(parts));
|
|
154
|
+
}
|
|
155
|
+
async read(length) {
|
|
156
|
+
while (this.incoming.length < length) {
|
|
157
|
+
const header = await this.inner.read(5);
|
|
158
|
+
if (!header.subarray(0, 3).equals(APP_DATA_HEADER)) {
|
|
159
|
+
throw new FakeTlsError(`Unexpected TLS record type 0x${header[0].toString(16)} from proxy`);
|
|
160
|
+
}
|
|
161
|
+
const size = header.readUInt16BE(3);
|
|
162
|
+
if (size > MAX_SERVER_RECORD) {
|
|
163
|
+
throw new FakeTlsError('TLS record from proxy is too large');
|
|
164
|
+
}
|
|
165
|
+
const body = await this.inner.read(size);
|
|
166
|
+
this.incoming = Buffer.concat([this.incoming, body]);
|
|
167
|
+
}
|
|
168
|
+
const out = this.incoming.subarray(0, length);
|
|
169
|
+
this.incoming = this.incoming.subarray(length);
|
|
170
|
+
return out;
|
|
145
171
|
}
|
|
146
|
-
return { payload, rest: buffer.subarray(offset) };
|
|
147
172
|
}
|
|
148
173
|
/**
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* @returns 'incomplete' while waiting for more bytes, 'valid' or 'invalid' when decided
|
|
174
|
+
* Perform the fake TLS handshake. Like the official clients, the response must
|
|
175
|
+
* be exactly: ServerHello record, ChangeCipherSpec (1 byte), one Application
|
|
176
|
+
* Data record; anything else is rejected.
|
|
154
177
|
*/
|
|
155
|
-
export
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
178
|
+
export const fakeTlsHandshake = async (stream, key, domain) => {
|
|
179
|
+
const hello = buildClientHello(domain, key);
|
|
180
|
+
stream.write(hello.packet);
|
|
181
|
+
const first = await stream.read(5);
|
|
182
|
+
if (first[0] === TLS_ALERT) {
|
|
183
|
+
throw new FakeTlsError('Proxy answered with a TLS alert (ClientHello rejected)');
|
|
161
184
|
}
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
185
|
+
if (!first.subarray(0, 3).equals(SERVER_HELLO_HEADER)) {
|
|
186
|
+
throw new FakeTlsError('Not a fake-TLS proxy (response is not a TLS ServerHello)');
|
|
187
|
+
}
|
|
188
|
+
const helloBody = await stream.read(first.readUInt16BE(3));
|
|
189
|
+
const middle = await stream.read(SERVER_HELLO_MIDDLE.length);
|
|
190
|
+
if (!middle.equals(SERVER_HELLO_MIDDLE)) {
|
|
191
|
+
throw new FakeTlsError('Unexpected fake-TLS ServerHello layout (looks like a real TLS server, not the proxy)');
|
|
192
|
+
}
|
|
193
|
+
const appLength = await stream.read(2);
|
|
194
|
+
const appBody = await stream.read(appLength.readUInt16BE(0));
|
|
195
|
+
const response = Buffer.concat([first, helloBody, middle, appLength, appBody]);
|
|
196
|
+
if (!verifyServerHello(response, hello.clientRandom, key)) {
|
|
197
|
+
throw new FakeTlsError('Fake-TLS verification failed: wrong secret, or the real site answered instead of the proxy (check system clock too)');
|
|
198
|
+
}
|
|
199
|
+
return new FakeTlsPipe(stream);
|
|
200
|
+
};
|
|
175
201
|
//# sourceMappingURL=fake-tls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fake-tls.js","sourceRoot":"","sources":["../../src/mtproto/fake-tls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"fake-tls.js","sourceRoot":"","sources":["../../src/mtproto/fake-tls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAG9D;;;GAGG;AAEH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,sEAAsE;AACtE,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,8EAA8E;AAC9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,MAAM,iBAAiB,GAAG,KAAK,GAAG,GAAG,CAAC;AAEtC,MAAM,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC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,CAAC;IACrF,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,YAAY,CAAC,sFAAsF,CAAC,CAAC;IACjH,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7D,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/E,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,YAAY,EAAE,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,YAAY,CACpB,qHAAqH,CACtH,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC,CAAC"}
|
|
@@ -1,48 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Format: time.time() * 2^32, must be divisible by 4
|
|
4
|
-
* Client message IDs must be divisible by 4
|
|
2
|
+
* Client message_id: unixtime * 2^32, divisible by 4.
|
|
5
3
|
*/
|
|
6
|
-
export declare
|
|
4
|
+
export declare const generateMessageId: (nowMs?: number) => bigint;
|
|
7
5
|
/**
|
|
8
|
-
*
|
|
9
|
-
* TL Schema: req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
|
|
10
|
-
*
|
|
11
|
-
* @param nonce - 16-byte random nonce
|
|
12
|
-
* @returns TL-serialized message
|
|
6
|
+
* Unencrypted message: auth_key_id (0) + message_id + length + body.
|
|
13
7
|
*/
|
|
14
|
-
export declare
|
|
8
|
+
export declare const buildUnencryptedMessage: (body: Buffer, messageId?: bigint) => Buffer;
|
|
15
9
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* Format:
|
|
19
|
-
* - auth_key_id: 8 bytes (all zeros for unencrypted)
|
|
20
|
-
* - message_id: 8 bytes
|
|
21
|
-
* - message_length: 4 bytes
|
|
22
|
-
* - message: N bytes
|
|
23
|
-
*
|
|
24
|
-
* @param tlMessage - TL-serialized message
|
|
25
|
-
* @param messageId - Message ID
|
|
26
|
-
* @returns Unencrypted message
|
|
10
|
+
* req_pq_multi#be7e8ef1 nonce:int128 = ResPQ;
|
|
27
11
|
*/
|
|
28
|
-
export declare
|
|
12
|
+
export declare const buildReqPqMulti: (nonce?: Buffer) => {
|
|
13
|
+
readonly message: Buffer;
|
|
14
|
+
readonly nonce: Buffer;
|
|
15
|
+
};
|
|
16
|
+
export interface ResPQ {
|
|
17
|
+
readonly nonce: Buffer;
|
|
18
|
+
readonly serverNonce: Buffer;
|
|
19
|
+
}
|
|
29
20
|
/**
|
|
30
|
-
*
|
|
21
|
+
* Parse an unencrypted resPQ message (transport framing already removed;
|
|
22
|
+
* trailing transport padding is allowed).
|
|
31
23
|
*
|
|
32
|
-
*
|
|
33
|
-
* @returns Payload with length prefix
|
|
24
|
+
* resPQ#05162463 nonce:int128 server_nonce:int128 pq:string server_public_key_fingerprints:Vector<long> = ResPQ;
|
|
34
25
|
*/
|
|
35
|
-
export declare
|
|
26
|
+
export declare const parseResPQ: (data: Buffer) => ResPQ | null;
|
|
36
27
|
/**
|
|
37
|
-
* Parse
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
28
|
+
* Parse a req_pq_multi message (used by tests and mock servers).
|
|
29
|
+
*/
|
|
30
|
+
export declare const parseReqPqMulti: (data: Buffer) => Buffer | null;
|
|
31
|
+
/**
|
|
32
|
+
* Build a resPQ reply for the given nonce (used by tests and mock servers).
|
|
42
33
|
*/
|
|
43
|
-
export declare
|
|
44
|
-
nonce: Buffer;
|
|
45
|
-
serverNonce: Buffer;
|
|
46
|
-
constructor: number;
|
|
47
|
-
} | null;
|
|
34
|
+
export declare const buildResPQ: (nonce: Buffer) => Buffer;
|
|
48
35
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/mtproto/messages.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/mtproto/messages.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAO,MAAmB,KAAG,MAI9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,EAAE,YAAW,MAA4B,KAAG,MAK/F,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAO,MAAwB,KAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAKnH,CAAC;AAEF,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,KAAK,GAAG,IAkBjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,IAKvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MAU1C,CAAC"}
|