diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-01-22 23:44:42 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-01-22 23:44:42 +0100 |
commit | 0dd0821ed115a0685388ac4477ae1bb5d5263c06 (patch) | |
tree | 496ec960d557ef754f486839dd83a8880158576e /module | |
parent | [SimpleDereferer][SimpleHoster] Fix https://github.com/pyload/pyload/issues/1065 (diff) | |
parent | [DLC] Updated DLC decrypter (diff) | |
download | pyload-0dd0821ed115a0685388ac4477ae1bb5d5263c06.tar.xz |
Merge pull request #1066 from Schnusch/stable
[DLC] Updated DLC decrypter
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/container/DLC.py | 69 | ||||
-rw-r--r-- | module/plugins/container/DLC_25.pyc | bin | 8340 -> 0 bytes | |||
-rw-r--r-- | module/plugins/container/DLC_26.pyc | bin | 8313 -> 0 bytes | |||
-rw-r--r-- | module/plugins/container/DLC_27.pyc | bin | 8237 -> 0 bytes |
4 files changed, 69 insertions, 0 deletions
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py new file mode 100644 index 000000000..5af41ac94 --- /dev/null +++ b/module/plugins/container/DLC.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +import base64 +import re + +from Crypto.Cipher import AES +from xml.dom.minidom import parseString + +from module.plugins.Container import Container + + +class DLC(Container): + __name__ = "DLC" + __pattern__ = r'.*\.dlc$' + __version__ = "0.2" + __description__ = """DLC Container Decode Plugin""" + __author_name__ = ("RaNaN", "spoob", "mkaay", "Schnusch") + __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de", "Schnusch@users.noreply.github.com") + + key = "cb99b5cbc24db398" + iv = "9bc24cb995cb8db3" + dlc_api_url = "http://service.jdownloader.org/dlcrypt/service.php?srcType=dlc&destType=pylo&data=" + + def decrypt(self, pyfile): + infile = pyfile.url.replace("\n", "") + + dlc = open(infile, "r") + data = dlc.read().strip() + dlc.close() + if not data.endswith("=="): + if data.endswith("="): + data += "=" + else: + data += "==" + dlckey = data[-88:] + dlcdata = data[:-88] + dlcdata = base64.standard_b64decode(dlcdata) + rc = self.req.load(self.dlc_api_url + dlckey) + rc = re.search(r'<rc>(.+)</rc>', rc).group(1) + rc = base64.standard_b64decode(rc) + obj = AES.new(self.key, AES.MODE_CBC, self.iv) + dlckey = obj.decrypt(rc) + obj = AES.new(dlckey, AES.MODE_CBC, dlckey) + self.data = base64.standard_b64decode(obj.decrypt(dlcdata)) + for entry in self.getPackages(): + self.packages.append((entry[0] if entry[0] else pyfile.name, entry[1], entry[0] if entry[0] else pyfile.name)) + + def createNewPackage(self): + return True + + def getPackages(self): + xml = parseString(self.data) + root = xml.documentElement + contentNode = root.getElementsByTagName("content")[0] + return self.parsePackages(contentNode) + + def parsePackages(self, startNode): + c = [] + for node in startNode.getElementsByTagName("package"): + c.append((base64.standard_b64decode(node.getAttribute("name")).decode("utf8", "replace"), self.parseLinks(node))) + + return c + + def parseLinks(self, startNode): + c = [] + for node in startNode.getElementsByTagName("file"): + c.append(base64.standard_b64decode(node.getElementsByTagName("url")[0].firstChild.data)) + + return c diff --git a/module/plugins/container/DLC_25.pyc b/module/plugins/container/DLC_25.pyc Binary files differdeleted file mode 100644 index b8fde0051..000000000 --- a/module/plugins/container/DLC_25.pyc +++ /dev/null diff --git a/module/plugins/container/DLC_26.pyc b/module/plugins/container/DLC_26.pyc Binary files differdeleted file mode 100644 index 41a4e0cb8..000000000 --- a/module/plugins/container/DLC_26.pyc +++ /dev/null diff --git a/module/plugins/container/DLC_27.pyc b/module/plugins/container/DLC_27.pyc Binary files differdeleted file mode 100644 index a6bffaf74..000000000 --- a/module/plugins/container/DLC_27.pyc +++ /dev/null |