v18 Mega.nz addon
i started to write an addon for Mega.nz ,
i almost got it, i was able to get the download link the problem is that the data is encrypted i dont know how to play this, i am adding my code (basicly its not my code i found it on Github and modified it).
how can i send the decryptor to "xbmcplugin.setResolvedUrl"?
 thanks for all your help.

def getfile(file_id, file_key):

    key = base64_to_a32(file_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]

    file = api_req({'a': 'g', 'g': 1, 'p': file_id})
    dl_url = file['g']
    size = file['s']

    attributes = base64urldecode(file['at'])
    attributes = dec_attr(attributes, k)

    logging.warning( "Downloading %s (size: %d), url = %s" % (attributes['n'], size, dl_url))
    infile = urllib.urlopen(dl_url)
    outfile = open(loc, 'wb')

#here is the decryptor !!!

    decryptor = AES.new(a32_to_str(k), AES.MODE_CTR, counter=Counter.new(128, initial_value=((iv[0] << 32) + iv[1]) << 64))
    return dl_url
    file_mac = [0, 0, 0, 0]
    for chunk_start, chunk_size in sorted(get_chunks(file['s']).items()):
        chunk = infile.read(chunk_size)
        chunk = decryptor.decrypt(chunk)
        chunk_mac = [iv[0], iv[1], iv[0], iv[1]]
        for i in xrange(0, len(chunk), 16):
            block = chunk[i:i+16]
            if len(block) % 16:
                block += '\0' * (16 - (len(block) % 16))
            block = str_to_a32(block)
            chunk_mac = [chunk_mac[0] ^ block[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)

    if (file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3]) != meta_mac:
        print "MAC mismatch"
        print "MAC OK"
I'd like someone to help you, a Mega addon would be great
Thread moved to add-on development
|Banned add-ons (wiki) Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

My Blog Posts
How is the development going?
Having a mega nz addon would be beautiful Love
(2019-09-11, 16:51)HatsuneMX Wrote: How is the development going?
Having a mega nz addon would be beautiful Love

since no one can answer it is going nowhere.
Thread Rating:
  • 0 Vote(s) - 0 Average

Logout Mark Read Team Forum Stats Members Help
Mega.nz addon00