summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-03 16:09:13 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-02-03 16:09:13 +0100
commit193cb8dbe1b24c24fb919461f16b2215e85da739 (patch)
tree5e3649a750666a8312b9f1de43d5b9e2f98da3b6
parent[ClickAndLoad] Fix https://github.com/pyload/pyload/issues/1135 (diff)
downloadpyload-193cb8dbe1b24c24fb919461f16b2215e85da739.tar.xz
Update container plugins
-rw-r--r--module/plugins/container/CCF.py29
-rw-r--r--module/plugins/container/DLC.py17
-rw-r--r--module/plugins/container/LinkList.py28
-rw-r--r--module/plugins/container/RSDF.py19
4 files changed, 45 insertions, 48 deletions
diff --git a/module/plugins/container/CCF.py b/module/plugins/container/CCF.py
index e7ad8f761..452b9bb65 100644
--- a/module/plugins/container/CCF.py
+++ b/module/plugins/container/CCF.py
@@ -4,8 +4,6 @@ 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
@@ -17,28 +15,35 @@ from module.utils import fs_encode, save_join
class CCF(Container):
__name__ = "CCF"
__type__ = "container"
- __version__ = "0.22"
+ __version__ = "0.23"
__pattern__ = r'.+\.ccf$'
__description__ = """CCF container decrypter plugin"""
__license__ = "GPLv3"
- __authors__ = [("Willnix", "Willnix@pyload.org")]
+ __authors__ = [("Willnix", "Willnix@pyload.org"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
def decrypt(self, pyfile):
file = fs_encode(pyfile.url.strip())
opener = build_opener(MultipartPostHandler)
- tempdlc_content = opener.open('http://service.jdownloader.net/dlcrypt/getDLC.php',
- {'src' : "ccf",
- 'filename': "test.ccf",
- 'upload' : open(file, "rb")}).read()
+ 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']
- tempdlc_name = save_join(download_folder, "tmp_%s.dlc" % pyfile.name)
+ dlc_file = 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))
+ try:
+ dlc = re.search(r'<dlc>(.+)</dlc>', dlc_content, re.S).group(1).decode('base64')
- self.urls = [tempdlc_name]
+ except AttributeError:
+ self.fail(_("Container is corrupted"))
+
+ with open(dlc_file, "w") as tempdlc:
+ tempdlc.write(dlc)
+
+ self.urls = [dlc_file]
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py
index 589beab4e..b01e3098c 100644
--- a/module/plugins/container/DLC.py
+++ b/module/plugins/container/DLC.py
@@ -14,7 +14,7 @@ from module.utils import decode, fs_encode
class DLC(Container):
__name__ = "DLC"
__type__ = "container"
- __version__ = "0.23"
+ __version__ = "0.24"
__pattern__ = r'.+\.dlc$'
@@ -39,18 +39,19 @@ class DLC(Container):
data += '=' * (-len(data) % 4)
- dlckey = data[-88:]
- dlcdata = data[:-88].decode('base64')
+ 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>', self.load(self.API_URL % dlckey)).group(1).decode('base64')
+ rc = re.search(r'<rc>(.+)</rc>', dlc_content, re.S).group(1).decode('base64')
- except Exception:
- self.fail(_("DLC file is corrupted"))
+ except AttributeError:
+ self.fail(_("Container is corrupted"))
- dlckey = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc)
+ cipher = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc)
- self.data = AES.new(dlckey, AES.MODE_CBC, dlckey).decrypt(dlcdata).decode('base64')
+ 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()]
diff --git a/module/plugins/container/LinkList.py b/module/plugins/container/LinkList.py
index 86c5f88e7..ccb9b2fa3 100644
--- a/module/plugins/container/LinkList.py
+++ b/module/plugins/container/LinkList.py
@@ -12,8 +12,8 @@ class LinkList(Container):
__version__ = "0.14"
__pattern__ = r'.+\.txt$'
- __config__ = [("clear" , "bool" , "Clear Linklist after adding" , False),
- ("encoding", "string", "File encoding (default utf-8)", "" )]
+ __config__ = [("flush" , "bool" , "Flush list after adding", False ),
+ ("encoding", "string", "File encoding" , "utf-8")]
__description__ = """Read link lists in txt format"""
__license__ = "GPLv3"
@@ -28,14 +28,12 @@ class LinkList(Container):
except Exception:
encoding = "utf-8"
- file = fs_encode(pyfile.url.strip())
- txt = codecs.open(file, 'r', encoding)
- links = txt.readlines()
- curPack = "Parsed links from %s" % pyfile.name
-
+ file = fs_encode(pyfile.url.strip())
+ txt = codecs.open(file, 'r', encoding)
+ curPack = "Parsed links from %s" % pyfile.name
packages = {curPack:[],}
- for link in links:
+ for link in txt.readlines():
link = link.strip()
if not link:
@@ -55,23 +53,17 @@ class LinkList(Container):
txt.close()
# empty packages fix
-
- delete = []
-
for key, value in packages.iteritems():
if not value:
- delete.append(key)
-
- for key in delete:
- packages.pop(key, None)
+ packages.pop(key, None)
- if self.getConfig("clear"):
+ if self.getConfig("flush"):
try:
txt = open(file, 'wb')
txt.close()
- except Exception:
- self.logWarning(_("LinkList could not be cleared"))
+ except IOError:
+ self.logWarning(_("Failed to flush list"))
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
index 06b3c3b2b..8f9bfc0d5 100644
--- a/module/plugins/container/RSDF.py
+++ b/module/plugins/container/RSDF.py
@@ -14,14 +14,15 @@ from module.utils import fs_encode
class RSDF(Container):
__name__ = "RSDF"
__type__ = "container"
- __version__ = "0.26"
+ __version__ = "0.27"
__pattern__ = r'.+\.rsdf$'
__description__ = """RSDF container decrypter plugin"""
__license__ = "GPLv3"
__authors__ = [("RaNaN", "RaNaN@pyload.org"),
- ("spoob", "spoob@pyload.org")]
+ ("spoob", "spoob@pyload.org"),
+ ("Walter Purcaro", "vuolter@gmail.com")]
KEY = "8C35192D964DC3182C6F84F3252239EB4A320D2500000000"
@@ -29,11 +30,10 @@ class RSDF(Container):
def decrypt(self, pyfile):
- Key = binascii.unhexlify(self.KEY)
- IV_Cipher = AES.new(Key, AES.MODE_ECB)
- IV = IV_Cipher.encrypt(binascii.unhexlify(self.IV))
+ KEY = binascii.unhexlify(self.KEY)
+ IV = AES.new(Key, AES.MODE_ECB).encrypt(binascii.unhexlify(self.IV))
- obj = AES.new(Key, AES.MODE_CFB, IV)
+ cipher = AES.new(KEY, AES.MODE_CFB, IV)
try:
file = fs_encode(pyfile.url.strip())
@@ -47,7 +47,6 @@ class RSDF(Container):
return
for link in binascii.unhexlify(''.join(data.split())).splitlines():
- if not link:
- link = obj.decrypt(link.decode('base64'))
- decryptedUrl = link.replace('CCF: ', '')
- self.urls.append(decryptedUrl)
+ if link:
+ link = cipher.decrypt(link.decode('base64')).replace('CCF: ', '')
+ self.urls.append(link)