| 24 | __authors__ = [("GammaC0de", "nitzo2001[AT]yahoo[DOT]com")] |
| 25 | |
| 26 | def decrypt(self, pyfile): |
| 27 | fs_filename = fs_encode(pyfile.url) |
| 28 | with open(fs_filename, "rb") as f: |
| 29 | torrent_content = f.read() |
| 30 | |
| 31 | time_ref = ("%.2f" % time.time())[-6:].replace(".", "") |
| 32 | |
| 33 | pack_name = "torrent %s" % time_ref |
| 34 | m = re.search(r'name(\d+):', torrent_content) |
| 35 | if m: |
| 36 | m = re.search(r'name%s:(.{%s})' % (m.group(1), m.group(1)), torrent_content) |
| 37 | if m: |
| 38 | pack_name = safename(decode(m.group(1))) |
| 39 | |
| 40 | torrent_filename = fsjoin("tmp", "tmp_%s.torrent" % pack_name) |
| 41 | with open(torrent_filename, "wb") as f: |
| 42 | f.write(torrent_content) |
| 43 | |
| 44 | self.packages.append((pack_name, ["file://%s" % urllib.pathname2url(torrent_filename.encode('utf8'))], pack_name)) |