From aeff09d2b348f37e93674e5cbad3489b766bd0f0 Mon Sep 17 00:00:00 2001 From: mickael Date: Mon, 7 Jan 2019 21:11:08 +0000 Subject: [PATCH] move math function inside the sql statement --- config.ini.sample | 3 +++ config.py | 5 ++++- ppf.py | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/config.ini.sample b/config.ini.sample index 61937fd..ecb72a6 100644 --- a/config.ini.sample +++ b/config.ini.sample @@ -15,3 +15,6 @@ debug = false search = true timeout = 30 threads = 3 +checktime = 3600 +perfail_checktime = 3600 + diff --git a/config.py b/config.py index 8c7c510..15f450d 100644 --- a/config.py +++ b/config.py @@ -4,7 +4,7 @@ _loaded = False def load(): if _loaded: return - global database, maxfail, search, torhosts, watchd_threads, checktime, timeout, read_timeout, submit_after, use_ssl + global database, maxfail, search, torhosts, watchd_threads, checktime, timeout, read_timeout, submit_after, use_ssl, checktime, perfail_checktime ## read the config files parser = SafeConfigParser() @@ -22,6 +22,9 @@ def load(): use_ssl = parser.getboolean('watcherd', 'use_ssl') global watchd_debug watchd_debug = parser.getboolean('watcherd', 'debug') + #url_maxfail = parser.get('proxyfind', 'maxfail') + checktime = parser.get('proxyfind', 'checktime') + perfail_checktime = parser.get('proxyfind', 'perfail_checktime') # allow overriding select items from the commandline import argparse diff --git a/ppf.py b/ppf.py index 95c2fd8..2826f3e 100755 --- a/ppf.py +++ b/ppf.py @@ -127,15 +127,15 @@ def proxyleech(sqlite, rows): hash = hashlib.md5(''.join(uniques)).hexdigest() - ## empty list of proxies: increment error by two + ## empty list of proxies: multiply error by two if not len(uniques): row[2] = (row[2] * 2) ## same proxy list: increment error by one elif hash == row[1]: row[2] = (row[2] + 1) ## proxylist was updated: error is zero else: row[2] = 0 - check_time = (time.time() + 3600 + (3600 * row[2])) - sqlite.execute('UPDATE uris SET error=?,hash=?,check_time=? where url=?', (row[2],hash, check_time,row[0])) + #check_time = (time.time() + 3600 + (3600 * row[2])) + sqlite.execute('UPDATE uris SET error=?,hash=?,check_time=? where url=?', (row[2],hash, time.time(),row[0])) sqlite.commit() if not row[1] or row[2] > 0: return @@ -183,7 +183,8 @@ if __name__ == '__main__': while True: try: ## any site that needs to be checked ? - rows = [ [i[0],i[1],i[2]] for i in sqlite.execute('SELECT url,hash,error FROM uris WHERE (check_time