diff options
Diffstat (limited to 'pyload/plugin/container')
-rw-r--r-- | pyload/plugin/container/CCF.py | 49 | ||||
-rw-r--r-- | pyload/plugin/container/DLC.py | 72 | ||||
-rw-r--r-- | pyload/plugin/container/RSDF.py | 52 | ||||
-rw-r--r-- | pyload/plugin/container/TXT.py | 69 | ||||
-rw-r--r-- | pyload/plugin/container/__init__.py | 1 |
5 files changed, 243 insertions, 0 deletions
diff --git a/pyload/plugin/container/CCF.py b/pyload/plugin/container/CCF.py new file mode 100644 index 000000000..c2771a57b --- /dev/null +++ b/pyload/plugin/container/CCF.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import re + +from urllib2 import build_opener + +from MultipartPostHandler import MultipartPostHandler + +from pyload.plugin.Container import Container +from pyload.utils import fs_encode, safe_join + + +class CCF(Container): + __name = "CCF" + __type = "container" + __version = "0.23" + + __pattern = r'.+\.ccf$' + + __description = """CCF container decrypter plugin""" + __license = "GPLv3" + __authors = [("Willnix", "Willnix@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + def decrypt(self, pyfile): + file = fs_encode(pyfile.url.strip()) + opener = build_opener(MultipartPostHandler) + + dlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', + {'src' : "ccf", + 'filename': "test.ccf", + 'upload' : open(file, "rb")}).read() + + download_folder = self.config['general']['download_folder'] + dlc_file = safe_join(download_folder, "tmp_%s.dlc" % pyfile.name) + + try: + dlc = re.search(r'<dlc>(.+)</dlc>', dlc_content, re.S).group(1).decode('base64') + + except AttributeError: + self.fail(_("Container is corrupted")) + + with open(dlc_file, "w") as tempdlc: + tempdlc.write(dlc) + + self.urls = [dlc_file] diff --git a/pyload/plugin/container/DLC.py b/pyload/plugin/container/DLC.py new file mode 100644 index 000000000..451bab06f --- /dev/null +++ b/pyload/plugin/container/DLC.py @@ -0,0 +1,72 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import re +import xml.dom.minidom + +from Crypto.Cipher import AES + +from pyload.plugin.Container import Container +from pyload.utils import decode, fs_encode + + +class DLC(Container): + __name = "DLC" + __type = "container" + __version = "0.24" + + __pattern = r'.+\.dlc$' + + __description = """DLC container decrypter plugin""" + __license = "GPLv3" + __authors = [("RaNaN", "RaNaN@pyload.org"), + ("spoob", "spoob@pyload.org"), + ("mkaay", "mkaay@mkaay.de"), + ("Schnusch", "Schnusch@users.noreply.github.com"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + KEY = "cb99b5cbc24db398" + IV = "9bc24cb995cb8db3" + API_URL = "http://service.jdownloader.org/dlcrypt/service.php?srcType=dlc&destType=pylo&data=%s" + + + def decrypt(self, pyfile): + file = fs_encode(pyfile.url.strip()) + with open(file) as dlc: + data = dlc.read().strip() + + data += '=' * (-len(data) % 4) + + dlc_key = data[-88:] + dlc_data = data[:-88].decode('base64') + dlc_content = self.load(self.API_URL % dlc_key) + + try: + rc = re.search(r'<rc>(.+)</rc>', dlc_content, re.S).group(1).decode('base64') + + except AttributeError: + self.fail(_("Container is corrupted")) + + cipher = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc) + + self.data = AES.new(cipher, AES.MODE_CBC, cipher).decrypt(dlc_data).decode('base64') + self.packages = [(entry[0] if entry[0] else pyfile.name, entry[1], entry[0] if entry[0] else pyfile.name) \ + for entry in self.getPackages()] + + + def getPackages(self): + root = xml.dom.minidom.parseString(self.data).documentElement + content = root.getElementsByTagName("content")[0] + return self.parsePackages(content) + + + def parsePackages(self, startNode): + return [(decode(node.getAttribute("name")).decode('base64'), self.parseLinks(node)) \ + for node in startNode.getElementsByTagName("package")] + + + def parseLinks(self, startNode): + return [node.getElementsByTagName("url")[0].firstChild.data.decode('base64') \ + for node in startNode.getElementsByTagName("file")] diff --git a/pyload/plugin/container/RSDF.py b/pyload/plugin/container/RSDF.py new file mode 100644 index 000000000..520ce2e71 --- /dev/null +++ b/pyload/plugin/container/RSDF.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- + +from __future__ import with_statement + +import binascii +import re + +from Crypto.Cipher import AES + +from pyload.plugin.Container import Container +from pyload.utils import fs_encode + + +class RSDF(Container): + __name = "RSDF" + __type = "container" + __version = "0.27" + + __pattern = r'.+\.rsdf$' + + __description = """RSDF container decrypter plugin""" + __license = "GPLv3" + __authors = [("RaNaN", "RaNaN@pyload.org"), + ("spoob", "spoob@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + KEY = "8C35192D964DC3182C6F84F3252239EB4A320D2500000000" + IV = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + + + def decrypt(self, pyfile): + KEY = binascii.unhexlify(self.KEY) + IV = AES.new(Key, AES.MODE_ECB).encrypt(binascii.unhexlify(self.IV)) + + cipher = AES.new(KEY, AES.MODE_CFB, IV) + + try: + file = fs_encode(pyfile.url.strip()) + with open(file, 'r') as rsdf: + data = rsdf.read() + + except IOError, e: + self.fail(e) + + if re.search(r"<title>404 - Not Found</title>", data): + return + + for link in binascii.unhexlify(''.join(data.split())).splitlines(): + if link: + link = cipher.decrypt(link.decode('base64')).replace('CCF: ', '') + self.urls.append(link) diff --git a/pyload/plugin/container/TXT.py b/pyload/plugin/container/TXT.py new file mode 100644 index 000000000..31560f165 --- /dev/null +++ b/pyload/plugin/container/TXT.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import codecs + +from pyload.plugin.Container import Container +from pyload.utils import fs_encode + + +class TXT(Container): + __name = "TXT" + __type = "container" + __version = "0.15" + + __pattern = r'.+\.(txt|text)$' + __config = [("flush" , "bool" , "Flush list after adding", False ), + ("encoding", "string", "File encoding" , "utf-8")] + + __description = """Read link lists in plain text formats""" + __license = "GPLv3" + __authors = [("spoob", "spoob@pyload.org"), + ("jeix", "jeix@hasnomail.com")] + + + def decrypt(self, pyfile): + try: + encoding = codecs.lookup(self.getConfig("encoding")).name + + except Exception: + encoding = "utf-8" + + file = fs_encode(pyfile.url.strip()) + txt = codecs.open(file, 'r', encoding) + curPack = "Parsed links from %s" % pyfile.name + packages = {curPack:[],} + + for link in txt.readlines(): + link = link.strip() + + if not link: + continue + + if link.startswith(";"): + continue + + if link.startswith("[") and link.endswith("]"): + # new package + curPack = link[1:-1] + packages[curPack] = [] + continue + + packages[curPack].append(link) + + txt.close() + + # empty packages fix + for key, value in packages.iteritems(): + if not value: + packages.pop(key, None) + + if self.getConfig("flush"): + try: + txt = open(file, 'wb') + txt.close() + + except IOError: + self.logWarning(_("Failed to flush list")) + + for name, links in packages.iteritems(): + self.packages.append((name, links, name)) diff --git a/pyload/plugin/container/__init__.py b/pyload/plugin/container/__init__.py new file mode 100644 index 000000000..40a96afc6 --- /dev/null +++ b/pyload/plugin/container/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- |