homebridge-xbox-tv 2.9.7-beta.21 → 2.9.7-beta.23
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/package.json +1 -1
- package/src/localApi/message.js +12 -9
- package/src/localApi/simple.js +7 -6
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Xbox TV",
|
|
3
3
|
"name": "homebridge-xbox-tv",
|
|
4
|
-
"version": "2.9.7-beta.
|
|
4
|
+
"version": "2.9.7-beta.23",
|
|
5
5
|
"description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Xbox game consoles.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/localApi/message.js
CHANGED
|
@@ -447,28 +447,31 @@ class MESSAGE {
|
|
|
447
447
|
protectedPayload: payload.readBytes()
|
|
448
448
|
};
|
|
449
449
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
450
|
+
let packetType = packet.type;
|
|
451
|
+
packetType = packet.flags.type;
|
|
452
|
+
|
|
453
|
+
let protectedPayload = packet.protectedPayload;
|
|
454
|
+
protectedPayload = Buffer.from(protectedPayload.slice(0, -32));
|
|
455
|
+
packet.signature = protectedPayload.slice(-32);
|
|
453
456
|
|
|
454
457
|
// Lets decrypt the data when the payload is encrypted
|
|
455
|
-
if (
|
|
458
|
+
if (protectedPayload) {
|
|
456
459
|
const iv = xboxlocalapi.crypto.getIv();
|
|
457
460
|
const key = xboxlocalapi.crypto.encrypt(this.packetData.slice(0, 16), iv);
|
|
458
|
-
let decryptedPayload = xboxlocalapi.crypto.decrypt(
|
|
461
|
+
let decryptedPayload = xboxlocalapi.crypto.decrypt(protectedPayload, key);
|
|
459
462
|
packet.decryptedPayload = new PacketStructure(decryptedPayload).toBuffer();
|
|
460
463
|
decryptedPayload = new PacketStructure(decryptedPayload);
|
|
461
464
|
|
|
462
|
-
this.structure = Packet[
|
|
463
|
-
const protectedStructure = Packet[
|
|
465
|
+
this.structure = Packet[packetType];
|
|
466
|
+
const protectedStructure = Packet[packetType];
|
|
464
467
|
packet['protectedPayload'] = {};
|
|
465
468
|
|
|
466
469
|
for (const name in protectedStructure) {
|
|
467
|
-
|
|
470
|
+
protectedPayload[name] = protectedStructure[name].unpack(decryptedPayload);
|
|
468
471
|
};
|
|
469
472
|
};
|
|
470
473
|
|
|
471
|
-
this.packetType =
|
|
474
|
+
this.packetType = packetType;
|
|
472
475
|
this.packetDecoded = packet;
|
|
473
476
|
|
|
474
477
|
return this;
|
package/src/localApi/simple.js
CHANGED
|
@@ -260,22 +260,23 @@ class SIMPLE {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// Lets decrypt the data when the payload is encrypted
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
let protectedPayload = packet.protectedPayload;
|
|
264
|
+
if (protectedPayload) {
|
|
265
|
+
protectedPayload = protectedPayload.slice(0, -32);
|
|
265
266
|
packet.signature = packet.protectedPayload.slice(-32);
|
|
266
267
|
|
|
267
268
|
const iv = packet.iv;
|
|
268
269
|
const protectedPayloadLength = packet.protectedPayloadLength;
|
|
269
|
-
let decryptedPayload = xboxlocalapi.crypto.decrypt(
|
|
270
|
+
let decryptedPayload = xboxlocalapi.crypto.decrypt(protectedPayload, iv);
|
|
270
271
|
decryptedPayload = decryptedPayload.slice(0, protectedPayloadLength);
|
|
271
272
|
decryptedPayload = new PacketStructure(decryptedPayload);
|
|
272
273
|
|
|
273
274
|
const protectedStructure = Packet[`${packetFormat}Protected`];
|
|
274
|
-
|
|
275
|
+
protectedPayload = {};
|
|
275
276
|
|
|
276
277
|
for (const name in protectedStructure) {
|
|
277
|
-
|
|
278
|
-
this.set('protectedPayload',
|
|
278
|
+
protectedPayload[name] = protectedStructure[name].unpack(decryptedPayload);
|
|
279
|
+
this.set('protectedPayload', protectedPayload);
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
282
|
|