summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-28 00:06:42 +0100
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-12-28 00:06:42 +0100
commit9c763de9a58dd1b5de69439c3c53db347e9cbf94 (patch)
treefab1b8f284f486547ffecae581e4ef93ffc46dd9 /module/plugins
parent[Hoster] Rewrite some routines, improve others (diff)
downloadpyload-9c763de9a58dd1b5de69439c3c53db347e9cbf94.tar.xz
Fix password sharing issue
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hooks/TransmissionRPC.py2
-rw-r--r--module/plugins/internal/Account.py21
-rw-r--r--module/plugins/internal/Base.py6
-rw-r--r--module/plugins/internal/Hoster.py2
-rw-r--r--module/plugins/internal/Plugin.py4
-rw-r--r--module/plugins/internal/misc.py14
6 files changed, 35 insertions, 14 deletions
diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py
index 50b914f19..f0ef2e9b1 100644
--- a/module/plugins/hooks/TransmissionRPC.py
+++ b/module/plugins/hooks/TransmissionRPC.py
@@ -17,7 +17,7 @@ class TransmissionRPC(Addon):
__version__ = "0.17"
__status__ = "testing"
- __pattern__ = r"https?://.+\.torrent|magnet:\?.+"
+ __pattern__ = r'https?://.+\.torrent|magnet:\?.+'
__config__ = [("activated", "bool", "Activated" , False ),
("rpc_url" , "str" , "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")]
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