Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # Blizzard Downloader torrent extractor
- __author__ = 'sublimal'
- __copyright__ =' Copyright 2007 sublimal'
- __version__ = '1.0'
- __date__ = '22-07-2007'
- __license__ = 'GPL'
- import os, re, struct
- def get_torrent_by_signature(data):
- signature = data[-8:]
- sig, t_size = struct.unpack('4si', signature)
- assert sig == 'PSER', 'Could not find signature'
- torrent = data[t_size-8:-8]
- return torrent
- if __name__ == '__main__':
- for fname in os.listdir('.'):
- if re.search('-downloader.exe$', fname):
- tname = re.sub('-downloader.exe$', '.torrent', fname)
- try:
- fdata = open(fname).read()
- tdata = get_torrent_by_signature(fdata)
- f = open(tname, 'wb')
- f.write(tdata)
- f.close()
- print "Extracted torrent from '%s' to '%s'" % (fname, tname)
- except Exception, e:
- print "Could not extract torrent from '%s': %s" % (fname, e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement