config: fix defaults for database and checktype

This commit is contained in:
Username
2025-12-21 23:37:09 +01:00
parent 8718d33276
commit d48cc3f9eb

View File

@@ -46,6 +46,11 @@ class Config(ComboParser):
if self.ppf.max_fail < 1:
errors.append('ppf.max_fail must be >= 1')
# Validate checktype
valid_checktypes = {'irc', 'http', 'judges', 'ssl'}
if self.watchd.checktype not in valid_checktypes:
errors.append('watchd.checktype must be one of: %s' % ', '.join(sorted(valid_checktypes)))
# Validate engine names
valid_engines = {'duckduckgo', 'startpage', 'brave', 'ecosia',
'mojeek', 'qwant', 'yandex', 'github', 'gitlab',
@@ -87,7 +92,7 @@ class Config(ComboParser):
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)
self.add_item(section, 'database', str, 'proxies.sqlite', 'filename of database', True)
self.add_item(section, 'oldies', bool, False, 're-test old proxies as well ? (default: False)', False)
self.add_item(section, 'oldies_checktime', int, 43200, 'base checking interval for *old* proxies in seconds (default: 43200)', False)
self.add_item(section, 'oldies_multi', int, 10, 'fetch threads*multi rows when testing oldies (default: 10)', False)
@@ -95,7 +100,7 @@ class Config(ComboParser):
self.add_item(section, 'stale_days', int, 30, 'days after which dead proxies are removed (default: 30)', False)
self.add_item(section, 'stats_interval', int, 300, 'seconds between status reports (default: 300)', False)
self.add_item(section, 'tor_safeguard', bool, True, 'enable tor safeguard (default: True)', False)
self.add_item(section, 'checktype', str, 'http', 'check type (irc or http)', False)
self.add_item(section, 'checktype', str, 'ssl', 'check type: irc, http, judges, or ssl', False)
section = 'httpd'
self.add_item(section, 'listenip', str, '127.0.0.1', 'address for the httpd to listen to (default: 127.0.0.1)', True)
@@ -115,6 +120,7 @@ class Config(ComboParser):
self.add_item(section, 'extract_samedomain', bool, False, 'extract only url from same domains? (default: False)', False)
section = 'scraper'
self.add_item(section, 'enabled', bool, True, 'enable search engine scraper (default: True)', False)
self.add_item(section, 'debug', bool, False, 'scraper: whether to print additional debug info', False)
self.add_item(section, 'query', str, 'psw', 'build query using Proxies, Search, Websites', False)
self.add_item(section, 'backoff_base', int, 30, 'base backoff delay in seconds (default: 30)', False)
@@ -123,39 +129,10 @@ class Config(ComboParser):
self.add_item(section, 'engines', str, 'searx,duckduckgo,github', 'comma-separated search engines (default: searx,duckduckgo,github)', False)
self.add_item(section, 'max_pages', int, 5, 'max pages to fetch per engine query (default: 5)', False)
self.add_item(section, 'libretranslate_url', str, 'https://lt.mymx.me/translate', 'LibreTranslate API URL (default: https://lt.mymx.me/translate)', False)
self.add_item(section, 'libretranslate_enabled', bool, True, 'enable LibreTranslate for dynamic translations (default: True)', False)
self.add_item(section, 'libretranslate_enabled', bool, False, 'enable LibreTranslate for dynamic translations (default: False)', False)
self.aparser.add_argument("--file", help="import a single file containing proxy addrs", type=str, default='', required=False)
self.aparser.add_argument("--nobs", help="disable BeautifulSoup, use stdlib HTMLParser", action='store_true', default=False)
self.aparser.add_argument("-q", "--quiet", help="suppress info messages, show warnings and errors only", action='store_true', default=False)
self.aparser.add_argument("-v", "--verbose", help="show debug messages", action='store_true', default=False)
section = 'flood'
self.add_item(section, 'server', str, None, 'irc server address', False)
self.add_item(section, 'target', str, None, 'target to flood', False)
self.add_item(section, 'nickserv', str, 'nickserv', "nickserv's nickname", False)
self.add_item(section, 'message', str, None, 'message', False)
self.add_item(section, 'threads', int, 1, '# of threads', False)
self.add_item(section, 'register', int, 0, 'register nickname when required', False)
self.add_item(section, 'wait', int, 0, 'wait prior sending messages', False)
self.add_item(section, 'once', int, 0, 'quit as soon as possible', False)
self.add_item(section, 'hilight', int, 0, 'try to hilight all nicks?', False)
self.add_item(section, 'waitonsuccess', int, 0, 'wait for a while on success', False)
self.add_item(section, 'debug', int, 0, 'use debug', False)
self.add_item(section, 'duration', int, 180, 'maximum time to run', False)
self.add_item(section, 'delay', str, 14400, 'if waitonsuccess, wait for $delay before sending other bots', False)
self.add_item(section, 'nick', str, None, 'specify nickname to use', False)
self.add_item(section, 'use_ssl', int, 2, 'Use ssl? (0: false, 1: true, 2: random)', False)
self.add_item(section, 'cycle', int, 0, 'cycle flood', False)
self.add_item(section, 'change_nick', int, 0, 'Change nick between messages (useful when flooding privates)', False)
self.add_item(section, 'use_timeout', int, 0, 'make connexions quit through timeout', False)
self.add_item(section, 'clones', int, 1, 'Number of connexion repeat to run', False)
self.add_item(section, 'query', bool, False, 'also flood in query', False)
self.add_item(section, 'noquerybefore', int, 10, 'do not send query before x secs being connected', False)
self.add_item(section, 'oper', bool, False, 'piss of opers', False)
self.add_item(section, 'whois', bool, False, 'piss of opers with /whois', False)
self.add_item(section, 'modex', bool, False, 'make +/- x mode', False)
self.add_item(section, 'os', bool, False, 'piss off opers with /os', False)
self.add_item(section, 'file', str, None, 'read flood content from file', False)
self.add_item(section, 'failid', str, None, 'generate nickserv warn. about IDENTIFY attempts', False)
self.aparser.add_argument("--profile", help="enable cProfile profiling, output to profile.stats", action='store_true', default=False)