From 6325eda4e8c142edd11c747f7a9d4a3fa975c494 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 20 Dec 2014 14:24:13 +0100 Subject: Fix password retrieving in some plugins --- module/plugins/hoster/MegaCoNz.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 385295d42..fc6724dc7 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -46,9 +46,9 @@ from module.plugins.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" - __pattern__ = r'https?://(\w+\.)?mega\.co\.nz/#!([\w!-]+)' + __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#!(?P[\w!-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" @@ -133,11 +133,11 @@ class MegaCoNz(Hoster): key = None # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group(2) + node = re.match(self.__pattern__, pyfile.url).group('ID') if "!" in node: - node, key = node.split("!") + node, key = node.split("!", 1) - self.logDebug("File id: %s | Key: %s" % (node, key)) + self.logDebug("ID: %s | Key: %s" % (node, key)) if not key: self.fail(_("No file key provided in the URL")) -- cgit v1.2.3 From 4ef28917ae8be8a0c6f5374bac6116fd1c469bd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 28 Dec 2014 11:52:57 +0100 Subject: [MegaCoNz] Private file support --- module/plugins/hoster/MegaCoNz.py | 93 ++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 36 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index fc6724dc7..db3f8d571 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -9,11 +9,12 @@ from os import remove from Crypto.Cipher import AES from Crypto.Util import Counter -from pycurl import SSL_CIPHER_LIST +# from pycurl import SSL_CIPHER_LIST from module.common.json_layer import json_loads, json_dumps from module.plugins.Hoster import Hoster + ############################ General errors ################################### # EINTERNAL (-1): An internal error has occurred. Please submit a bug report, detailing the exact circumstances in which this error occurred # EARGS (-2): You have passed invalid arguments to this command @@ -46,15 +47,17 @@ from module.plugins.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.20" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#!(?P[\w!-]+)' + __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" - __authors__ = [("RaNaN", "ranan@pyload.org")] + __authors__ = [("RaNaN", "ranan@pyload.org"), + ("Walter Purcaro", "vuolter@gmail.com")] + - API_URL = "https://g.api.mega.co.nz/cs" + API_URL = "https://eu.api.mega.co.nz/cs" FILE_SUFFIX = ".crypted" @@ -66,12 +69,17 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ a = array("I", key) - key_array = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) - return key_array + k = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) + iv = a[4:6] + (0, 0) + meta_mac = a[6:8] + + return k, iv, meta_mac - def callApi(self, **kwargs): + + def api_response(self, **kwargs): """ Dispatch a call to the api, see https://mega.co.nz/#developers """ + # generate a session id, no idea where to obtain elsewhere uid = random.randint(10 << 9, 10 ** 10) @@ -81,8 +89,10 @@ class MegaCoNz(Hoster): def decryptAttr(self, data, key): - cbc = AES.new(self.getCipherKey(key), AES.MODE_CBC, "\0" * 16) - attr = cbc.decrypt(self.b64_decode(data)) + k, iv, meta_mac = getCipherKey(key) + cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) + attr = cbc.decrypt(self.b64_decode(data)) + self.logDebug("Decrypted Attr: " + attr) if not attr.startswith("MEGA"): self.fail(_("Decryption failed")) @@ -98,34 +108,37 @@ class MegaCoNz(Hoster): n = key[16:24] # convert counter to long and shift bytes - ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) - cipher = AES.new(self.getCipherKey(key), AES.MODE_CTR, counter=ctr) + k, iv, meta_mac = getCipherKey(key) + ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) + cipher = AES.new(k, AES.MODE_CTR, counter=ctr) self.pyfile.setStatus("decrypting") - file_crypted = self.lastDownload + file_crypted = self.lastDownload file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] try: - f = open(file_crypted, "rb") + f = open(file_crypted, "rb") df = open(file_decrypted, "wb") + except IOError, e: self.fail(str(e)) - # TODO: calculate CBC-MAC for checksum + chunk_size = 2 ** 15 # buffer size, 32k + # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum - size = 2 ** 15 # buffer size, 32k while True: - buf = f.read(size) + buf = f.read(chunk_size) if not buf: break - df.write(cipher.decrypt(buf)) + chunk = cipher.decrypt(buf) + df.write(chunk) f.close() df.close() - remove(file_crypted) + remove(file_crypted) self.lastDownload = file_decrypted @@ -133,38 +146,46 @@ class MegaCoNz(Hoster): key = None # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group('ID') - if "!" in node: - node, key = node.split("!", 1) + pattern = re.match(self.__pattern__, pyfile.url).groupdict() + node = pattern['ID'] + key = pattern['KEY'] + public = pattern['TYPE'] != 'N' - self.logDebug("ID: %s | Key: %s" % (node, key)) + self.logDebug("ID: %s" % node, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) - if not key: - self.fail(_("No file key provided in the URL")) + key = self.b64_decode(key) # g is for requesting a download url # this is similar to the calls in the mega js app, documentation is very bad - dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] + if public: + dl = self.api_response(a="g", g=1, p=node, ssl=1)[0] + else: + dl = self.api_response(a="g", g=1, n=node, ssl=1)[0] if "e" in dl: - e = dl['e'] - # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later - if e == -18: - self.retry() - else: - self.fail(_("Error code:") + e) + ecode = -dl['e'] - # TODO: map other error codes, e.g - # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) + if ecode in (9, 16, 21): + self.offline() + + elif ecode in (3, 13, 17, 18, 19): + self.tempOffline() + + elif ecode in (1, 4, 6, 10, 15, 21): + self.retry(5, 30, _("Error code: [%s]") % -ecode) + + else: + self.fail(_("Error code: [%s]") % -ecode) - key = self.b64_decode(key) attr = self.decryptAttr(dl['at'], key) pyfile.name = attr['n'] + self.FILE_SUFFIX + pyfile.size = dl['s'] - self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") + # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") self.download(dl['g']) + self.decryptFile(key) # Everything is finished and final name can be set -- cgit v1.2.3 From 85febdf6ce5666d5e29052eca93361656eb65ac8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 30 Dec 2014 00:22:47 +0100 Subject: [MegaCoNz] Fixup --- module/plugins/hoster/MegaCoNz.py | 71 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 36 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index db3f8d571..39eba4a40 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -47,9 +47,9 @@ from module.plugins.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' + __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN)?!(?P[\w^_]+)!(?P[\w,\\-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" @@ -68,11 +68,9 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ - a = array("I", key) - - k = array("I", [a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]]) - iv = a[4:6] + (0, 0) - meta_mac = a[6:8] + k = key[0] ^ key[4], key[1] ^ key[5], key[2] ^ key[6], key[3] ^ key[7] + iv = key[4:6] + (0, 0) + meta_mac = key[6:8] return k, iv, meta_mac @@ -89,7 +87,7 @@ class MegaCoNz(Hoster): def decryptAttr(self, data, key): - k, iv, meta_mac = getCipherKey(key) + k, iv, meta_mac = self.getCipherKey(self.b64_decode(key)) cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) attr = cbc.decrypt(self.b64_decode(data)) @@ -104,11 +102,13 @@ class MegaCoNz(Hoster): def decryptFile(self, key): """ Decrypts the file at lastDownload` """ + key = self.b64_decode(key) + # upper 64 bit of counter start n = key[16:24] # convert counter to long and shift bytes - k, iv, meta_mac = getCipherKey(key) + k, iv, meta_mac = self.getCipherKey(key) ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64) cipher = AES.new(k, AES.MODE_CTR, counter=ctr) @@ -142,49 +142,48 @@ class MegaCoNz(Hoster): self.lastDownload = file_decrypted - def process(self, pyfile): - key = None + def checkError(self, code): + ecode = abs(code) - # match is guaranteed because plugin was chosen to handle url - pattern = re.match(self.__pattern__, pyfile.url).groupdict() - node = pattern['ID'] - key = pattern['KEY'] - public = pattern['TYPE'] != 'N' + if ecode in (9, 16, 21): + self.offline() - self.logDebug("ID: %s" % node, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) + elif ecode in (3, 13, 17, 18, 19): + self.tempOffline() - key = self.b64_decode(key) + elif ecode in (1, 4, 6, 10, 15, 21): + self.retry(5, 30, _("Error code: [%s]") % -ecode) - # g is for requesting a download url - # this is similar to the calls in the mega js app, documentation is very bad - if public: - dl = self.api_response(a="g", g=1, p=node, ssl=1)[0] else: - dl = self.api_response(a="g", g=1, n=node, ssl=1)[0] + self.fail(_("Error code: [%s]") % -ecode) - if "e" in dl: - ecode = -dl['e'] - if ecode in (9, 16, 21): - self.offline() + def process(self, pyfile): + pattern = re.match(self.__pattern__, pyfile.url).groupdict() + id = pattern['ID'] + key = pattern['KEY'] + public = 'TYPE' not in pattern - elif ecode in (3, 13, 17, 18, 19): - self.tempOffline() + self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) - elif ecode in (1, 4, 6, 10, 15, 21): - self.retry(5, 30, _("Error code: [%s]") % -ecode) + # g is for requesting a download url + # this is similar to the calls in the mega js app, documentation is very bad + if public: + mega = self.api_response(a="g", g=1, p=id, ssl=1)[0] + else: + mega = self.api_response(a="g", g=1, n=id, ssl=1)[0] - else: - self.fail(_("Error code: [%s]") % -ecode) + if "e" in mega: + self.checkError(mega['e']) - attr = self.decryptAttr(dl['at'], key) + attr = self.decryptAttr(mega['at'], key) pyfile.name = attr['n'] + self.FILE_SUFFIX - pyfile.size = dl['s'] + pyfile.size = mega['s'] # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT") - self.download(dl['g']) + self.download(mega['g']) self.decryptFile(key) -- cgit v1.2.3 From fb7c5cf5845c22bb751c824679c856b45a1bb970 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 30 Dec 2014 00:32:18 +0100 Subject: [MegaCoNz] Fixup (2) --- module/plugins/hoster/MegaCoNz.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 39eba4a40..00f38ff06 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -68,6 +68,8 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ + key = self.b64_decode(key) + k = key[0] ^ key[4], key[1] ^ key[5], key[2] ^ key[6], key[3] ^ key[7] iv = key[4:6] + (0, 0) meta_mac = key[6:8] @@ -87,7 +89,7 @@ class MegaCoNz(Hoster): def decryptAttr(self, data, key): - k, iv, meta_mac = self.getCipherKey(self.b64_decode(key)) + k, iv, meta_mac = self.getCipherKey(key) cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) attr = cbc.decrypt(self.b64_decode(data)) @@ -102,10 +104,8 @@ class MegaCoNz(Hoster): def decryptFile(self, key): """ Decrypts the file at lastDownload` """ - key = self.b64_decode(key) - # upper 64 bit of counter start - n = key[16:24] + n = self.b64_decode(key)[16:24] # convert counter to long and shift bytes k, iv, meta_mac = self.getCipherKey(key) -- cgit v1.2.3 From 5224873c278ccfc6f1b4d4289b34217cb1560053 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 31 Dec 2014 01:12:36 +0100 Subject: [MegaCoNz] Fix https://github.com/pyload/pyload/issues/989 --- module/plugins/hoster/MegaCoNz.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 00f38ff06..e404c38a1 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -47,9 +47,9 @@ from module.plugins.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN)?!(?P[\w^_]+)!(?P[\w,\\-]+)' + __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" @@ -68,11 +68,11 @@ class MegaCoNz(Hoster): def getCipherKey(self, key): """ Construct the cipher key from the given data """ - key = self.b64_decode(key) + a = array("I", self.b64_decode(key)) - k = key[0] ^ key[4], key[1] ^ key[5], key[2] ^ key[6], key[3] ^ key[7] - iv = key[4:6] + (0, 0) - meta_mac = key[6:8] + k = array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7])) + iv = a[4:6] + array("I", (0, 0)) + meta_mac = a[6:8] return k, iv, meta_mac @@ -162,7 +162,7 @@ class MegaCoNz(Hoster): pattern = re.match(self.__pattern__, pyfile.url).groupdict() id = pattern['ID'] key = pattern['KEY'] - public = 'TYPE' not in pattern + public = pattern['TYPE'] == '' self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) @@ -173,7 +173,9 @@ class MegaCoNz(Hoster): else: mega = self.api_response(a="g", g=1, n=id, ssl=1)[0] - if "e" in mega: + if isinstance(mega, int): + self.checkError(mega) + elif "e" in mega: self.checkError(mega['e']) attr = self.decryptAttr(mega['at'], key) -- cgit v1.2.3 From d614989f0f881205bf5cee8b16ec2e5ff2527060 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 31 Dec 2014 17:04:08 +0100 Subject: [MegaCoNz] Fix https://github.com/pyload/pyload/issues/367 --- module/plugins/hoster/MegaCoNz.py | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index e404c38a1..55a2c5abf 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- +import math +import os import random import re from array import array from base64 import standard_b64decode -from os import remove from Crypto.Cipher import AES from Crypto.Util import Counter @@ -13,6 +14,7 @@ from Crypto.Util import Counter from module.common.json_layer import json_loads, json_dumps from module.plugins.Hoster import Hoster +from module.utils import decode ############################ General errors ################################### @@ -47,7 +49,7 @@ from module.plugins.Hoster import Hoster class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' @@ -91,9 +93,9 @@ class MegaCoNz(Hoster): def decryptAttr(self, data, key): k, iv, meta_mac = self.getCipherKey(key) cbc = AES.new(k, AES.MODE_CBC, "\0" * 16) - attr = cbc.decrypt(self.b64_decode(data)) + attr = decode(cbc.decrypt(self.b64_decode(data))) - self.logDebug("Decrypted Attr: " + attr) + self.logDebug("Decrypted Attr: %s" % attr) if not attr.startswith("MEGA"): self.fail(_("Decryption failed")) @@ -113,6 +115,7 @@ class MegaCoNz(Hoster): cipher = AES.new(k, AES.MODE_CTR, counter=ctr) self.pyfile.setStatus("decrypting") + self.pyfile.setProgress(0) file_crypted = self.lastDownload file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] @@ -127,7 +130,8 @@ class MegaCoNz(Hoster): chunk_size = 2 ** 15 # buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum - while True: + chunks = int(math.ceil(os.path.getsize(file_crypted) / chunk_size)) + for i in xrange(chunks): buf = f.read(chunk_size) if not buf: break @@ -135,10 +139,31 @@ class MegaCoNz(Hoster): chunk = cipher.decrypt(buf) df.write(chunk) + self.pyfile.setProgress(int((100.0 / chunks) * i)) + + # chunk_mac = [iv[0], iv[1], iv[0], iv[1]] + # for i in xrange(0, chunk_size, 16): + # block = chunk[i:i+16] + # if len(block) % 16: + # block += '=' * (16 - (len(block) % 16)) + # block = array("I", block) + + # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]] + # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k) + + # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]] + # file_mac = aes_cbc_encrypt_a32(file_mac, k) + + self.pyfile.setProgress(100) + f.close() df.close() - remove(file_crypted) + # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: + # os.remove(file_decrypted) + # self.fail("Checksum mismatch") + + os.remove(file_crypted) self.lastDownload = file_decrypted -- cgit v1.2.3 From 90985bb401a647e476ac760d0d73bcb0f7651e7a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 3 Jan 2015 01:01:15 +0100 Subject: [MegaCoNz] Fix https://github.com/pyload/pyload/issues/367 --- module/plugins/hoster/MegaCoNz.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 55a2c5abf..ed334601a 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -14,7 +14,7 @@ from Crypto.Util import Counter from module.common.json_layer import json_loads, json_dumps from module.plugins.Hoster import Hoster -from module.utils import decode +from module.utils import decode, fs_decode, fs_encode ############################ General errors ################################### @@ -49,7 +49,7 @@ from module.utils import decode class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.23" + __version__ = "0.24" __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' @@ -117,7 +117,7 @@ class MegaCoNz(Hoster): self.pyfile.setStatus("decrypting") self.pyfile.setProgress(0) - file_crypted = self.lastDownload + file_crypted = fs_encode(self.lastDownload) file_decrypted = file_crypted.rsplit(self.FILE_SUFFIX)[0] try: @@ -164,7 +164,7 @@ class MegaCoNz(Hoster): # self.fail("Checksum mismatch") os.remove(file_crypted) - self.lastDownload = file_decrypted + self.lastDownload = fs_decode(file_decrypted) def checkError(self, code): -- cgit v1.2.3 From 9f427186b8e1c1d5b7cc2e16a7087271568e4390 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 00:13:01 +0100 Subject: [MegaCoNz][MegaCoNzFolder] Improve __pattern__ --- module/plugins/hoster/MegaCoNz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index ed334601a..9e23e0361 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -49,9 +49,9 @@ from module.utils import decode, fs_decode, fs_encode class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' + __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From c0eb46f72c1cc82a6e0e386d44c43151c01fa183 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 10 Jan 2015 15:44:33 +0100 Subject: [MegaCoNz] Fix https://github.com/pyload/pyload/issues/1017 (thx valadrem) --- module/plugins/hoster/MegaCoNz.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 9e23e0361..fbd34c563 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import math import os import random import re @@ -49,7 +48,7 @@ from module.utils import decode, fs_decode, fs_encode class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?PN|)!(?P[\w^_]+)!(?P[\w,\\-]+)' @@ -130,7 +129,7 @@ class MegaCoNz(Hoster): chunk_size = 2 ** 15 # buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum - chunks = int(math.ceil(os.path.getsize(file_crypted) / chunk_size)) + chunks = os.path.getsize(file_crypted) / chunk_size + 1 for i in xrange(chunks): buf = f.read(chunk_size) if not buf: -- cgit v1.2.3 From cf4ded052964047de88d676045329b8fa4fca2dc Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 22 Jan 2015 21:31:19 +0100 Subject: Update plugins after CaptchaService changes --- module/plugins/hoster/MegaCoNz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hoster/MegaCoNz.py') diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index fbd34c563..4ad20b265 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -124,7 +124,7 @@ class MegaCoNz(Hoster): df = open(file_decrypted, "wb") except IOError, e: - self.fail(str(e)) + self.fail(e) chunk_size = 2 ** 15 # buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum @@ -160,7 +160,7 @@ class MegaCoNz(Hoster): # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac: # os.remove(file_decrypted) - # self.fail("Checksum mismatch") + # self.fail(_("Checksum mismatch")) os.remove(file_crypted) self.lastDownload = fs_decode(file_decrypted) -- cgit v1.2.3