irc: implement use_ssl = 2

0: disabled, 1: enabled, 2: maybe
default is 0
This commit is contained in:
mickael
2019-03-03 23:57:33 +00:00
committed by Mickaël Serneels
parent 0eebe4daff
commit 310b01140a
2 changed files with 4 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ class Config(ComboParser):
self.add_item(section, 'timeout', int, 15, 'timeout for blocking operations (connect/recv/...) for proxy checks in seconds', False)
self.add_item(section, 'submit_after', int, 200, 'min. number of tested proxies for DB write', False)
self.add_item(section, 'debug', bool, False, 'whether to print additional debug info', False)
self.add_item(section, 'use_ssl', bool, False, 'whether to use SSL and port 6697 to connect to targets (slower)', False)
self.add_item(section, 'use_ssl', int, 0, 'whether to use SSL and port 6697 to connect to targets (slower)', False)
self.add_item(section, 'checktime', int, 1800, 'base checking interval for proxies in db in seconds', False)
self.add_item(section, 'perfail_checktime', int, 3600, 'additional checking interval for proxies in db in seconds per experienced failure', False)
self.add_item(section, 'database', str, 'websites.sqlite', 'filename of database', True)

View File

@@ -32,7 +32,8 @@ class WorkerJob():
def connect_socket(self):
srvname = random.choice(config.servers).strip()
protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto]
server_port = 6697 if config.watchd.use_ssl else 6667
use_ssl = random.choice([0,1]) if config.watchd.use_ssl == 2 else config.watchd.use_ssl
server_port = 6697 if use_ssl else 6667
fail_inc = 1
@@ -70,7 +71,7 @@ class WorkerJob():
]
try:
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=config.watchd.use_ssl, proxies=proxies, timeout=config.watchd.timeout)
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout)
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, srvname, 0