From 6c515d9335d9b1000a02a6fe3078b36441c369fa Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sun, 6 Jan 2019 16:12:50 +0000 Subject: [PATCH 1/3] don't continue testing offline proxies --- proxywatchd.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/proxywatchd.py b/proxywatchd.py index 39f1ffc..a24e734 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -47,6 +47,20 @@ class WorkerJob(): sock.connect() sock.send('%s\n' % random.choice(['NICK', 'USER', 'JOIN', 'MODE', 'PART', 'INVITE', 'KNOCK', 'WHOIS', 'WHO', 'NOTICE', 'PRIVMSG', 'PING', 'QUIT'])) return sock, proto, duration, torhost, srv, 0 + except rocksock.RocksockException as e: + et = e.get_errortype() + err = e.get_error() + fp = e.get_failedproxy() + + sock.disconnect() + + if et == rocksock.RS_ET_OWN: + if fp == 1 and \ + err == rocksock.RS_E_REMOTE_DISCONNECTED or \ + err == rocksock.RS_E_HIT_TIMEOUT: + # proxy is not online, so don't waste time trying all possible protocols + break + except KeyboardInterrupt as e: raise(e) except: sock.disconnect() From 14e4b832f259f40bdc52d4a2891748fa5a8126af Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sun, 6 Jan 2019 16:29:17 +0000 Subject: [PATCH 2/3] proxywatchd: dont delete timestamp when printing halt msg --- proxywatchd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxywatchd.py b/proxywatchd.py index a24e734..b0363e3 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -140,7 +140,7 @@ class WorkerThread(): class Proxywatchd(): def stop(self): - _log('\rRequesting proxywatchd to halt (%d thread(s))' % len([item for item in self.threads if True])) + _log('Requesting proxywatchd to halt (%d thread(s))' % len([item for item in self.threads if True])) self.stopping.set() def _cleanup(self): From 7d8583f7cc418812460f37589d1d97dcb391ea78 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Sun, 6 Jan 2019 16:30:32 +0000 Subject: [PATCH 3/3] no need to re-raise keyboardinterrupt --- proxywatchd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxywatchd.py b/proxywatchd.py index b0363e3..e5f4511 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -264,7 +264,7 @@ if __name__ == '__main__': w.start() w.run() except KeyboardInterrupt as e: - raise e + pass finally: w.stop() w.finish()