simplify dronebl_check_tickets, force all ips to be rechecked

This commit is contained in:
Em 2021-08-25 13:27:11 -04:00
parent 0298f3e0db
commit 907d36766d
Signed by: emerson
GPG Key ID: 270669502DA603E3
1 changed files with 23 additions and 22 deletions

View File

@ -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")