diff options
author | GammaC0de <nitzo2001@yahoo.com> | 2016-04-26 23:52:39 +0200 |
---|---|---|
committer | GammaC0de <nitzo2001@yahoo.com> | 2016-04-26 23:52:39 +0200 |
commit | 8b3e5877486ea191df284eabeb308244f929d5fc (patch) | |
tree | e39718f910dc2e016e99d226c94c749d059bbbcc /module | |
parent | [MegaCoNz] Add checksum and folder support (fix #481) (diff) | |
download | pyload-8b3e5877486ea191df284eabeb308244f929d5fc.tar.xz |
[MegaCoNz] Code cosmetics
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/crypter/MegaCoNzFolder.py | 7 | ||||
-rw-r--r-- | module/plugins/hoster/MegaCoNz.py | 12 |
2 files changed, 10 insertions, 9 deletions
diff --git a/module/plugins/crypter/MegaCoNzFolder.py b/module/plugins/crypter/MegaCoNzFolder.py index 686f67594..2d1f31129 100644 --- a/module/plugins/crypter/MegaCoNzFolder.py +++ b/module/plugins/crypter/MegaCoNzFolder.py @@ -43,7 +43,7 @@ from module.plugins.internal.misc import decode, json class MegaCoNzFolder(Crypter): __name__ = "MegaCoNzFolder" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\-=]+)' @@ -65,7 +65,7 @@ class MegaCoNzFolder(Crypter): return base64.b64decode(str(data), "-_") - def base64_b64encode(self, data): + def base64_encode(self, data): return base64.b64encode(data, "-_") @@ -137,6 +137,7 @@ class MegaCoNzFolder(Crypter): master_key = self.base64_to_a32(master_key) + #: F is for requesting folder listing (kind like a `ls` command) mega = self.api_response(a="f", c=1, r=1, ca=1, ssl=1)[0] if isinstance(mega, int): @@ -145,7 +146,7 @@ class MegaCoNzFolder(Crypter): self.check_error(mega['e']) - get_node_key = lambda k: self.base64_b64encode(self.a32_to_str(self.decrypt_key(k, master_key))) + get_node_key = lambda k: self.base64_encode(self.a32_to_str(self.decrypt_key(k, master_key))) self.links = [_("https://mega.co.nz/#N!%s!%s=###n=%s") % (_f['h'], diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 3f0d6889a..057ddd438 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -46,11 +46,11 @@ from module.plugins.internal.misc import decode, encode, json class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __status__ = "testing" __pattern__ = r'(https?://(?:www\.)?mega(\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w\-,=]+)(?:###n=(?P<OWNER>[\w^_]+))?' - __config__ = [("activated", "bool", "Activated", True)] + __config__ = [("activated", "bool", "Activated", True)] __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" @@ -68,7 +68,7 @@ class MegaCoNz(Hoster): return base64.b64decode(str(data), "-_") - def base64_b64encode(self, data): + def base64_encode(self, data): return base64.b64encode(data, "-_") @@ -89,8 +89,8 @@ class MegaCoNz(Hoster): """ Construct the cipher key from the given data """ - k = (key[0] ^ key[4], key[1] ^ key[5], key[2] ^ key[6], key[3] ^ key[7]) - iv = key[4:6] + (0, 0) + 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 @@ -207,8 +207,8 @@ class MegaCoNz(Hoster): self.log_info(_("File decrypted")) self.remove(file_crypted, trash=False) - file_mac = (file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3]) if checksum_activated and check_checksum: + file_mac = (file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3]) if file_mac == meta_mac: self.log_info(_('File integrity of "%s" verified by CBC-MAC checksum (%s)') % (file_decrypted, meta_mac)) |