diff options
| author | ghost <andreas.monzner@multimedia-labs.de> | 2010-10-15 13:20:50 +0200 |
|---|---|---|
| committer | ghost <andreas.monzner@multimedia-labs.de> | 2010-10-15 13:20:50 +0200 |
| commit | 7dd3be2ced167827d6e2555a23e98304a10640bc (patch) | |
| tree | ddad35b0dde11d7ef1c5498ae4fd3781de9a9e26 /lib | |
| parent | 0cc396a9dd3478a71b7a0bff4f5a6fdfbc52f22d (diff) | |
| parent | 211a0c7020f0e69de917cb8ce8808799b1268c8f (diff) | |
| download | enigma2-7dd3be2ced167827d6e2555a23e98304a10640bc.tar.gz enigma2-7dd3be2ced167827d6e2555a23e98304a10640bc.zip | |
Merge remote branch 'remotes/origin/bug_597_crashlog_show_skinname'
Diffstat (limited to 'lib')
| -rwxr-xr-x | lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py | 40 | ||||
| -rwxr-xr-x | lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py | 38 |
2 files changed, 72 insertions, 6 deletions
diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py index e69de29b..cabaadd5 100755 --- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py +++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/__init__.py @@ -0,0 +1,40 @@ +import sha
+
+def bin2long(s):
+ return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+ res = ""
+ for byte in range(128):
+ res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+ return res
+
+def rsa_pub1024(src, mod):
+ return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+
+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])
+ if len(src) == 202:
+ hash.update(src[131:192])
+ result = hash.digest()
+ if result == dest[107:127]:
+ return dest
+ return None
+
+def validate_cert(cert, key):
+ buf = decrypt_block(cert[8:], key)
+ if buf is None:
+ return None
+ return buf[36:107] + cert[139:196]
+
+def read_random():
+ try:
+ fd = open("/dev/urandom", "r")
+ buf = fd.read(8)
+ fd.close()
+ return buf
+ except:
+ return None
\ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py index 25639818..92c16289 100755 --- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py +++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py @@ -8,12 +8,13 @@ from Screens.Screen import Screen from Screens.VirtualKeyBoard import VirtualKeyBoard from Screens.ChoiceBox import ChoiceBox from Screens.MessageBox import MessageBox -from enigma import ePoint +from enigma import ePoint, eTPM from Tools import Notifications import os from twisted.mail import smtp, relaymanager import MimeWriter, mimetools, StringIO +from __init__ import bin2long, long2bin, rsa_pub1024, decrypt_block, validate_cert, read_random config.plugins.crashlogautosubmit = ConfigSubsection() config.plugins.crashlogautosubmit.sendmail = ConfigSelection(default = "send", choices = [ @@ -376,11 +377,36 @@ def callCrashMailer(result,session): def autostart(reason, **kwargs): print "[CrashlogAutoSubmit] - autostart" - if "session" in kwargs: - try: - startMailer(kwargs["session"]) - except ImportError, e: - print "[CrashlogAutoSubmit] Twisted-mail not available, not starting CrashlogAutoSubmitter", e + try: + device = open("/proc/stb/info/model", "r").readline().strip() + except: + device = "" + if device != "dm7025": + 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', ':', '?'] + etpm = eTPM() + l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT) + if l2cert is None: + return + l2key = validate_cert(l2cert, rootkey) + if l2key is None: + return + l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT) + if l3cert is None: + return + l3key = validate_cert(l3cert, l2key) + if l3key is None: + return + rnd = read_random() + if rnd is None: + return + val = etpm.challenge(rnd) + result = decrypt_block(val, l3key) + if device == "dm7025" or result[80:88] == rnd: + if "session" in kwargs: + try: + startMailer(kwargs["session"]) + except ImportError, e: + print "[CrashlogAutoSubmit] Twisted-mail not available, not starting CrashlogAutoSubmitter", e def openconfig(session, **kwargs): |
