summaryrefslogtreecommitdiffstats
path: root/module/plugins/container
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/container')
-rw-r--r--module/plugins/container/CCF.py19
-rw-r--r--module/plugins/container/DLC.py40
-rw-r--r--module/plugins/container/LinkList.py28
-rw-r--r--module/plugins/container/RSDF.py36
4 files changed, 66 insertions, 57 deletions
diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py
index c6e642cca..e7ad8f761 100644
--- a/module/plugins/container/CCF.py
+++ b/module/plugins/container/CCF.py
@@ -11,12 +11,13 @@ from urllib2 import build_opener
from MultipartPostHandler import MultipartPostHandler
from module.plugins.Container import Container
-from module.utils import save_join
+from module.utils import fs_encode, save_join
class CCF(Container):
__name__ = "CCF"
- __version__ = "0.21"
+ __type__ = "container"
+ __version__ = "0.22"
__pattern__ = r'.+\.ccf$'
@@ -26,17 +27,17 @@ class CCF(Container):
def decrypt(self, pyfile):
- infile = pyfile.url.replace("\n", "")
-
+ file = fs_encode(pyfile.url.strip())
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()
+
+ tempdlc_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']
+ tempdlc_name = save_join(download_folder, "tmp_%s.dlc" % pyfile.name)
- tempdlc_name = save_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))
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py
index 53349c5c7..184a7b25a 100644
--- a/module/plugins/container/DLC.py
+++ b/module/plugins/container/DLC.py
@@ -9,13 +9,15 @@ from base64 import standard_b64decode
from Crypto.Cipher import AES
from module.plugins.Container import Container
-from module.utils import decode
+from module.utils import decode, fs_encode
class DLC(Container):
- __name__ = "DLC"
- __version__ = "0.22"
- __pattern__ = r'.+\.dlc$'
+ __name__ = "DLC"
+ __type__ = "container"
+ __version__ = "0.23"
+
+ __pattern__ = r'.+\.dlc$'
__description__ = """DLC container decrypter plugin"""
__license__ = "GPLv3"
@@ -26,31 +28,33 @@ class DLC(Container):
("Walter Purcaro", "vuolter@gmail.com")]
- def setup(self):
- self.key = "cb99b5cbc24db398"
- self.iv = "9bc24cb995cb8db3"
- self.api_url = "http://service.jdownloader.org/dlcrypt/service.php?srcType=dlc&destType=pylo&data="
+ KEY = "cb99b5cbc24db398"
+ IV = "9bc24cb995cb8db3"
+ API_URL = "http://service.jdownloader.org/dlcrypt/service.php?srcType=dlc&destType=pylo&data=%s"
def decrypt(self, pyfile):
- with open(pyfile.url.replace("\n", "")) as dlc:
+ file = fs_encode(pyfile.url.strip())
+ with open(file) as dlc:
data = dlc.read().strip()
data += '=' * (-len(data) % 4)
dlckey = data[-88:]
- dlcdata = data[:-88]
- dlcdata = standard_b64decode(dlcdata)
+ dlcdata = standard_b64decode(data[:-88])
+
+ try:
+ rc = re.search(r'<rc>(.+)</rc>', self.load(self.API_URL % dlckey)).group(1)
+
+ except Exception:
+ self.fail(_("DLC file is corrupted"))
- rc = self.load(self.api_url + dlckey)
- rc = re.search(r'<rc>(.+)</rc>', rc).group(1)
- rc = standard_b64decode(rc)
+ else:
+ rc = 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)
+ dlckey = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc)
- self.data = standard_b64decode(obj.decrypt(dlcdata))
+ self.data = standard_b64decode(AES.new(dlckey, AES.MODE_CBC, dlckey).decrypt(dlcdata))
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()]
diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py
index 9c76c4341..cff1b9915 100644
--- a/module/plugins/container/LinkList.py
+++ b/module/plugins/container/LinkList.py
@@ -8,11 +8,12 @@ from module.utils import fs_encode
class LinkList(Container):
__name__ = "LinkList"
- __version__ = "0.13"
+ __type__ = "container"
+ __version__ = "0.14"
__pattern__ = r'.+\.txt$'
- __config__ = [("clear", "bool", "Clear Linklist after adding", False),
- ("encoding", "string", "File encoding (default utf-8)", "")]
+ __config__ = [("clear" , "bool" , "Clear Linklist after adding" , False),
+ ("encoding", "string", "File encoding (default utf-8)", "" )]
__description__ = """Read link lists in txt format"""
__license__ = "GPLv3"
@@ -22,38 +23,42 @@ class LinkList(Container):
def decrypt(self, pyfile):
try:
- file_enc = codecs.lookup(self.getConfig("encoding")).name
- except Exception:
- file_enc = "utf-8"
+ encoding = codecs.lookup(self.getConfig("encoding")).name
- file_name = fs_encode(pyfile.url)
+ except Exception:
+ encoding = "utf-8"
- txt = codecs.open(file_name, 'r', file_enc)
- links = txt.readlines()
+ file = fs_encode(pyfile.url.strip())
+ txt = codecs.open(file, 'r', encoding)
+ 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():
+ for key, value in packages.iteritems():
if not value:
delete.append(key)
@@ -62,8 +67,9 @@ class LinkList(Container):
if self.getConfig("clear"):
try:
- txt = open(file_name, 'wb')
+ txt = open(file, 'wb')
txt.close()
+
except Exception:
self.logWarning(_("LinkList could not be cleared"))
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py
index 0c36293ec..20a0d34cd 100644
--- a/module/plugins/container/RSDF.py
+++ b/module/plugins/container/RSDF.py
@@ -6,13 +6,16 @@ import base64
import binascii
import re
+from Crypto.Cipher import AES
+
from module.plugins.Container import Container
from module.utils import fs_encode
class RSDF(Container):
__name__ = "RSDF"
- __version__ = "0.25"
+ __type__ = "container"
+ __version__ = "0.26"
__pattern__ = r'.+\.rsdf$'
@@ -22,35 +25,30 @@ class RSDF(Container):
("spoob", "spoob@pyload.org")]
- def decrypt(self, pyfile):
-
- from Crypto.Cipher import AES
+ KEY = "8C35192D964DC3182C6F84F3252239EB4A320D2500000000"
+ IV = "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
- infile = fs_encode(pyfile.url.replace("\n", ""))
- Key = binascii.unhexlify('8C35192D964DC3182C6F84F3252239EB4A320D2500000000')
- IV = binascii.unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')
+ def decrypt(self, pyfile):
+ Key = binascii.unhexlify(self.KEY)
IV_Cipher = AES.new(Key, AES.MODE_ECB)
- IV = IV_Cipher.encrypt(IV)
+ IV = IV_Cipher.encrypt(binascii.unhexlify(self.IV))
obj = AES.new(Key, AES.MODE_CFB, IV)
try:
- with open(infile, 'r') as rsdf:
+ 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) is None:
- data = binascii.unhexlify(''.join(data.split()))
- data = data.splitlines()
+ if re.search(r"<title>404 - Not Found</title>", data):
+ return
- for link in data:
- if not link:
- continue
- link = base64.b64decode(link)
- link = obj.decrypt(link)
+ for link in binascii.unhexlify(''.join(data.split())).splitlines():
+ if not link:
+ link = obj.decrypt(base64.b64decode(link))
decryptedUrl = link.replace('CCF: ', '')
self.urls.append(decryptedUrl)
-
- self.logDebug("Adding package %s with %d links" % (pyfile.package().name, len(self.urls)))