KoD 0.5
-Ridefinito il modo in cui vengono scritti i canali, per assicurare migliore stabilità, debuggabilità e coerenza -Riscritti di conseguenza molti canali, corregendo di fatto moltissimi problemi che avete segnalato -Quando aggiungi in videoteca da fonti in più lingue (ita/sub ita) o più qualità, ti viene chiesto quale tipo di fonte vuoi. -Per gli amanti degli anime, aggiunto VVVVID (senza bisogno di account!) -Aggiunti i server supervideo e hdload, fixato wstream -migliorie varie
This commit is contained in:
+20
-20
@@ -84,17 +84,31 @@ class Client(object):
|
||||
|
||||
def get_files(self):
|
||||
files = []
|
||||
enc_url = None
|
||||
if self.files:
|
||||
for file in self.files:
|
||||
n = file.name.encode("utf8")
|
||||
u = "http://" + self.ip + ":" + str(self.port) + "/" + urllib.quote(n)
|
||||
s = file.size
|
||||
file_id = file.file_id
|
||||
enc_url = file.url
|
||||
files.append({"name":n,"url":u,"size":s, "id": file_id})
|
||||
if len(self.files) == 1:
|
||||
try:
|
||||
code = httptools.downloadpage(enc_url, only_headers=True).code
|
||||
if code > 300:
|
||||
return code
|
||||
else:
|
||||
return files
|
||||
|
||||
except:
|
||||
print(traceback.format_exc())
|
||||
pass
|
||||
|
||||
return files
|
||||
|
||||
def add_url(self, url):
|
||||
url = url.split("/#")[1]
|
||||
url = url.split("#")[1]
|
||||
id_video = None
|
||||
if "|" in url:
|
||||
url, id_video = url.split("|")
|
||||
@@ -135,7 +149,8 @@ class Client(object):
|
||||
def api_req(self, req, get=""):
|
||||
seqno = random.randint(0, 0xFFFFFFFF)
|
||||
url = 'https://g.api.mega.co.nz/cs?id=%d%s' % (seqno, get)
|
||||
return json.loads(self.post(url, json.dumps([req])))[0]
|
||||
page = httptools.downloadpage(url, post=json.dumps([req])).data
|
||||
return json.loads(page)[0]
|
||||
|
||||
def base64urldecode(self,data):
|
||||
data += '=='[(2 - len(data) * 3) % 4:]
|
||||
@@ -165,12 +180,11 @@ class Client(object):
|
||||
|
||||
def aes_cbc_decrypt(self, data, key):
|
||||
try:
|
||||
from Cryptodome.Cipher import AES
|
||||
decryptor = AES.new(key, AES.MODE_CBC, '\0' * 16)
|
||||
except:
|
||||
from Crypto.Cipher import AES
|
||||
decryptor = AES.new(key, AES.MODE_CBC, '\0' * 16)
|
||||
#decryptor = aes.AESModeOfOperationCBC(key, iv='\0' * 16)
|
||||
except:
|
||||
import jscrypto
|
||||
decryptor = jscrypto.new(key, jscrypto.MODE_CBC, '\0' * 16)
|
||||
return decryptor.decrypt(data)
|
||||
|
||||
def aes_cbc_decrypt_a32(self,data, key):
|
||||
@@ -179,20 +193,6 @@ class Client(object):
|
||||
def decrypt_key(self,a, key):
|
||||
return sum((self.aes_cbc_decrypt_a32(a[i:i+4], key) for i in xrange(0, len(a), 4)), ())
|
||||
|
||||
def post(self, url, data):
|
||||
return httptools.downloadpage(url, data).data
|
||||
import ssl
|
||||
from functools import wraps
|
||||
def sslwrap(func):
|
||||
@wraps(func)
|
||||
def bar(*args, **kw):
|
||||
kw['ssl_version'] = ssl.PROTOCOL_TLSv1
|
||||
return func(*args, **kw)
|
||||
return bar
|
||||
|
||||
ssl.wrap_socket = sslwrap(ssl.wrap_socket)
|
||||
return urllib.urlopen(url, data).read()
|
||||
|
||||
def dec_attr(self, attr, key):
|
||||
attr = self.aes_cbc_decrypt(attr, self.a32_to_str(key)).rstrip('\0')
|
||||
if not attr.endswith("}"):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import urllib2
|
||||
import traceback
|
||||
|
||||
class Cursor(object):
|
||||
def __init__(self, file):
|
||||
@@ -21,9 +22,11 @@ class Cursor(object):
|
||||
req.headers['Range'] = 'bytes=%s-' % (offset)
|
||||
try:
|
||||
self.conn = urllib2.urlopen(req)
|
||||
self.prepare_decoder(offset)
|
||||
try:
|
||||
self.prepare_decoder(offset)
|
||||
except:
|
||||
print(traceback.format_exc())
|
||||
except:
|
||||
#La url del archivo expira transcurrido un tiempo, si da error 403, reintenta volviendo a solicitar la url mediante la API
|
||||
self.mega_request(offset, True)
|
||||
|
||||
def read(self,n=None):
|
||||
@@ -35,7 +38,6 @@ class Cursor(object):
|
||||
self.pos+=len(res)
|
||||
return res
|
||||
|
||||
|
||||
def seek(self,n):
|
||||
if n>self._file.size:
|
||||
n=self._file.size
|
||||
@@ -53,20 +55,21 @@ class Cursor(object):
|
||||
def __exit__(self,exc_type, exc_val, exc_tb):
|
||||
self._file.cursors.remove(self)
|
||||
if len(self._file.cursors) == 0: self._file.cursor = False
|
||||
|
||||
|
||||
def decode(self, data):
|
||||
return self.decryptor.decrypt(data)
|
||||
|
||||
def prepare_decoder(self,offset):
|
||||
initial_value = self.initial_value + int(offset/16)
|
||||
try:
|
||||
from Cryptodome.Cipher import AES
|
||||
from Cryptodome.Util import Counter
|
||||
self.decryptor = AES.new(self._file._client.a32_to_str(self.k), AES.MODE_CTR, counter = Counter.new(128, initial_value = initial_value))
|
||||
except:
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Util import Counter
|
||||
self.decryptor = AES.new(self._file._client.a32_to_str(self.k), AES.MODE_CTR, counter = Counter.new(128, initial_value = initial_value))
|
||||
except:
|
||||
from pyaes import aes
|
||||
self.decryptor = aes.AESModeOfOperationCTR(f=self,key=self._client.a32_to_str(self.k),counter=aes.Counter(initial_value=initial_value))
|
||||
|
||||
rest = offset - int(offset/16)*16
|
||||
if rest:
|
||||
self.decode(str(0)*rest)
|
||||
self.decode(str(0)*rest)
|
||||
|
||||
+14
-8
@@ -35,7 +35,7 @@ class UnshortenIt(object):
|
||||
_anonymz_regex = r'anonymz\.com'
|
||||
_shrink_service_regex = r'shrink-service\.it'
|
||||
_rapidcrypt_regex = r'rapidcrypt\.net'
|
||||
_cryptmango_regex = r'cryptmango'
|
||||
_cryptmango_regex = r'cryptmango|xshield\.net'
|
||||
_vcrypt_regex = r'vcrypt\.net'
|
||||
|
||||
_maxretries = 5
|
||||
@@ -467,6 +467,7 @@ class UnshortenIt(object):
|
||||
except Exception as e:
|
||||
return uri, str(e)
|
||||
|
||||
|
||||
def _unshorten_vcrypt(self, uri):
|
||||
try:
|
||||
r = None
|
||||
@@ -492,22 +493,27 @@ class UnshortenIt(object):
|
||||
headers = {
|
||||
"Cookie": hashlib.md5(ip+day).hexdigest() + "=1"
|
||||
}
|
||||
uri = uri.replace('sb/','sb1/')
|
||||
uri = uri.replace('akv/','akv1/')
|
||||
uri = uri.replace('wss/','wss1/')
|
||||
uri = uri.replace('wsd/','wsd1/')
|
||||
uri = uri.replace('sb/', 'sb1/')
|
||||
uri = uri.replace('akv/', 'akv1/')
|
||||
uri = uri.replace('wss/', 'wss1/')
|
||||
uri = uri.replace('wsd/', 'wsd1/')
|
||||
r = httptools.downloadpage(uri, timeout=self._timeout, headers=headers, follow_redirects=False)
|
||||
uri = r.headers['location']
|
||||
if 'Wait 1 hour' in r.data:
|
||||
uri = ''
|
||||
logger.info('IP bannato da vcrypt, aspetta un ora')
|
||||
else:
|
||||
uri = r.headers['location']
|
||||
|
||||
if "4snip" in uri:
|
||||
if 'out_generator' in uri:
|
||||
uri = re.findall('url=(.*)$', uri)[0]
|
||||
else:
|
||||
uri = decrypt(uri)
|
||||
elif '/decode/' in uri:
|
||||
uri = decrypt(uri.split('/')[-1])
|
||||
|
||||
return uri, r.code if r else 200
|
||||
except Exception as e:
|
||||
return uri, str(e)
|
||||
|
||||
|
||||
def unwrap_30x_only(uri, timeout=10):
|
||||
unshortener = UnshortenIt()
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import sys
|
||||
import xbmc
|
||||
|
||||
def dec_ei(h):
|
||||
g = 'MNOPIJKL89+/4567UVWXQRSTEFGHABCDcdefYZabstuvopqr0123wxyzklmnghij'
|
||||
c = list()
|
||||
for e in range(0,len(h)):
|
||||
c.append(g.find(h[e]))
|
||||
for e in range(len(c)*2-1,-1,-1):
|
||||
#print 'e=' + str(e)
|
||||
a = c[e % len(c)] ^ c[(e+1)%len(c)]
|
||||
#print 'a='+str(a)
|
||||
c[e%len(c)] = a
|
||||
#print 'c['+str(e % len(c))+']='+ str(c[e % len(c)])
|
||||
c = f(c)
|
||||
d = ''
|
||||
for e in range(0,len(c)):
|
||||
d += '%'+ (('0'+ (str(format(c[e],'x'))))[-2:])
|
||||
|
||||
# if python 3
|
||||
if sys.version_info[0] > 2:
|
||||
import urllib
|
||||
return urllib.parse.unquote(d)
|
||||
else:
|
||||
import urllib2
|
||||
return urllib2.unquote(d)
|
||||
|
||||
def f(m):
|
||||
l = list()
|
||||
o = 0
|
||||
b = None
|
||||
while not b and o < len(m):
|
||||
n = m[o] <<2
|
||||
o +=1
|
||||
k = -1
|
||||
j = -1
|
||||
if o < len(m):
|
||||
n += m[o] >> 4
|
||||
o += 1
|
||||
if o < len(m):
|
||||
k = (m[o - 1] << 4) & 255
|
||||
k += m[o] >> 2
|
||||
o += 1
|
||||
if o < len(m):
|
||||
j = (m[o - 1] << 6) & 255
|
||||
j += m[o]
|
||||
o += 1
|
||||
else:
|
||||
b = True
|
||||
else:
|
||||
b = True
|
||||
else:
|
||||
b = True
|
||||
|
||||
l.append(n)
|
||||
|
||||
if k != -1:
|
||||
l.append(k)
|
||||
|
||||
if j != -1:
|
||||
l.append(j)
|
||||
|
||||
return l
|
||||
Reference in New Issue
Block a user