Skip to content

Instantly share code, notes, and snippets.

@sahuk
Last active February 8, 2016 09:56
Show Gist options
  • Save sahuk/696ff4efa8cf53df4ad5 to your computer and use it in GitHub Desktop.
Save sahuk/696ff4efa8cf53df4ad5 to your computer and use it in GitHub Desktop.
FSK dog collar packet dissection
#!/usr/bin/env python
from bitarray import bitarray
start = "101001110001000100010010"
ends = ["1000000000100100",
"0100000011100100",
"1100000001100100",
"0010000010000100",
"1010000000000100"]
for block in [bitarray(start + e, endian='little') for e in ends]:
xor = reduce(lambda x, y: x ^ y,
[ord(c) for c in block.tobytes()[:-1]])
print xor, ord(block[-8:].tobytes())
36 36
39 39
38 38
33 33
32 32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment