Beispiel #1
0
 def save_download_pstate(self, dltype, dlhash, pstate):
     basename = binascii.hexlify(dlhash) + '.pickle'
     filename = os.path.join(self.session.get_downloads_pstate_dir(dltype), basename)
     if DEBUG:
         log('LM::save_download_pstate: filename', filename, 'pstate', pstate)
     key = 'Hf9Jfn8*;@sg,9q/'
     data = pickle.dumps(pstate)
     data = m2_AES_encrypt(data, key)
     data = chr(45) + chr(3) + chr(89) + chr(120) + data
     f = open(filename, 'wb')
     f.write(data)
     f.close()
Beispiel #2
0
 def save(self, filename = None):
     if not self.readonly:
         self.finalize()
     if 'initial peers' in self.metainfo:
         del self.metainfo['initial peers']
     bdata = bencode(self.metainfo)
     if self.protected:
         bdata = m2_AES_encrypt(bdata, 'tslive_key')
         bdata = chr(1) + chr(2) + chr(3) + chr(4) + bdata
     if filename is not None:
         f = open(filename, 'wb')
         f.write(bdata)
         f.close()
     return bdata
Beispiel #3
0
    def save(self, filename=None):
        torrent_list = []
        for t in self.torrents:
            torrent_list.append({"name": t["name"], "data": t["tdef"].get_metainfo()})

        bdata = bencode({"qualities": torrent_list})
        if self.protected:
            bdata = m2_AES_encrypt(bdata, "=Atl6GD#Vb+#QwW9zJy34lBOcM-7R7G)")
            bdata = chr(17) + chr(2) + chr(101) + chr(46) + bdata
        if filename is not None:
            f = open(filename, "wb")
            f.write(bdata)
            f.close()
        return bdata
Beispiel #4
0
    def save(self, filename = None):
        torrent_list = []
        for t in self.torrents:
            torrent_list.append({'name': t['name'],
             'data': t['tdef'].get_metainfo()})

        bdata = bencode({'qualities': torrent_list})
        if self.protected:
            bdata = m2_AES_encrypt(bdata, '=Atl6GD#Vb+#QwW9zJy34lBOcM-7R7G)')
            bdata = chr(17) + chr(2) + chr(101) + chr(46) + bdata
        if filename is not None:
            f = open(filename, 'wb')
            f.write(bdata)
            f.close()
        return bdata
Beispiel #5
0
    def save(self, filename=None):
        torrent_list = []
        for t in self.torrents:
            torrent_list.append({
                'name': t['name'],
                'data': t['tdef'].get_metainfo()
            })

        bdata = bencode({'qualities': torrent_list})
        if self.protected:
            bdata = m2_AES_encrypt(bdata, '=Atl6GD#Vb+#QwW9zJy34lBOcM-7R7G)')
            bdata = chr(17) + chr(2) + chr(101) + chr(46) + bdata
        if filename is not None:
            f = open(filename, 'wb')
            f.write(bdata)
            f.close()
        return bdata