summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Arno-Nymous <Arno-Nymous@users.noreply.github.com> 2015-12-27 12:57:23 +0100
committerGravatar Arno-Nymous <Arno-Nymous@users.noreply.github.com> 2015-12-27 12:57:23 +0100
commit2743196a14bf964f42d9af7dec24855fce6130e5 (patch)
tree8e2709933a3b744d68b2a4d3b46f207ca80369da /module/plugins
parentIgnore some more (diff)
parentMerge pull request #2223 from GammaC0de/safe_format (diff)
downloadpyload-2743196a14bf964f42d9af7dec24855fce6130e5.tar.xz
Merge latest changes from original pyLoad repo
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/internal/Account.py6
-rw-r--r--module/plugins/internal/Plugin.py5
-rw-r--r--module/plugins/internal/utils.py32
3 files changed, 37 insertions, 6 deletions
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index ddbf03321..ba8db0a6d 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -6,13 +6,13 @@ import threading
import time
from module.plugins.internal.Plugin import Plugin, Skip
-from module.plugins.internal.utils import compare_time, isiterable, lock, parse_size
+from module.plugins.internal.utils import compare_time, isiterable, lock, parse_size, safe_format
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.65"
+ __version__ = "0.69"
__status__ = "stable"
__description__ = """Base account plugin"""
@@ -237,7 +237,7 @@ class Account(Plugin):
self.syncback()
- self.log_debug("Account info for user `%s`: %s" % (self.user, self.info))
+ self.log_debug("Account info for user `%s`: %s" % (self.user, safe_format(self.info, self.info['login']['password'])))
return self.info
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 274cff301..bf591d482 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -20,7 +20,7 @@ from module.plugins.internal.utils import *
class Plugin(object):
__name__ = "Plugin"
__type__ = "plugin"
- __version__ = "0.59"
+ __version__ = "0.61"
__status__ = "stable"
__config__ = [] #: [("name", "type", "desc", "default")]
@@ -214,7 +214,8 @@ class Plugin(object):
"""
if self.pyload.debug:
self.log_debug("LOAD URL " + url,
- *["%s=%s" % (key, val) for key, val in locals().items() if key not in ("self", "url", "_[1]")])
+ *["%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]")])
url = fixurl(url, unquote=True) #: Recheck in 0.4.10
diff --git a/module/plugins/internal/utils.py b/module/plugins/internal/utils.py
index 1fdbaf279..02077cffd 100644
--- a/module/plugins/internal/utils.py
+++ b/module/plugins/internal/utils.py
@@ -30,7 +30,7 @@ except ImportError:
class utils(object):
__name__ = "utils"
__type__ = "plugin"
- __version__ = "0.08"
+ __version__ = "0.09"
__status__ = "stable"
__pattern__ = r'^unmatchable$'
@@ -71,6 +71,36 @@ def format_size(value):
return "%.2f %s" % (size, sizes[steps])
+def safe_format(value, unsafe):
+ """
+ Returns the content of value omitting sensitive information
+
+ Args:
+ value: value to format
+ unsafe: string or list: sensitive word(s) to remove
+ """
+ if isinstance(value, basestring):
+ if isinstance(unsafe, basestring):
+ return "'%s'" % ("**********" if value == unsafe else value)
+
+ elif isinstance(unsafe, list):
+ return "'%s'" % ("**********" if value in unsafe else value)
+
+ elif isinstance(value, dict):
+ return "{%s}" % ", ".join("'%s': %s" % (k, safe_format(v, unsafe)) for k, v in value.iteritems())
+
+ elif isinstance(value, list):
+ return "[%s]" % ", ".join("%s" % safe_format(v, unsafe) for v in value)
+
+ elif isinstance(value, tuple):
+ return "(%s)" % ", ".join("%s" % safe_format(v, unsafe) for v in value)
+
+ elif isinstance(value, set):
+ return "set([%s])" % ", ".join("%s" % safe_format(v, unsafe) for v in value)
+
+ return repr(value)
+
+
def compare_time(start, end):
start = map(int, start)
end = map(int, end)