Added an enhanced dnsbl check, updated mirrors and license, etc

This commit is contained in:
Dionysus 2024-01-20 18:38:24 -05:00
parent 56a6a12994
commit e5691b7e97
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
4 changed files with 560 additions and 41 deletions

View File

@ -1,6 +1,6 @@
ISC License ISC License
Copyright (c) 2023, acidvegas <acid.vegas@acid.vegas> Copyright (c) 2024, acidvegas <acid.vegas@acid.vegas>
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above purpose with or without fee is hereby granted, provided that the above

View File

@ -8,5 +8,4 @@
___ ___
###### Mirrors ###### Mirrors for this repository: [acid.vegas](https://git.acid.vegas/proxytools) • [SuperNETs](https://git.supernets.org/acidvegas/proxytools) • [GitHub](https://github.com/acidvegas/proxytools) • [GitLab](https://gitlab.com/acidvegas/proxytools) • [Codeberg](https://codeberg.org/acidvegas/proxytools)
[acid.vegas](https://git.acid.vegas/proxytools) • [GitHub](https://github.com/acidvegas/proxytools) • [GitLab](https://gitlab.com/acidvegas/proxytools) • [SuperNETs](https://git.supernets.org/acidvegas/proxytools)

586
dnsbl.py
View File

@ -1,97 +1,617 @@
#!/usr/bin/env python #!/usr/bin/env python
# DNSBL - Developed by acidvegas in Python (https://git.acid.vegas/proxytools) # DNSBL - Developed by acidvegas in Python (https://git.acid.vegas/proxytools)
# NOT FINISHED - WORK IN PROGRESS import argparse
import asyncio import asyncio
import ipaddress import ipaddress
import socket import logging
import os
try: try:
import aiodns import aiodns
except ImportError: except ImportError:
raise SystemExit('missing required library \'aiodns\' (https://pypi.org/project/aiodns/)') raise SystemExit('missing required library \'aiodns\' (https://pypi.org/project/aiodns/)')
# ANSI color codes
RED = '\033[91m'
GREEN = '\033[92m'
GREY = '\033[90m'
RESET = '\033[0m'
DNSBL_LIST = [ DNSBL_LIST = [
'0outspam.fusionzero.com',
'0spam-killlist.fusionzero.com',
'0spam.fusionzero.com',
'0spamtrust.fusionzero.com',
'0spamurl.fusionzero.com',
'3y.spam.mrs.kithrup.com',
'88.blocklist.zap',
'abuse-contacts.abusix.org',
'abuse.rfc-clueless.org',
'abuse.rfc-ignorant.org',
'access.atlbl.net',
'access.redhawk.org',
'accredit.habeas.com',
'admin.bl.kundenserver.de',
'all.ascc.dnsbl.bit.nl',
'all.dnsbl.bit.nl',
'all.rbl.jp',
'all.rbl.webiron.net',
'all.s5h.net',
'all.spam-rbl.fr',
'all.spamblock.unit.liu.se',
'all.spamrats.com',
'all.v6.ascc.dnsbl.bit.nl',
'apnic-main.bogons.dnsiplists.completewhois.com',
'arin-legacy-classb.bogons.dnsiplists.completewhois.com',
'arin-legacy-classc.bogons.dnsiplists.completewhois.com',
'arin-main.bogons.dnsiplists.completewhois.com',
'asiaspam.spamblocked.com',
'asn.routeviews.org',
'aspath.routeviews.org',
'aspews.dnsbl.sorbs.net',
'aspews.ext.sorbs.net',
'assholes.madscience.nl',
'auth.spamrats.com',
'autowork.drbl.ks.cz',
'b.barracudacentral.org', 'b.barracudacentral.org',
'babl.rbl.webiron.net',
'backscatter.spameatingmonkey.net',
'bad.psky.me',
'badconf.rhsbl.sorbs.net',
'badnets.spameatingmonkey.net',
'ban.zebl.zoneedit.com',
'bandwidth-pigs.monkeys.com',
'bb.barracudacentral.org',
'bitonly.dnsbl.bit.nl',
'bl.blocklist.de',
'bl.blueshore.net',
'bl.borderworlds.dk',
'bl.deadbeef.com',
'bl.drmx.org',
'bl.emailbasura.org',
'bl.fmb.la',
'bl.ipv6.spameatingmonkey.net',
'bl.konstant.no',
'bl.mailspike.net',
'bl.mailspike.org',
'bl.mav.com.br',
'bl.mipspace.com',
'bl.nszones.com',
'bl.rbl-dns.com',
'bl.reynolds.net.au',
'bl.scientificspam.net',
'bl.score.senderscore.com',
'bl.shlink.org',
'bl.shlink.orgdul.ru',
'bl.spamcannibal.org',
'bl.spamcop.net',
'bl.spameatingmonkey.net',
'bl.spamstinks.com',
'bl.spamthwart.com',
'bl.student.pw.edu.pl',
'bl.suomispam.net',
'bl.tiopan.com',
'bl.tolkien.dk',
'black.junkemailfilter.com',
'blackhole.compu.net',
'blackholes.brainerd.net',
'blackholes.easynet.nl',
'blackholes.five-ten-sg.com',
'blackholes.mail-abuse.org',
'blackholes.sandes.dk',
'blacklist.fpsn.net',
'blacklist.hostkarma.com',
'blacklist.informationwave.net',
'blacklist.mail.ops.asp.att.net',
'blacklist.mailrelay.att.net',
'blacklist.sci.kun.nl',
'blacklist.sci.ru.nl',
'blacklist.sequoia.ops.asp.att.net',
'blacklist.woody.ch',
'block.ascams.com',
'block.blars.org',
'block.dnsbl.sorbs.net',
'blocked.asgardnet.org',
'blocked.hilli.dk',
'blocklist.squawk.com',
'blocklist2.squawk.com',
'bogon.lbl.lagengymnastik.dk',
'bogons.cymru.com',
'bogons.dnsiplists.completewhois.com',
'bogusmx.rfc-clueless.org',
'bogusmx.rfc-ignorant.org',
'bsb.empty.us',
'bsb.spamlookup.net',
'cabl.rbl.webiron.net',
'cart00ney.surriel.com',
'catchspam.com',
'cbl.abuseat.org', 'cbl.abuseat.org',
'http.dnsbl.sorbs.net', 'cbl.anti-spam.org.cn',
'misc.dnsbl.sorbs.net', 'cblless.anti-spam.org.cn',
'socks.dnsbl.sorbs.net', 'cblplus.anti-spam.org.cn',
'web.dnsbl.sorbs.net', 'ccess.redhawk.org',
'cdl.anti-spam.org.cn',
'china.rominet.net',
'cidr.bl.mcafee.com',
'client-domain.sjesl.monkeys.com',
'cml.anti-spam.org.cn',
'combined-hib.dnsiplists.completewhois.com',
'combined.abuse.ch',
'combined.njabl.org',
'combined.rbl.msrbl.net',
'communicado.fmb.la',
'contacts.abuse.net',
'country-rirdata.dnsiplists.completewhois.com',
'crawler.rbl.webiron.net',
'csi.cloudmark.com',
'czdynamic.drbl.ks.cz',
'db.rurbl.ru',
'db.wpbl.info',
'dbl.spamhaus.org',
'dbl.suomispam.net',
'dev.null.dk',
'devnull.drbl.be.net.ru',
'dialup.blacklist.jippg.org',
'dialup.drbl.sandy.ru',
'dialups.mail-abuse.org',
'dialups.visi.com',
'dnsbl-0.uceprotect.net',
'dnsbl-1.uceprotect.net', 'dnsbl-1.uceprotect.net',
'dnsbl-2.uceprotect.net', 'dnsbl-2.uceprotect.net',
'dnsbl-3.uceprotect.net', 'dnsbl-3.uceprotect.net',
'db.wpbl.info', 'dnsbl.abuse.ch',
'zen.spamhaus.org', 'dnsbl.anticaptcha.net',
'spam.dnsbl.sorbs.net', 'dnsbl.antispam.or.id',
'noptr.spamrats.com', 'dnsbl.aspnet.hu',
'cbl.anti-spam.org.cn', 'dnsbl.calivent.com.pe',
'dnsbl.cbn.net.id',
'dnsbl.clue-by-4.org',
'dnsbl.cobion.com',
'dnsbl.cyberlogic.net',
'dnsbl.delink.net',
'dnsbl.dronebl.org', 'dnsbl.dronebl.org',
'dnsbl.forefront.microsoft.com',
'dnsbl.httpbl.org',
'dnsbl.inps.de', 'dnsbl.inps.de',
'dnsbl.ioerror.us',
'dnsbl.justspam.org',
'dnsbl.kempt.net',
'dnsbl.madavi.de',
'dnsbl.mags.net',
'dnsbl.mailshell.net',
'dnsbl.mcu.edu.tw',
'dnsbl.net.ua',
'dnsbl.njabl.org',
'dnsbl.pagedirect.net',
'dnsbl.proxybl.org',
'dnsbl.rangers.eu.org',
'dnsbl.rizon.net',
'dnsbl.rv-soft.info',
'dnsbl.rymsho.ru',
'dnsbl.sorbs.net', 'dnsbl.sorbs.net',
'dnsbl.spam-champuru.livedoor.com',
'dnsbl.spfbl.net',
'dnsbl.technoirc.org',
'dnsbl.tornevall.org',
'dnsbl.webequipped.com',
'dnsbl.wpbl.pc9.org',
'dnsbl.zapbl.net',
'dnsbl6.anticaptcha.net',
'dnsblchile.org',
'dnsrbl.org',
'dnsrbl.swinog.ch',
'dnswl.inps.de',
'dnswl.leisi.net',
'dob.sibl.support-intelligence.net',
'drone.abuse.ch', 'drone.abuse.ch',
'dronebl.noderebellion.net',
'dsn.bl.rfc-ignorant.de',
'dsn.rfc-clueless.org',
'dsn.rfc-ignorant.org',
'dssl.imrss.org',
'duinv.aupads.org', 'duinv.aupads.org',
'dul.blackhole.cantv.net',
'dul.dnsbl.sorbs.net', 'dul.dnsbl.sorbs.net',
'dul.dnsbl.sorbs.netdul.ru',
'dul.orca.bc.ca',
'dul.pacifier.net',
'dul.ru',
'dyn.nszones.com',
'dyna.spamrats.com', 'dyna.spamrats.com',
'dynablock.easynet.nl',
'dynablock.sorbs.net',
'dynamic.dnsbl.rangers.eu.org',
'dyndns.rbl.jp',
'dynip.rothen.com', 'dynip.rothen.com',
'elitist.rfc-clueless.org',
'endn.bl.reynolds.net.au',
'escalations.dnsbl.sorbs.net',
'eswlrev.dnsbl.rediris.es',
'eurospam.spamblocked.com',
'ex.dnsbl.org',
'exitnodes.tor.dnsbl.sectoor.de',
'exitnodes.tor.dnsbl.sectoor.dehttp.dnsbl.sorbs.net',
'feb.spamlab.com',
'fnrbl.fast.net',
'forbidden.icm.edu.pl',
'formmail.relays.monkeys.com',
'free.v4bl.org',
'fresh.dict.rbl.arix.com',
'fresh.sa_slip.rbl.arix.com',
'fresh.spameatingmonkey.net',
'fresh10.spameatingmonkey.net',
'fresh15.spameatingmonkey.net',
'fulldom.rfc-clueless.org',
'geobl.spameatingmonkey.net',
'gl.suomispam.net',
'hbl.atlbl.net',
'helo-domain.sjesl.monkeys.com',
'hijacked.dnsiplists.completewhois.com',
'hil.habeas.com',
'hong-kong.rominet.net',
'hostkarma.junkemailfilter.com',
'hostkarma.junkemailfilter.com[brl]',
'http.dnsbl.sorbs.net',
'httpbl.abuse.ch',
'hul.habeas.com',
'iadb.isipp.com',
'iadb2.isipp.com',
'iana-classa.bogons.dnsiplists.completewhois.com',
'iddb.isipp.com',
'images.rbl.msrbl.net',
'in.dnsbl.org',
'inputs.orbz.org',
'intercept.datapacket.net',
'intruders.docs.uu.se',
'invalidipwhois.dnsiplists.completewhois.com',
'ip.v4bl.org',
'ipbl.zeustracker.abuse.ch',
'ips.backscatterer.org', 'ips.backscatterer.org',
'ips.whitelisted.org',
'ipv6.all.dnsbl.bit.nl',
'ipv6.all.s5h.net',
'ipwhois.rfc-ignorant.org',
'is-tor.kewlio.net.uk',
'ispmx.pofon.foobar.hu',
'isps.spamblocked.com',
'ix.dnsbl.manitu.net', 'ix.dnsbl.manitu.net',
'korea.rominet.net',
'korea.services.net', 'korea.services.net',
'ksi.dnsbl.net.au',
'l1.apews.org',
'l1.apews.rhsbl.sorbs.net',
'l1.bbfh.ext.sorbs.net',
'l1.spews.dnsbl.sorbs.net',
'l2.apews.dnsbl.sorbs.net',
'l2.bbfh.ext.sorbs.net',
'l2.spews.dnsbl.sorbs.net',
'l3.bbfh.ext.sorbs.net',
'l4.bbfh.ext.sorbs.net',
'lacnic-main.bogons.dnsiplists.completewhois.com',
'lacnic.spamblocked.com',
'lame.dnsbl.rangers.eu.org',
'lbl.lagengymnastik.dk',
'list.anonwhois.net',
'list.bbfh.org',
'list.blogspambl.com',
'list.dnswl.org',
'list.quorum.to',
'mail-abuse.blacklist.jippg.org',
'mail.people.it',
'manual.orbz.gst-group.co.uk',
'misc.dnsbl.sorbs.net',
'mr-out.imrss.org',
'msgid.bl.gweep.ca',
'mtawlrev.dnsbl.rediris.es',
'multi.surbl.org',
'multi.uribl.com',
'netbl.spameatingmonkey.net',
'netblock.pedantic.org',
'netblockbl.spamgrouper.com',
'netblockbl.spamgrouper.to',
'netscan.rbl.blockedservers.com',
'new.dnsbl.sorbs.net',
'new.spam.dnsbl.sorbs.net',
'nml.mail-abuse.org',
'no-more-funn.moensted.dk',
'nobl.junkemailfilter.com',
'nomail.rhsbl.sorbs.net',
'noptr.spamrats.com',
'noservers.dnsbl.sorbs.net',
'nospam.ant.pl',
'nsbl.fmb.la',
'old.dnsbl.sorbs.net',
'old.spam.dnsbl.sorbs.net',
'omrs.dnsbl.net.au',
'opm.tornevall.org',
'orbs.dorkslayers.com',
'orbz.gst-group.co.uk',
'origin.asn.cymru.com',
'origin.asn.spameatingmonkey.net',
'origin6.asn.cymru.com',
'orvedb.aupads.org', 'orvedb.aupads.org',
'osps.dnsbl.net.au', 'osps.dnsbl.net.au',
'osrs.dnsbl.net.au', 'osrs.dnsbl.net.au',
'outputs.orbz.org',
'owfs.dnsbl.net.au', 'owfs.dnsbl.net.au',
'pacbelldsl.compu.net',
'paidaccessviarsync',
'pbl.spamhaus.org', 'pbl.spamhaus.org',
'pdl.bl.reynolds.net.au',
'peer.asn.cymru.com',
'phishing.rbl.msrbl.net', 'phishing.rbl.msrbl.net',
'plus.bondedsender.org',
'pm0-no-more.compu.net',
'pofon.foobar.hu',
'policy.lbl.lagengymnastik.dk',
'postmaster.rfc-clueless.org',
'postmaster.rfc-ignorant.org',
'ppbl.beat.st',
'probes.dnsbl.net.au', 'probes.dnsbl.net.au',
'probes.dnsbl.net.auproxy.bl.gweep.ca',
'problems.dnsbl.sorbs.net',
'proxies.blackholes.easynet.nl',
'proxies.dnsbl.sorbs.net',
'proxies.exsilia.net',
'proxies.relays.monkeys.com',
'proxy.bl.gweep.ca', 'proxy.bl.gweep.ca',
'proxy.block.transip.nl',
'proxy.drbl.be.net.ru',
'psbl.surriel.com',
'pss.spambusters.org.ar',
'q.mail-abuse.com',
'query.bondedsender.org',
'query.senderbase.org',
'r.mail-abuse.com',
'rabl.nuclearelephant.com',
'random.bl.gweep.ca',
'rbl-plus.mail-abuse.org',
'rbl.abuse.ro',
'rbl.atlbl.net',
'rbl.blakjak.net',
'rbl.blockedservers.com',
'rbl.bulkfeeds.jp',
'rbl.cbn.net.id',
'rbl.choon.net',
'rbl.dns-servicios.com',
'rbl.echelon.pl',
'rbl.efnet.org',
'rbl.efnethelp.net',
'rbl.efnetrbl.org',
'rbl.eznettools.com',
'rbl.fasthosts.co.uk',
'rbl.firstbase.com',
'rbl.init1.nl',
'rbl.interserver.net', 'rbl.interserver.net',
'rbl.iprange.net',
'rbl.ipv6wl.eu',
'rbl.jp',
'rbl.lugh.ch',
'rbl.ma.krakow.pl',
'rbl.mail-abuse.org',
'rbl.megarbl.net',
'rbl.ntvinet.net',
'rbl.pil.dk',
'rbl.polarcomm.net',
'rbl.rope.net',
'rbl.schulte.org',
'rbl.snark.net',
'rbl.spamlab.com',
'rbl.suresupport.com',
'rbl.talkactive.net',
'rbl.triumf.ca',
'rbl2.triumf.ca',
'rdts.bl.reynolds.net.au',
'rdts.dnsbl.net.au', 'rdts.dnsbl.net.au',
'recent.dnsbl.sorbs.net',
'recent.spam.dnsbl.sorbs.net',
'relayips.rbl.shub-inter.net',
'relays.bl.gweep.ca', 'relays.bl.gweep.ca',
'relays.bl.kundenserver.de',
'relays.dnsbl.sorbs.net',
'relays.dorkslayers.com',
'relays.mail-abuse.org',
'relays.nether.net', 'relays.nether.net',
'relays.radparker.com',
'relays.sandes.dk',
'relaywatcher.n13mbl.com',
'rep.mailspike.net',
'reputation-domain.rbl.scrolloutf1.com',
'reputation-ip.rbl.scrolloutf1.com',
'reputation-ns.rbl.scrolloutf1.com',
'residential.block.transip.nl', 'residential.block.transip.nl',
'rf.senderbase.org',
'rhsbl.rymsho.ru',
'rhsbl.scientificspam.net',
'rhsbl.sorbs.net',
'rhsbl.zapbl.net',
'ricn.dnsbl.net.au', 'ricn.dnsbl.net.au',
'ripe-main.bogons.dnsiplists.completewhois.com',
'rmst.dnsbl.net.au', 'rmst.dnsbl.net.au',
'rot.blackhole.cantv.net',
'rsbl.aupads.org',
'rwl.choon.net',
'sa-accredit.habeas.com',
'sa.senderbase.org',
'safe.dnsbl.sorbs.net',
'sbl-xbl.spamhaus.org',
'sbl.nszones.com',
'sbl.spamhaus.org',
'schizo-bl.kundenserver.de',
'score.senderscore.com',
'sender-address.sjesl.monkeys.com',
'sender-domain-validate.sjesl.monkeys.com',
'sender-domain.sjesl.monkeys.com',
'service.mailwhitelist.com',
'short.fmb.la',
'short.rbl.jp',
'singlebl.spamgrouper.com',
'singular.ttk.pte.hu',
'smtp.dnsbl.sorbs.net', 'smtp.dnsbl.sorbs.net',
'socks.dnsbl.sorbs.net',
'sohul.habeas.com',
'sorbs.dnsbl.net.au',
'spam.abuse.ch', 'spam.abuse.ch',
'spam.dnsbl.anonmails.de', 'spam.dnsbl.anonmails.de',
'spam.dnsbl.rangers.eu.org',
'spam.dnsbl.sorbs.net',
'spam.exsilia.net',
'spam.lbl.lagengymnastik.dk',
'spam.olsentech.net',
'spam.pedantic.org',
'spam.rbl.blockedservers.com',
'spam.rbl.msrbl.net', 'spam.rbl.msrbl.net',
'spam.shri.net',
'spam.spamrats.com', 'spam.spamrats.com',
'spam.wonk.org',
'spam.wytnij.to',
'spam.zapjunk.com',
'spamblock.kundenserver.de',
'spambot.bls.digibase.ca',
'spamdomain.block.transip.nl',
'spamdomains.blackholes.easynet.nl',
'spamguard.leadmon.net',
'spamips.rbl.shub-inter.net',
'spamlist.or.kr',
'spamrbl.imp.ch', 'spamrbl.imp.ch',
'spamsource.block.transip.nl',
'spamsources.fabel.dk',
'spamsources.spamblocked.com',
'spamsupport.dnsbl.rangers.eu.org',
'spbl.bl.winbots.org',
'spews.block.transip.nl',
'srn.surgate.net',
'srnblack.surgate.net',
'st.technovision.dk',
'stabl.rbl.webiron.net',
'stale.dict.rbl.arix.com',
'stale.sa_slip.arix.com',
'superblock.ascams.com',
'swl.spamhaus.org',
't3direct.dnsbl.net.au', 't3direct.dnsbl.net.au',
'taiwan.rominet.net',
'tor.dan.me.uk',
'tor.dnsbl.sectoor.de', 'tor.dnsbl.sectoor.de',
'tor.efnet.org',
'torexit.dan.me.uk',
'torserver.tor.dnsbl.sectoor.de', 'torserver.tor.dnsbl.sectoor.de',
'truncate.gbudb.net',
'trusted.nether.net',
'ubl.lashback.com', 'ubl.lashback.com',
'ubl.nszones.com',
'ubl.unsubscore.com', 'ubl.unsubscore.com',
'unsure.nether.net',
'uribl.abuse.ro',
'uribl.pofon.foobar.hu',
'uribl.spameatingmonkey.net',
'uribl.swinog.ch',
'uribl.zeustracker.abuse.ch',
'urired.spameatingmonkey.net',
'url.rbl.jp',
'v4.fullbogons.cymru.com',
'v6.fullbogons.cymru.com',
'vbl.mookystick.com',
'virbl.bit.nl',
'virbl.dnsbl.bit.nl',
'virus.rbl.jp', 'virus.rbl.jp',
'virus.rbl.msrbl.net', 'virus.rbl.msrbl.net',
'vote.drbl.be.net.ru',
'vote.drbl.caravan.ru',
'vote.drbl.croco.net',
'vote.drbl.dataforce.net',
'vote.drbl.gremlin.ru',
'vote.drbl.host.kz',
'vote.drbldf.dsbl.ru',
'vote.rbl.ntvinet.net',
'vouch.dwl.spamhaus.org',
'wadb.isipp.com',
'wbl.triumf.ca',
'wdl.bl.reynolds.net.au',
'web.dnsbl.sorbs.net',
'web.rbl.msrbl.net',
'whitelist.sci.kun.nl',
'whitelist.surriel.com',
'whois.rfc-clueless.org',
'whois.rfc-ignorant.org',
'wl.mailspike.net',
'wl.nszones.com',
'wl.shlink.org',
'wl.summersault.com',
'wl.trusted-forwarder.org',
'work.drbl.caravan.ru',
'work.drbl.croco.net',
'work.drbl.dataforce.net',
'work.drbl.gremlin.ru',
'work.drbl.host.kz',
'work.drbldf.dsbl.ru',
'worm.dnsbl.rangers.eu.org',
'wormrbl.imp.ch', 'wormrbl.imp.ch',
'worms-bl.kundenserver.de',
'wpb.bl.reynolds.net.au',
'xbl.selwerd.cx',
'xbl.spamhaus.org', 'xbl.spamhaus.org',
'ybl.megacity.org',
'z.mailspike.net', 'z.mailspike.net',
'zebl.zoneedit.com',
'zen.spamhaus.org',
'zombie.dnsbl.sorbs.net', 'zombie.dnsbl.sorbs.net',
'zta.birdsong.org',
'ztl.dorkslayers.com',
'zz.countries.nerd.dk'
] ]
async def check_dnsbl(ip, dnsbl): async def check_dnsbl(ip: str, dnsbl: str, semaphore: asyncio.Semaphore):
reversed_ip = ipaddress.ip_address(ip).reverse_pointer '''
Check if an IP address is blacklisted on a DNSBL.
:param ip: IP address to check.
:param dnsbl: DNSBL to check.
:param semaphore: Semaphore to limit the number of concurrent requests.
'''
async with semaphore:
reversed_ip = '.'.join(reversed(ip.split('.')))
try:
resolver = aiodns.DNSResolver()
lookup = f'{reversed_ip}.{dnsbl}'
for item in await resolver.query(lookup, 'TXT'):
response = await resolver.query(lookup, 'A')
if response:
print(f'{GREEN}{ip} is blacklisted on {dnsbl}: {response[0].host}{RESET}')
else:
if args.verbose:
print(f'{RED}{ip} has no reply from {dnsbl}{RESET}')
except aiodns.error.DNSError as e:
if args.verbose:
if e.args[0] == 4:
print(f'{GREY}{ip} is not blacklisted on {dnsbl}{RESET}')
else:
print(f'{RED}{ip} errored on {dnsbl} with {lookup}: {e}{RESET}')
async def main(ip, concurrency):
semaphore = asyncio.Semaphore(concurrency)
tasks = [check_dnsbl(ip, dnsbl, semaphore) for dnsbl in DNSBL_LIST]
await asyncio.gather(*tasks)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='DNSBL Lookup Tool')
parser.add_argument('input', help='IP address or file with IP addresses')
parser.add_argument('-c', '--concurrency', type=int, default=50, help='Number of concurrent lookups')
parser.add_argument('-v', '--verbose', action='store_true', help='Enable verbose output')
args = parser.parse_args()
try: try:
resolver = aiodns.DNSResolver() ipaddress.ip_address(args.input)
lookup = f'{reversed_ip}.{dnsbl}' asyncio.run(main(args.input, args.concurrency))
await resolver.query(lookup, 'A')
except: except:
return None if os.path.isfile(args.input):
with open(args.input, 'r') as file:
async def main(ip): for line in file:
tasks = [check_dnsbl(ip, dnsbl) for dnsbl in DNSBL_LIST] ip = line.strip()
blacklisted_on = [res for res in await asyncio.gather(*tasks) if res] try:
if blacklisted_on: ipaddress.ip_address(ip)
print(f"{ip} is blacklisted on the following DNSBLs:") asyncio.run(main(args.input, args.concurrency))
for bl in blacklisted_on: except:
print(f"- {bl}") logging.warning(f'Invalid IP address: {ip}')
else: else:
print(f"{ip} is not blacklisted on any known DNSBLs.") raise SystemExit(f'Invalid IP address or file: {args.input}')
if __name__ == "__main__":
ip_address = input("Enter the IP address to check: ")
loop = asyncio.get_event_loop()
loop.run_until_complete(main(ip_address))

