import Plugins.Plugin
-from Components.config import config
-from Components.config import ConfigSubsection
-from Components.config import ConfigSelection
-from Components.config import ConfigInteger
-from Components.config import ConfigSubList
-from Components.config import ConfigSubDict
-from Components.config import ConfigText
-from Components.config import configfile
-from Components.config import ConfigYesNo
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_LANGUAGE
-import os,gettext
+import os, gettext, sha
-__version__ = "1.5beta2"
+__version__ = "1.6.5"
PluginLanguageDomain = "WebInterface"
PluginLanguagePath = "Extensions/WebInterface/locale"
def localeInit():
- lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
- os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
- print "[WebInterface] set language to ", lang
- gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
+ lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
+ os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
+ print "[WebInterface] set language to ", lang
+ gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
def _(txt):
- t = gettext.dgettext(PluginLanguageDomain, txt)
- if t == txt:
- print "[WebInterface] fallback to default translation for", txt
- t = gettext.gettext(txt)
- return t
-
+ t = gettext.dgettext(PluginLanguageDomain, txt)
+ if t == txt:
+ print "[WebInterface] fallback to default translation for", txt
+ t = gettext.gettext(txt)
+ return t
+
+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
+
localeInit()
-language.addCallback(localeInit)
\ No newline at end of file
+language.addCallback(localeInit)