diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-28 00:06:42 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-28 00:06:42 +0100 |
commit | 9c763de9a58dd1b5de69439c3c53db347e9cbf94 (patch) | |
tree | fab1b8f284f486547ffecae581e4ef93ffc46dd9 /module/plugins/internal | |
parent | [Hoster] Rewrite some routines, improve others (diff) | |
download | pyload-9c763de9a58dd1b5de69439c3c53db347e9cbf94.tar.xz |
Fix password sharing issue
Diffstat (limited to 'module/plugins/internal')
-rw-r--r-- | module/plugins/internal/Account.py | 21 | ||||
-rw-r--r-- | module/plugins/internal/Base.py | 6 | ||||
-rw-r--r-- | module/plugins/internal/Hoster.py | 2 | ||||
-rw-r--r-- | module/plugins/internal/Plugin.py | 4 | ||||
-rw-r--r-- | module/plugins/internal/misc.py | 14 |
5 files changed, 34 insertions, 13 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index 4eddc1516..e89d1af7d 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -6,7 +6,7 @@ import threading import time from module.plugins.internal.Plugin import Plugin, Skip -from module.plugins.internal.misc import Periodical, compare_time, isiterable, lock, parse_size, safe_format +from module.plugins.internal.misc import Periodical, compare_time, isiterable, lock, parse_size class Account(Plugin): @@ -64,6 +64,21 @@ class Account(Plugin): return bool(self.get_data('premium')) + def _log(self, level, plugintype, pluginname, messages): + log = getattr(self.pyload.log, level) + msg = u" | ".join(decode(a).strip() for a in messages if a) + + try: + msg = msg.replace(self.info['login']['password'], "**********") + except Exception: + pass + + log("%(plugintype)s %(pluginname)s: %(msg)s" % + {'plugintype': plugintype.upper(), + 'pluginname': pluginname, + 'msg' : msg}) + + def setup(self): """ Setup for enviroment and other things, called before logging (possibly more than one time) @@ -193,7 +208,7 @@ class Account(Plugin): self.syncback() - self.log_debug("Account info for user `%s`: %s" % (self.user, safe_format(self.info, self.info['login']['password']))) + self.log_debug("Account info for user `%s`: %s" % (self.user, self.info)) return self.info @@ -408,7 +423,7 @@ class Account(Plugin): ########################################################################### - def parse_traffic(self, size, unit=None): #@NOTE: Returns kilobytes in 0.4.9 + def parse_traffic(self, size, unit=None): #@NOTE: Returns kilobytes only in 0.4.9 self.log_debug("Size: %s" % size, "Unit: %s" % (unit or "N/D")) return parse_size(size, unit or "byte") / 1024 #@TODO: Remove `/ 1024` in 0.4.10 diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index 063950db6..3fa0e40d2 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -104,6 +104,12 @@ class Base(Plugin): def _log(self, level, plugintype, pluginname, messages): log = getattr(self.pyload.log, level) msg = u" | ".join(decode(a).strip() for a in messages if a) + + try: + msg = msg.replace(self.account.info['login']['password'], "**********") + except Exception: + pass + log("%(plugintype)s %(pluginname)s[%(id)s]: %(msg)s" % {'plugintype': plugintype.upper(), 'pluginname': pluginname, diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index d563d426f..2e70517d3 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -211,7 +211,7 @@ class Hoster(Base): if self.pyload.debug: self.log_debug("DOWNLOAD URL " + url, - *["%s=%s" % (key, val) for key, val in locals().items() + *["%s=%s" % (key, value) for key, value in locals().items() if key not in ("self", "url", "_[1]")]) dl_url = self.fixurl(url) diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 43284f6a8..9357ea8fb 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -176,8 +176,8 @@ class Plugin(object): """ if self.pyload.debug: self.log_debug("LOAD URL " + url, - *["%s=%s" % (key, safe_format(val, self.info['login']['password']) if self.__type__ == "account" else val) - for key, val in locals().items() if key not in ("self", "url", "_[1]")]) + *["%s=%s" % (key, value) for key, value in locals().items() + if key not in ("self", "url", "_[1]")]) url = fixurl(url, unquote=True) #: Recheck in 0.4.10 diff --git a/module/plugins/internal/misc.py b/module/plugins/internal/misc.py index 140e74409..50b9ec641 100644 --- a/module/plugins/internal/misc.py +++ b/module/plugins/internal/misc.py @@ -682,8 +682,8 @@ def replace_patterns(value, rules): #@TODO: Remove in 0.4.10 and fix exp in CookieJar.setCookie -def set_cookie(cj, *args, path='/', exp=time.time() + 180 * 24 * 3600): - args = map(encode, args) + [encode(path), int(exp)] +def set_cookie(cj, domain, name, value, path='/', exp=time.time() + 180 * 24 * 3600): + args = map(encode, [domain, name, value, path]) + [int(exp)] return cj.setCookie(*args) @@ -698,7 +698,7 @@ def set_cookies(cj, cookies): set_cookie(cj, *cookie) -def parse_html_header(self, header) +def parse_html_header(self, header): hdict = {} regexp = r'[ ]*(?P<key>.+?)[ ]*:[ ]*(?P<value>.+?)[ ]*\r?\n' @@ -740,13 +740,13 @@ def parse_html_form(attr_str, html, input_names={}): return action, inputs else: #: Check input attributes - for key, val in input_names.items(): + for key, value in input_names.items(): if key in inputs: - if isinstance(val, basestring) and inputs[key] is val: + if isinstance(value, basestring) and inputs[key] is value: continue - elif isinstance(val, tuple) and inputs[key] in val: + elif isinstance(value, tuple) and inputs[key] in value: continue - elif hasattr(val, "search") and re.match(val, inputs[key]): + elif hasattr(value, "search") and re.match(value, inputs[key]): continue else: break #: Attibute value does not match |