X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/b0ac904a84b223808c303f170888559b91c71e71..a8d75296d6619328f08748e987ce39e1028b0e15:/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py diff --git a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py index 2ef65829..92c16289 100755 --- a/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py +++ b/lib/python/Plugins/SystemPlugins/CrashlogAutoSubmit/plugin.py @@ -2,18 +2,19 @@ from Plugins.Plugin import PluginDescriptor from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigSelection, ConfigYesNo,ConfigText from Components.ConfigList import ConfigListScreen from Components.ActionMap import ActionMap -from Components.Label import Label +from Components.Sources.StaticText import StaticText from Components.Pixmap import Pixmap 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 = [ @@ -32,17 +33,16 @@ class CrashlogAutoSubmitConfiguration(Screen, ConfigListScreen): oldMailEntryValue = config.plugins.crashlogautosubmit.sendmail.value skin = """ - - - - - - - - - - - + + + + + + + + + + """ def __init__(self, session): @@ -66,23 +66,21 @@ class CrashlogAutoSubmitConfiguration(Screen, ConfigListScreen): "green": self.keySave, }, -2) - self["VirtualKB"] = ActionMap(["ColorActions" ], + self["VirtualKB"] = ActionMap(["VirtualKeyboardActions" ], { - "yellow": self.KeyYellow, + "showVirtualKeyboard": self.KeyText, }, -1) self.list = [] ConfigListScreen.__init__(self, self.list,session = self.session) self.createSetup() - self["VKeyButton"] = Pixmap() + self["key_red"] = StaticText(_("Close")) + self["key_green"] = StaticText(_("Save")) + self["status"] = StaticText() self["VKeyIcon"] = Pixmap() - self["closetext"] = Label(_("Close")) - self["installtext"] = Label(_("Save")) - self["HelpWindow"] = Label() - self["status"] = Label() + self["HelpWindow"] = Pixmap() - self["VKeyButton"].hide() self["VKeyIcon"].hide() self["VirtualKB"].setEnabled(False) self.onShown.append(self.setWindowTitle) @@ -100,7 +98,7 @@ class CrashlogAutoSubmitConfiguration(Screen, ConfigListScreen): ConfigListScreen.keyRight(self) self.newConfig() - def KeyYellow(self): + def KeyText(self): if self["config"].getCurrent() == self.EmailEntry: self.session.openWithCallback(self.EmailCallback, VirtualKeyBoard, title = (_("Please enter your email address here:")), text = config.plugins.crashlogautosubmit.email.value) if self["config"].getCurrent() == self.NameEntry: @@ -188,7 +186,6 @@ class CrashlogAutoSubmitConfiguration(Screen, ConfigListScreen): self.disableVKeyIcon() def enableVKeyIcon(self): - self["VKeyButton"].show() self["VKeyIcon"].show() self["VirtualKB"].setEnabled(True) @@ -201,7 +198,6 @@ class CrashlogAutoSubmitConfiguration(Screen, ConfigListScreen): current[1].help_window.instance.move(ePoint(helpwindowpos[0],helpwindowpos[1])) def disableVKeyIcon(self): - self["VKeyButton"].hide() self["VKeyIcon"].hide() self["VirtualKB"].setEnabled(False) @@ -381,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): @@ -396,7 +417,7 @@ def selSetup(menuid, **kwargs): if menuid != "system": return [ ] - return [(_("Crashlog settings") + "...", openconfig, "crashlog_config", 70)] + return [(_("Crashlog settings"), openconfig, "crashlog_config", 70)] def Plugins(**kwargs):