Skip to content

Instantly share code, notes, and snippets.

@ianatha
Created August 17, 2019 00:24
Show Gist options
  • Save ianatha/ff7767eda2cabf573180b15bbc80a40b to your computer and use it in GitHub Desktop.
Save ianatha/ff7767eda2cabf573180b15bbc80a40b to your computer and use it in GitHub Desktop.
Solution for a DEFCON 26 Biohacking Village CTF challenge
#!/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