X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/26a1c69f126a59ec9aeda715ef6d516d42fd10c4..ceaa1fb4f062d800be6ae5baffe261d9f4b39517:/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py index 87f0a4d6..178efadc 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py @@ -9,9 +9,10 @@ from Components.Ipkg import IpkgComponent from Components.Network import iNetwork from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR from Tools.HardwareInfo import HardwareInfo -import sha - +import hashlib from time import time +from os import urandom + rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?'] def bin2long(s): @@ -30,7 +31,7 @@ def decrypt_block(src, mod): if len(src) != 128 and len(src) != 202: return None dest = rsa_pub1024(src[:128], mod) - hash = sha.new(dest[1:107]) + hash = hashlib.sha1(dest[1:107]) if len(src) == 202: hash.update(src[131:192]) result = hash.digest() @@ -46,10 +47,12 @@ def validate_cert(cert, key): def read_random(): try: - fd = open("/dev/urandom", "r") - buf = fd.read(8) - fd.close() - return buf + xor = lambda a,b: ''.join(chr(ord(c)^ord(d)) for c,d in zip(a,b*100)) + random = urandom(8) + x = str(time())[-8:] + result = xor(random, x) + + return result except: return None