JSMTProxy icon indicating copy to clipboard operation
JSMTProxy copied to clipboard

how change size secret code

Open masoudzeeb opened this issue 6 years ago • 0 comments

Hi Unfortunately, all proxies fail to detect the state using the packet size of the protocol Please advise how to resize the secret code so that the package cannot be identified

how change this code use66 char secret code?


let buf64 = Buffer.allocUnsafe(64);
			data.copy(buf64);
			let keyIv = Buffer.allocUnsafe(48);
			buf64.copy(keyIv, 0, 8);

			let decryptKey_client = Buffer.allocUnsafe(32);
			keyIv.copy(decryptKey_client, 0, 0);

			let decryptIv_client = Buffer.allocUnsafe(16);
			keyIv.copy(decryptIv_client, 0, 32);

			reverseInplace(keyIv);

			let encryptKey_client = Buffer.allocUnsafe(32);
			keyIv.copy(encryptKey_client, 0, 0);

			let encryptIv_client = Buffer.allocUnsafe(16);
			keyIv.copy(encryptIv_client, 0, 32);

			let binSecret = Buffer.from(configObj.secret, 'hex');

			decryptKey_client = crypto.createHash('sha256').update(Buffer.concat([decryptKey_client, binSecret])).digest();
			encryptKey_client = crypto.createHash('sha256').update(Buffer.concat([encryptKey_client, binSecret])).digest();

			socket.cipher_dec_client = crypto.createCipheriv('aes-256-ctr', decryptKey_client, decryptIv_client);
			socket.cipher_enc_client = crypto.createCipheriv('aes-256-ctr', encryptKey_client, encryptIv_client);

			let dec_auth_packet = socket.cipher_dec_client.update(buf64);
			socket.dcId = Math.abs(dec_auth_packet.readInt16LE(60)) - 1;

			for (var i = 0; i < 4; i++) {
				if (dec_auth_packet[56 + i] != 0xef) {
					socket.destroy();
					return;
				}
			}

			if (socket.dcId > 4 || socket.dcId < 0) {
				socket.destroy();
				return;
			}

			data = data.slice(64, data.length);
			socket.init = true;

masoudzeeb avatar Jan 28 '20 08:01 masoudzeeb