Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created August 28, 2012 00:50
Show Gist options
  • Save evandrix/3493935 to your computer and use it in GitHub Desktop.
Save evandrix/3493935 to your computer and use it in GitHub Desktop.
PlaidCTF 2012: 200 - Torrent
packets = []
f = open('packets', 'rb')
data = f.readlines()
f.close()
for line in data:
line = line.strip()
packets.append({'index': line.split('\t')[0], 'data': line.split('\t')[1]})
packets = sorted(packets, key=lambda packet: packet['index'])
f = open('torrent_out.bz2', 'wb')
for packet in packets:
sz = ''.join(packet['data'].split(":"))
f.write(sz.decode('hex'))
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment