Beispiel #1
0
    def parse(filename: Union[str, Path]) -> 'Torrent':
        torrent_file = Path(filename).expanduser().resolve()
        decoder = Decoder(torrent_file.read_bytes())
        metainfo = decoder.decode()

        return Torrent(metainfo["announce"], metainfo["info"],
                       metainfo["info"]["name"], metainfo.get("announce-list"),
                       metainfo.get("creation date"),
                       metainfo.get("created by"), metainfo.get("encoding"),
                       metainfo.get("publisher"),
                       metainfo.get("publisher-url"), metainfo.get("comment"))
Beispiel #2
0
    def __init__(self, filename):
        self.filename = filename
        self.file = []

        with open(self.filename, 'rb') as f:
            meta_info = f.read()
            self.meta_info = Decoder(meta_info).decode()
            info = Encoder(self.meta_info[b'info']).encode()
            self.info_hash = sha1(info).digest()
            self._check_files()
def test_decode_none() -> None:
    assert Decoder(b"fghfgh").decode() is None
def test_decode_dict() -> None:
    decode_bytes = b"d3:str3:stei1ei1ei2el3:one3:twoee"
    assert Decoder(decode_bytes).decode() == {"str": "ste", 1: 1, 2: ["one", "two"]}
def test_decode_list() -> None:
    decode_bytes = b"li1ei2e3:stee"
    assert Decoder(decode_bytes).decode() == [1, 2, "ste"]
def test_decode_str() -> None:
    decode_bytes = b"5:qwert"
    assert Decoder(decode_bytes).decode() == "qwert"
def test_decode_int() -> None:
    assert Decoder(b"i123e").decode() == 123
Beispiel #8
0
 def test_decode(self):
     decoder = Decoder(b'i3e')
     self.assertEqual(3, decoder.decode())
Beispiel #9
0
from bencoding import bencode
from bencoding import Decoder
from bencoding import *
import re
with open('Tree - Introduction.pptx.torrent', 'rb') as f:
    meta_info = f.read()
    torrent = Decoder(meta_info).decode()
    # print(torrent)

with open("../trackers.txt") as file:
    data = file.read()
    https = re.findall('https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', data)
    # print(https)
    udp = re.findall('udp?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+', data)
    # print(udp)
    all_urls = https + udp
    print(all_urls)

vscode://vscode.github-authentication/did-authenticate?windowid=1&code=e264996e77aac8544108&state=3b2dbbf8-6f1b-4dbd-a25e-9627c3c03281