View File

@ -18,7 +18,7 @@ proxies = list()
def find_proxies(url: str) -> str: def find_proxies(url: str) -> str:
''' '''
Check a URL for IP:PORT proxies. Check a URL for IP:PORT proxies.
:param url: The URL to check for proxies. :param url: The URL to check for proxies.
''' '''
try: try:
@ -42,7 +42,7 @@ if __name__ == '__main__':
parser.add_argument('-c', '--concurrency', help='number of concurrent threads to use (default: 10)', default=10, type=int) parser.add_argument('-c', '--concurrency', help='number of concurrent threads to use (default: 10)', default=10, type=int)
args = parser.parse_args() args = parser.parse_args()
logging.basicConfig(format='%(level)s %(message)s', level=logging.INFO) logging.basicConfig(format='%(message)s', level=logging.INFO)
if not os.path.isfile(args.input): if not os.path.isfile(args.input):
if args.input.startswith('https://') or args.input.startswith('http://'): if args.input.startswith('https://') or args.input.startswith('http://'):
@ -50,7 +50,7 @@ if __name__ == '__main__':
proxy_sources = [args.input] proxy_sources = [args.input]
else: else:
logging.fatal('input file does not exist!') logging.fatal('input file does not exist!')
proxy_sources = open(args.input, 'r').read().split('\n') proxy_sources = open(args.input, 'r').read().split('\n')
if not proxy_sources: if not proxy_sources:
@ -61,7 +61,7 @@ if __name__ == '__main__':
with concurrent.futures.ThreadPoolExecutor(max_workers=args.concurrency) as executor: with concurrent.futures.ThreadPoolExecutor(max_workers=args.concurrency) as executor:
futures = [executor.submit(find_proxies, url) for url in proxy_sources] futures = [executor.submit(find_proxies, url) for url in proxy_sources]
concurrent.futures.wait(futures) concurrent.futures.wait(futures)
if proxies: if proxies:
logging.info('found \033[32m{len(proxies):,}\033[0m total proxies!') logging.info('found \033[32m{len(proxies):,}\033[0m total proxies!')
proxies.sort() proxies.sort()
@ -69,4 +69,4 @@ if __name__ == '__main__':
for proxy in proxies: for proxy in proxies:
output_file.write(proxy + '\n') output_file.write(proxy + '\n')
else: else:
logging.warning('no proxies found!') logging.warning('no proxies found!')