summaryrefslogtreecommitdiffstats
path: root/module/plugins/container
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/container')
-rw-r--r--module/plugins/container/CCF.py43
-rw-r--r--module/plugins/container/LinkList.py71
-rw-r--r--module/plugins/container/RSDF.py56
-rw-r--r--module/plugins/container/__init__.py1
4 files changed, 171 insertions, 0 deletions
diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py
new file mode 100644
index 000000000..a27511358
--- /dev/null
+++ b/module/plugins/container/CCF.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import with_statement
+
+import re
+
+from os import makedirs
+from os.path import exists
+from urllib2 import build_opener
+
+from MultipartPostHandler import MultipartPostHandler
+
+from pyload.plugin.Container import Container
+from pyload.utils import safe_join
+
+
+class CCF(Container):
+ __name__ = "CCF"
+ __version__ = "0.20"
+
+ __pattern__ = r'.+\.ccf'
+
+ __description__ = """CCF container decrypter plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("Willnix", "Willnix@pyload.org")]
+
+
+ def decrypt(self, pyfile):
+ infile = pyfile.url.replace("\n", "")
+
+ opener = build_opener(MultipartPostHandler)
+ params = {"src": "ccf",
+ "filename": "test.ccf",
+ "upload": open(infile, "rb")}
+ tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php', params).read()
+
+ download_folder = self.config['general']['download_folder']
+
+ tempdlc_name = safe_join(download_folder, "tmp_%s.dlc" % pyfile.name)
+ with open(tempdlc_name, "w") as tempdlc:
+ tempdlc.write(re.search(r'<dlc>(.*)</dlc>', tempdlc_content, re.S).group(1))
+
+ self.urls = [tempdlc_name]
diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py
new file mode 100644
index 000000000..305da8a38
--- /dev/null
+++ b/module/plugins/container/LinkList.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+
+import codecs
+
+from pyload.plugin.Container import Container
+from pyload.utils import fs_encode
+
+
+class LinkList(Container):
+ __name__ = "LinkList"
+ __version__ = "0.12"
+
+ __pattern__ = r'.+\.txt'
+ __config__ = [("clear", "bool", "Clear Linklist after adding", False),
+ ("encoding", "string", "File encoding (default utf-8)", "")]
+
+ __description__ = """Read link lists in txt format"""
+ __license__ = "GPLv3"
+ __authors__ = [("spoob", "spoob@pyload.org"),
+ ("jeix", "jeix@hasnomail.com")]
+
+
+ def decrypt(self, pyfile):
+ try:
+ file_enc = codecs.lookup(self.getConfig("encoding")).name
+ except Exception:
+ file_enc = "utf-8"
+
+ file_name = fs_encode(pyfile.url)
+
+ txt = codecs.open(file_name, 'r', file_enc)
+ links = txt.readlines()
+ curPack = "Parsed links from %s" % pyfile.name
+
+ packages = {curPack:[],}
+
+ for link in links:
+ 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
+
+ delete = []
+
+ for key,value in packages.iteritems():
+ if not value:
+ delete.append(key)
+
+ for key in delete:
+ del packages[key]
+
+ if self.getConfig("clear"):
+ try:
+ txt = open(file_name, 'wb')
+ txt.close()
+ except Exception:
+ self.logWarning(_("LinkList could not be cleared"))
+
+ for name, links in packages.iteritems():
+ self.packages.append((name, links, name))
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py
new file mode 100644
index 000000000..17f304f50
--- /dev/null
+++ b/module/plugins/container/RSDF.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import with_statement
+
+import base64
+import binascii
+import re
+
+from pyload.plugin.Container import Container
+from pyload.utils import fs_encode
+
+
+class RSDF(Container):
+ __name__ = "RSDF"
+ __version__ = "0.24"
+
+ __pattern__ = r'.+\.rsdf'
+
+ __description__ = """RSDF container decrypter plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("RaNaN", "RaNaN@pyload.org"),
+ ("spoob", "spoob@pyload.org")]
+
+
+ def decrypt(self, pyfile):
+
+ from Crypto.Cipher import AES
+
+ infile = fs_encode(pyfile.url.replace("\n", ""))
+ Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000')
+
+ IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')
+ IV_Cipher = AES.new(Key, AES.MODE_ECB)
+ IV = IV_Cipher.encrypt(IV)
+
+ obj = AES.new(Key, AES.MODE_CFB, IV)
+
+ try:
+ with open(infile, 'r') as rsdf:
+ data = rsdf.read()
+ except IOError, e:
+ self.fail(str(e))
+
+ if re.search(r"<title>404 - Not Found</title>", data) is None:
+ data = binascii.unhexlify(''.join(data.split()))
+ data = data.splitlines()
+
+ for link in data:
+ if not link:
+ continue
+ link = base64.b64decode(link)
+ link = obj.decrypt(link)
+ decryptedUrl = link.replace('CCF: ', '')
+ self.urls.append(decryptedUrl)
+
+ self.logDebug("Adding package %s with %d links" % (pyfile.package().name, len(self.urls)))
diff --git a/module/plugins/container/__init__.py b/module/plugins/container/__init__.py
new file mode 100644
index 000000000..40a96afc6
--- /dev/null
+++ b/module/plugins/container/__init__.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-