proxytools/dnsbl.py

617 lines
18 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/env python
# DNSBL - Developed by acidvegas in Python (https://git.acid.vegas/proxytools)
import argparse
import asyncio
import ipaddress
import logging
import os
try:
import aiodns
except ImportError:
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 = [
'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',
'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.anti-spam.org.cn',
'cblless.anti-spam.org.cn',
'cblplus.anti-spam.org.cn',
'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-2.uceprotect.net',
'dnsbl-3.uceprotect.net',
'dnsbl.abuse.ch',
'dnsbl.anticaptcha.net',
'dnsbl.antispam.or.id',
'dnsbl.aspnet.hu',
'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.forefront.microsoft.com',
'dnsbl.httpbl.org',
'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.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',
'dronebl.noderebellion.net',
'dsn.bl.rfc-ignorant.de',
'dsn.rfc-clueless.org',
'dsn.rfc-ignorant.org',
'dssl.imrss.org',
'duinv.aupads.org',
'dul.blackhole.cantv.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',
'dynablock.easynet.nl',
'dynablock.sorbs.net',
'dynamic.dnsbl.rangers.eu.org',
'dyndns.rbl.jp',
'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.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',
'korea.rominet.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',
'osps.dnsbl.net.au',
'osrs.dnsbl.net.au',
'outputs.orbz.org',
'owfs.dnsbl.net.au',
'pacbelldsl.compu.net',
'paidaccessviarsync',
'pbl.spamhaus.org',
'pdl.bl.reynolds.net.au',
'peer.asn.cymru.com',
'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.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.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.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',
'recent.dnsbl.sorbs.net',
'recent.spam.dnsbl.sorbs.net',
'relayips.rbl.shub-inter.net',
'relays.bl.gweep.ca',
'relays.bl.kundenserver.de',
'relays.dnsbl.sorbs.net',
'relays.dorkslayers.com',
'relays.mail-abuse.org',
'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',
'rf.senderbase.org',
'rhsbl.rymsho.ru',
'rhsbl.scientificspam.net',
'rhsbl.sorbs.net',
'rhsbl.zapbl.net',
'ricn.dnsbl.net.au',
'ripe-main.bogons.dnsiplists.completewhois.com',
'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',
'socks.dnsbl.sorbs.net',
'sohul.habeas.com',
'sorbs.dnsbl.net.au',
'spam.abuse.ch',
'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.shri.net',
'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',
'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',
'taiwan.rominet.net',
'tor.dan.me.uk',
'tor.dnsbl.sectoor.de',
'tor.efnet.org',
'torexit.dan.me.uk',
'torserver.tor.dnsbl.sectoor.de',
'truncate.gbudb.net',
'trusted.nether.net',
'ubl.lashback.com',
'ubl.nszones.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.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',
'worms-bl.kundenserver.de',
'wpb.bl.reynolds.net.au',
'xbl.selwerd.cx',
'xbl.spamhaus.org',
'ybl.megacity.org',
'z.mailspike.net',
'zebl.zoneedit.com',
'zen.spamhaus.org',
'zombie.dnsbl.sorbs.net',
'zta.birdsong.org',
'ztl.dorkslayers.com',
'zz.countries.nerd.dk'
]
async def check_dnsbl(ip: str, dnsbl: str, semaphore: asyncio.Semaphore):
'''
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:
ipaddress.ip_address(args.input)
asyncio.run(main(args.input, args.concurrency))
except:
if os.path.isfile(args.input):
with open(args.input, 'r') as file:
for line in file:
ip = line.strip()
try:
ipaddress.ip_address(ip)
asyncio.run(main(args.input, args.concurrency))
except:
logging.warning(f'Invalid IP address: {ip}')
else:
raise SystemExit(f'Invalid IP address or file: {args.input}')