Created
August 28, 2012 00:50
-
-
Save evandrix/3493935 to your computer and use it in GitHub Desktop.
PlaidCTF 2012: 200 - Torrent
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
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