magicmonkey / lifxjs

JS library for LIFX bulbs
MIT License
276 stars 63 forks source link

Wireshark dissector: Range is out of bounds #36

Open dethos opened 9 years ago

dethos commented 9 years ago

I've been trying I use the dissector provided by the project, but in some packets marked with LIFX as description i get the following error:

Lua Error: [string "/path/to/lua/script/l..."]:436: Range is out of bounds

Packet's content:

0000   00 00 20 00 2a 48 18 00 00 00 6c 09 80 04 d1 01  .. .*H....l.....
0010   00 00 0f 00 07 00 00 00 9c 50 04 00 00 00 00 00  .........P......
0020   88 01 2c 00 d0 73 d5 00 5b 73 78 d6 f0 05 7d 17  ..,..s..[sx...}.
0030   d0 73 d5 00 5b 73 20 05 00 00 aa aa 03 00 00 00  .s..[s .........
0040   08 00 45 00 00 cd 95 2f 40 00 40 06 4c d8 ac 10  ..E..../@.@.L...
0050   00 02 ac 10 00 01 85 ba dd 7c 41 1b 2e 03 d8 e8  .........|A.....
0060   78 e9 50 18 58 74 5c 07 00 00 17 03 01 00 a0 1f  x.P.Xt\.........
0070   fe 5d 72 15 ac 5f 1f 1a bc 22 fb 6f d1 27 48 6f  .]r.._...".o.'Ho
0080   5a 88 54 3f 85 a7 4c 8b 0c e9 62 ce 18 b8 b0 ed  Z.T?..L...b.....
0090   12 1a 42 db 80 1f 61 63 70 ad fc 2b 62 71 c1 2a  ..B...acp..+bq.*
00a0   16 0b 34 65 4c e6 30 ee b3 6d a9 53 29 23 8b a9  ..4eL.0..m.S)#..
00b0   a1 38 5b 8c 72 cf 0b 4d 97 6b 58 40 07 89 20 c3  .8[.r..M.kX@.. .
00c0   0b 5d 19 70 b2 72 25 51 d1 88 e2 cf 5b 42 ee ff  .].p.r%Q....[B..
00d0   6a cc 05 98 62 0b 10 9f 36 f1 d8 29 83 cd 5d ac  j...b...6..)..].
00e0   7d d2 e9 2e 2e 23 d7 b6 ea 46 7b 35 6c 99 3f c7  }....#...F{5l.?.
00f0   3b 12 dd 76 2c 69 ac f6 df 1a 79 22 df c3 79 53  ;..v,i....y"..yS
0100   ea a7 95 bd 70 3b 47 9e c8 2c 7a 0a 6e f7 f1     ....p;G..,z.n..
terrcin commented 9 years ago

I'm getting the following error caused at least by quitting the Android Lifx app, quitting the iPhone app doesn't cause it.

buffer.js:506
    throw new RangeError('index out of range');
    ^
RangeError: index out of range
    at checkOffset (buffer.js:506:11)
    at Buffer.readUInt16LE (buffer.js:552:5)
    at Object.type.uint16_le.parse (lifxjs-magicmonkey/packet.js:138:13)
    at Object.packet.fromBytes (lifxjs-magicmonkey/packet.js:26:39)
    at Socket.<anonymous> (lifxjs-magicmonkey/lifx.js:47:20)
    at Socket.emit (events.js:110:17)
    at UDP.onMessage (dgram.js:472:8)

Sort of looks similar to me, I've tried using wireshark but that doesn't seem to run for me so I can't compare with what @dethos has reported.

dethos commented 9 years ago

Could this error be due to some protocol changes in recent firmware updates?

PhilWheat commented 9 years ago

I completely expect it is. The protocol changes have been pretty significant and completely undocumented, that's why I gave up on trying to dev for this platform.

terrcin commented 9 years ago

Version 2.2.1 for Android has just come out, I'll see if it's still doing this after work tonight. But yeah, I totally get that this is an undocumented protocol and an unofficial library.

terrcin commented 9 years ago

Nope, the Android update has not changed that behavour.

jaslo commented 9 years ago

So is this project abandoned? I found the parser crashed when it got a 4 byte packet. Also, I was seeing constant "getPanGateway" messages, even though the rinfo showed that the LIFX bulb was the source of the messages. I am currently going through https://github.com/LIFX to see if I can determine the protocol from there.

MariusRumpf commented 9 years ago

As I found LIFX hasn't updated it's own packages yet, https://github.com/LIFX. They are suffering the same issues. This behavior is documented in multiple issues there. At the moment it is unknown what is new with the 2.0 firmware upgrade. Various forks of this project attempt to find solutions for the changes and some of them are working again at a basic level. I would say it just takes time to update the library and not take it as abandoned.