Created
August 17, 2019 00:24
-
-
Save ianatha/ff7767eda2cabf573180b15bbc80a40b to your computer and use it in GitHub Desktop.
Solution for a DEFCON 26 Biohacking Village CTF challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3 | |
import binascii | |
import pyshark | |
set_brightness_cap = pyshark.FileCapture('bacnetlightingxfil.pcap', | |
display_filter='bacnet && (bacapp.confirmed_service == 15) && (bacapp.type == 0)' | |
) | |
vals = [ int(packet.bacapp.present_value_real) for packet in set_brightness_cap ] | |
print("\t".join(map(str, vals))) | |
encoded_bits = [ 1 if x>95 else 0 for x in vals ] | |
n = int('0b%s' % "".join(map(str, encoded_bits)), 2) | |
res = binascii.unhexlify('%x' % n) | |
print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment