From 907d36766d4da399d5345ffc3122b857ff9179fe Mon Sep 17 00:00:00 2001 From: emerson Date: Wed, 25 Aug 2021 13:27:11 -0400 Subject: [PATCH] simplify dronebl_check_tickets, force all ips to be rechecked --- scripts/dronebl/dronebl_check_tickets.py | 45 ++++++++++++------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/scripts/dronebl/dronebl_check_tickets.py b/scripts/dronebl/dronebl_check_tickets.py index 790e2ce..9c928a8 100644 --- a/scripts/dronebl/dronebl_check_tickets.py +++ b/scripts/dronebl/dronebl_check_tickets.py @@ -93,29 +93,30 @@ with pgconn: already_sent = False for entry in results: debug_log.debug(results) - if entry[4] != "inactive": + if not entry[7]: + curs.execute("update proxies set status='unscanned', recheck=true where id=%s", (entry[0],)) + debug_log.debug(f"rechecking {ip}") should_remove = False - if entry[4] == "active": - if entry[7]: - if entry[1] == entry[3] or entry[1] == ip: - if entry[5] in ["http", "socks5", "socks4", "httpsocks", "https"]: - details = f"{entry[1]} has an open {entry[5]} proxy on port {entry[2]}, confirmed active at {entry[6]}" - if entry[5] == "vpngate": - details = f"{entry[1]} is running an open VPNGate proxy on port {entry[2]}, confirmed active at {entry[6]}. These are heavily abused by spammers, therefore they are blocked." - else: - details = f"Confirmed open {entry[5]} proxy with an entry IP of {entry[1]}, port {entry[2]} and exit IP of {entry[3]}, confirmed active at {entry[6]}" - debug_log.debug(details) - s.post("https://mirror1.dronebl.org/admin/tickets", headers=headers, data={"ajax": "delete", "id": ticket["ticket_id"]}) - if not already_sent: - send_active_email(ticket, details, comment.text) - debug_log.debug(f"Sent email: {details}") - already_sent = True - curs.execute("update proxies set recheck=false where id=%s", (entry[0],)) - else: - curs.execute("update proxies set status='unscanned', recheck=true where id=%s", (entry[0],)) - debug_log.debug(f"IP: {ip} is active, rechecking") - if entry[4] in ["scanning", "unscanned"]: - debug_log.debug(f"IP: {ip} is {entry[4]}, skipping") + else if entry[4] in ["scanning", "unscanned"]: + debug_log.debug(f"IP: {ip} is {entry[4]}, skipping") + should_remove = False + else if entry[4] == "active": + should_remove = False + if entry[1] == entry[3] or entry[1] == ip: + if entry[5] in ["http", "socks5", "socks4", "httpsocks", "https"]: + details = f"{entry[1]} has an open {entry[5]} proxy on port {entry[2]}, confirmed active at {entry[6]}" + if entry[5] == "vpngate": + details = f"{entry[1]} is running an open VPNGate proxy on port {entry[2]}, confirmed active at {entry[6]}. These are heavily abused by spammers, therefore they are blocked." + else: + details = f"Confirmed open {entry[5]} proxy with an entry IP of {entry[1]}, port {entry[2]} and exit IP of {entry[3]}, confirmed active at {entry[6]}" + debug_log.debug(details) + s.post("https://mirror1.dronebl.org/admin/tickets", headers=headers, data={"ajax": "delete", "id": ticket["ticket_id"]}) + if not already_sent: + send_active_email(ticket, details, comment.text) + debug_log.debug(f"Sent email: {details}") + already_sent = True + curs.execute("update proxies set recheck=false where id=%s", (entry[0],)) + if should_remove: if not results: debug_log.debug(f"IP: {ip} is not in database")