From 497f8b205095a23fbb7203ce9019d6a05dcecb7f Mon Sep 17 00:00:00 2001 From: rofl0r Date: Mon, 7 Jan 2019 02:54:33 +0000 Subject: [PATCH] watchd: remove non-printable chars from logged response --- proxywatchd.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxywatchd.py b/proxywatchd.py index cae1c9d..1566365 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -90,7 +90,8 @@ class WorkerJob(): self.total_duration += int(duration*1000) cstats = "" if match == 'unknown' else ' c: %s;'%match torstats = "" if len(config.torhosts)==1 else ' tor: %s;'%tor - _log('%s://%s;%s d: %.2f sec(s);%s; srv: %s; recv: %s' % (proto, self.proxy, cstats, duration, torstats, srv, recv), 'xxxxx') + recvstats = "".join([x if x in string.printable and ord(x) > 32 else '.' for x in recv]) + _log('%s://%s;%s d: %.2f sec(s);%s srv: %s; recv: %s' % (proto, self.proxy, cstats, duration, torstats, srv, recvstats), 'xxxxx') except KeyboardInterrupt as e: raise e except: