summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/MegaCoNz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/MegaCoNz.py')
-rw-r--r--module/plugins/hoster/MegaCoNz.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py
index fbd34c563..5280b42ec 100644
--- a/module/plugins/hoster/MegaCoNz.py
+++ b/module/plugins/hoster/MegaCoNz.py
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
+import array
import os
+# import pycurl
import random
import re
-from array import array
from base64 import standard_b64decode
from Crypto.Cipher import AES
from Crypto.Util import Counter
-# from pycurl import SSL_CIPHER_LIST
from module.common.json_layer import json_loads, json_dumps
from module.plugins.Hoster import Hoster
@@ -48,9 +48,9 @@ from module.utils import decode, fs_decode, fs_encode
class MegaCoNz(Hoster):
__name__ = "MegaCoNz"
__type__ = "hoster"
- __version__ = "0.26"
+ __version__ = "0.29"
- __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)'
+ __pattern__ = r'(?:https?://(?:www\.)?mega(?:\.co)?\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,-]+)'
__description__ = """Mega.co.nz hoster plugin"""
__license__ = "GPLv3"
@@ -69,10 +69,10 @@ class MegaCoNz(Hoster):
def getCipherKey(self, key):
""" Construct the cipher key from the given data """
- a = array("I", self.b64_decode(key))
+ a = array.array("I", self.b64_decode(key))
- 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))
+ k = array.array("I", (a[0] ^ a[4], a[1] ^ a[5], a[2] ^ a[6], a[3] ^ a[7]))
+ iv = a[4:6] + array.array("I", (0, 0))
meta_mac = a[6:8]
return k, iv, meta_mac
@@ -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
@@ -145,7 +145,7 @@ class MegaCoNz(Hoster):
# block = chunk[i:i+16]
# if len(block) % 16:
# block += '=' * (16 - (len(block) % 16))
- # block = array("I", block)
+ # block = array.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)
@@ -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)
@@ -207,7 +207,7 @@ class MegaCoNz(Hoster):
pyfile.name = attr['n'] + self.FILE_SUFFIX
pyfile.size = mega['s']
- # self.req.http.c.setopt(SSL_CIPHER_LIST, "RC4-MD5:DEFAULT")
+ # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT")
self.download(mega['g'])