proxytools- collection of scripts for harvesting & testing proxies |
git clone git://git.acid.vegas/proxytools.git |
Log | Files | Refs | Archive | README | LICENSE |
dnsbl.py (17933B)
1 #!/usr/bin/env python 2 # DNSBL - Developed by acidvegas in Python (https://git.acid.vegas/proxytools) 3 4 import argparse 5 import asyncio 6 import ipaddress 7 import logging 8 import os 9 10 try: 11 import aiodns 12 except ImportError: 13 raise SystemExit('missing required library \'aiodns\' (https://pypi.org/project/aiodns/)') 14 15 # ANSI color codes 16 RED = '\033[91m' 17 GREEN = '\033[92m' 18 GREY = '\033[90m' 19 RESET = '\033[0m' 20 21 DNSBL_LIST = [ 22 '0outspam.fusionzero.com', 23 '0spam-killlist.fusionzero.com', 24 '0spam.fusionzero.com', 25 '0spamtrust.fusionzero.com', 26 '0spamurl.fusionzero.com', 27 '3y.spam.mrs.kithrup.com', 28 '88.blocklist.zap', 29 'abuse-contacts.abusix.org', 30 'abuse.rfc-clueless.org', 31 'abuse.rfc-ignorant.org', 32 'access.atlbl.net', 33 'access.redhawk.org', 34 'accredit.habeas.com', 35 'admin.bl.kundenserver.de', 36 'all.ascc.dnsbl.bit.nl', 37 'all.dnsbl.bit.nl', 38 'all.rbl.jp', 39 'all.rbl.webiron.net', 40 'all.s5h.net', 41 'all.spam-rbl.fr', 42 'all.spamblock.unit.liu.se', 43 'all.spamrats.com', 44 'all.v6.ascc.dnsbl.bit.nl', 45 'apnic-main.bogons.dnsiplists.completewhois.com', 46 'arin-legacy-classb.bogons.dnsiplists.completewhois.com', 47 'arin-legacy-classc.bogons.dnsiplists.completewhois.com', 48 'arin-main.bogons.dnsiplists.completewhois.com', 49 'asiaspam.spamblocked.com', 50 'asn.routeviews.org', 51 'aspath.routeviews.org', 52 'aspews.dnsbl.sorbs.net', 53 'aspews.ext.sorbs.net', 54 'assholes.madscience.nl', 55 'auth.spamrats.com', 56 'autowork.drbl.ks.cz', 57 'b.barracudacentral.org', 58 'babl.rbl.webiron.net', 59 'backscatter.spameatingmonkey.net', 60 'bad.psky.me', 61 'badconf.rhsbl.sorbs.net', 62 'badnets.spameatingmonkey.net', 63 'ban.zebl.zoneedit.com', 64 'bandwidth-pigs.monkeys.com', 65 'bb.barracudacentral.org', 66 'bitonly.dnsbl.bit.nl', 67 'bl.blocklist.de', 68 'bl.blueshore.net', 69 'bl.borderworlds.dk', 70 'bl.deadbeef.com', 71 'bl.drmx.org', 72 'bl.emailbasura.org', 73 'bl.fmb.la', 74 'bl.ipv6.spameatingmonkey.net', 75 'bl.konstant.no', 76 'bl.mailspike.net', 77 'bl.mailspike.org', 78 'bl.mav.com.br', 79 'bl.mipspace.com', 80 'bl.nszones.com', 81 'bl.rbl-dns.com', 82 'bl.reynolds.net.au', 83 'bl.scientificspam.net', 84 'bl.score.senderscore.com', 85 'bl.shlink.org', 86 'bl.shlink.orgdul.ru', 87 'bl.spamcannibal.org', 88 'bl.spamcop.net', 89 'bl.spameatingmonkey.net', 90 'bl.spamstinks.com', 91 'bl.spamthwart.com', 92 'bl.student.pw.edu.pl', 93 'bl.suomispam.net', 94 'bl.tiopan.com', 95 'bl.tolkien.dk', 96 'black.junkemailfilter.com', 97 'blackhole.compu.net', 98 'blackholes.brainerd.net', 99 'blackholes.easynet.nl', 100 'blackholes.five-ten-sg.com', 101 'blackholes.mail-abuse.org', 102 'blackholes.sandes.dk', 103 'blacklist.fpsn.net', 104 'blacklist.hostkarma.com', 105 'blacklist.informationwave.net', 106 'blacklist.mail.ops.asp.att.net', 107 'blacklist.mailrelay.att.net', 108 'blacklist.sci.kun.nl', 109 'blacklist.sci.ru.nl', 110 'blacklist.sequoia.ops.asp.att.net', 111 'blacklist.woody.ch', 112 'block.ascams.com', 113 'block.blars.org', 114 'block.dnsbl.sorbs.net', 115 'blocked.asgardnet.org', 116 'blocked.hilli.dk', 117 'blocklist.squawk.com', 118 'blocklist2.squawk.com', 119 'bogon.lbl.lagengymnastik.dk', 120 'bogons.cymru.com', 121 'bogons.dnsiplists.completewhois.com', 122 'bogusmx.rfc-clueless.org', 123 'bogusmx.rfc-ignorant.org', 124 'bsb.empty.us', 125 'bsb.spamlookup.net', 126 'cabl.rbl.webiron.net', 127 'cart00ney.surriel.com', 128 'catchspam.com', 129 'cbl.abuseat.org', 130 'cbl.anti-spam.org.cn', 131 'cblless.anti-spam.org.cn', 132 'cblplus.anti-spam.org.cn', 133 'ccess.redhawk.org', 134 'cdl.anti-spam.org.cn', 135 'china.rominet.net', 136 'cidr.bl.mcafee.com', 137 'client-domain.sjesl.monkeys.com', 138 'cml.anti-spam.org.cn', 139 'combined-hib.dnsiplists.completewhois.com', 140 'combined.abuse.ch', 141 'combined.njabl.org', 142 'combined.rbl.msrbl.net', 143 'communicado.fmb.la', 144 'contacts.abuse.net', 145 'country-rirdata.dnsiplists.completewhois.com', 146 'crawler.rbl.webiron.net', 147 'csi.cloudmark.com', 148 'czdynamic.drbl.ks.cz', 149 'db.rurbl.ru', 150 'db.wpbl.info', 151 'dbl.spamhaus.org', 152 'dbl.suomispam.net', 153 'dev.null.dk', 154 'devnull.drbl.be.net.ru', 155 'dialup.blacklist.jippg.org', 156 'dialup.drbl.sandy.ru', 157 'dialups.mail-abuse.org', 158 'dialups.visi.com', 159 'dnsbl-0.uceprotect.net', 160 'dnsbl-1.uceprotect.net', 161 'dnsbl-2.uceprotect.net', 162 'dnsbl-3.uceprotect.net', 163 'dnsbl.abuse.ch', 164 'dnsbl.anticaptcha.net', 165 'dnsbl.antispam.or.id', 166 'dnsbl.aspnet.hu', 167 'dnsbl.calivent.com.pe', 168 'dnsbl.cbn.net.id', 169 'dnsbl.clue-by-4.org', 170 'dnsbl.cobion.com', 171 'dnsbl.cyberlogic.net', 172 'dnsbl.delink.net', 173 'dnsbl.dronebl.org', 174 'dnsbl.forefront.microsoft.com', 175 'dnsbl.httpbl.org', 176 'dnsbl.inps.de', 177 'dnsbl.ioerror.us', 178 'dnsbl.justspam.org', 179 'dnsbl.kempt.net', 180 'dnsbl.madavi.de', 181 'dnsbl.mags.net', 182 'dnsbl.mailshell.net', 183 'dnsbl.mcu.edu.tw', 184 'dnsbl.net.ua', 185 'dnsbl.njabl.org', 186 'dnsbl.pagedirect.net', 187 'dnsbl.proxybl.org', 188 'dnsbl.rangers.eu.org', 189 'dnsbl.rizon.net', 190 'dnsbl.rv-soft.info', 191 'dnsbl.rymsho.ru', 192 'dnsbl.sorbs.net', 193 'dnsbl.spam-champuru.livedoor.com', 194 'dnsbl.spfbl.net', 195 'dnsbl.technoirc.org', 196 'dnsbl.tornevall.org', 197 'dnsbl.webequipped.com', 198 'dnsbl.wpbl.pc9.org', 199 'dnsbl.zapbl.net', 200 'dnsbl6.anticaptcha.net', 201 'dnsblchile.org', 202 'dnsrbl.org', 203 'dnsrbl.swinog.ch', 204 'dnswl.inps.de', 205 'dnswl.leisi.net', 206 'dob.sibl.support-intelligence.net', 207 'drone.abuse.ch', 208 'dronebl.noderebellion.net', 209 'dsn.bl.rfc-ignorant.de', 210 'dsn.rfc-clueless.org', 211 'dsn.rfc-ignorant.org', 212 'dssl.imrss.org', 213 'duinv.aupads.org', 214 'dul.blackhole.cantv.net', 215 'dul.dnsbl.sorbs.net', 216 'dul.dnsbl.sorbs.netdul.ru', 217 'dul.orca.bc.ca', 218 'dul.pacifier.net', 219 'dul.ru', 220 'dyn.nszones.com', 221 'dyna.spamrats.com', 222 'dynablock.easynet.nl', 223 'dynablock.sorbs.net', 224 'dynamic.dnsbl.rangers.eu.org', 225 'dyndns.rbl.jp', 226 'dynip.rothen.com', 227 'elitist.rfc-clueless.org', 228 'endn.bl.reynolds.net.au', 229 'escalations.dnsbl.sorbs.net', 230 'eswlrev.dnsbl.rediris.es', 231 'eurospam.spamblocked.com', 232 'ex.dnsbl.org', 233 'exitnodes.tor.dnsbl.sectoor.de', 234 'exitnodes.tor.dnsbl.sectoor.dehttp.dnsbl.sorbs.net', 235 'feb.spamlab.com', 236 'fnrbl.fast.net', 237 'forbidden.icm.edu.pl', 238 'formmail.relays.monkeys.com', 239 'free.v4bl.org', 240 'fresh.dict.rbl.arix.com', 241 'fresh.sa_slip.rbl.arix.com', 242 'fresh.spameatingmonkey.net', 243 'fresh10.spameatingmonkey.net', 244 'fresh15.spameatingmonkey.net', 245 'fulldom.rfc-clueless.org', 246 'geobl.spameatingmonkey.net', 247 'gl.suomispam.net', 248 'hbl.atlbl.net', 249 'helo-domain.sjesl.monkeys.com', 250 'hijacked.dnsiplists.completewhois.com', 251 'hil.habeas.com', 252 'hong-kong.rominet.net', 253 'hostkarma.junkemailfilter.com', 254 'hostkarma.junkemailfilter.com[brl]', 255 'http.dnsbl.sorbs.net', 256 'httpbl.abuse.ch', 257 'hul.habeas.com', 258 'iadb.isipp.com', 259 'iadb2.isipp.com', 260 'iana-classa.bogons.dnsiplists.completewhois.com', 261 'iddb.isipp.com', 262 'images.rbl.msrbl.net', 263 'in.dnsbl.org', 264 'inputs.orbz.org', 265 'intercept.datapacket.net', 266 'intruders.docs.uu.se', 267 'invalidipwhois.dnsiplists.completewhois.com', 268 'ip.v4bl.org', 269 'ipbl.zeustracker.abuse.ch', 270 'ips.backscatterer.org', 271 'ips.whitelisted.org', 272 'ipv6.all.dnsbl.bit.nl', 273 'ipv6.all.s5h.net', 274 'ipwhois.rfc-ignorant.org', 275 'is-tor.kewlio.net.uk', 276 'ispmx.pofon.foobar.hu', 277 'isps.spamblocked.com', 278 'ix.dnsbl.manitu.net', 279 'korea.rominet.net', 280 'korea.services.net', 281 'ksi.dnsbl.net.au', 282 'l1.apews.org', 283 'l1.apews.rhsbl.sorbs.net', 284 'l1.bbfh.ext.sorbs.net', 285 'l1.spews.dnsbl.sorbs.net', 286 'l2.apews.dnsbl.sorbs.net', 287 'l2.bbfh.ext.sorbs.net', 288 'l2.spews.dnsbl.sorbs.net', 289 'l3.bbfh.ext.sorbs.net', 290 'l4.bbfh.ext.sorbs.net', 291 'lacnic-main.bogons.dnsiplists.completewhois.com', 292 'lacnic.spamblocked.com', 293 'lame.dnsbl.rangers.eu.org', 294 'lbl.lagengymnastik.dk', 295 'list.anonwhois.net', 296 'list.bbfh.org', 297 'list.blogspambl.com', 298 'list.dnswl.org', 299 'list.quorum.to', 300 'mail-abuse.blacklist.jippg.org', 301 'mail.people.it', 302 'manual.orbz.gst-group.co.uk', 303 'misc.dnsbl.sorbs.net', 304 'mr-out.imrss.org', 305 'msgid.bl.gweep.ca', 306 'mtawlrev.dnsbl.rediris.es', 307 'multi.surbl.org', 308 'multi.uribl.com', 309 'netbl.spameatingmonkey.net', 310 'netblock.pedantic.org', 311 'netblockbl.spamgrouper.com', 312 'netblockbl.spamgrouper.to', 313 'netscan.rbl.blockedservers.com', 314 'new.dnsbl.sorbs.net', 315 'new.spam.dnsbl.sorbs.net', 316 'nml.mail-abuse.org', 317 'no-more-funn.moensted.dk', 318 'nobl.junkemailfilter.com', 319 'nomail.rhsbl.sorbs.net', 320 'noptr.spamrats.com', 321 'noservers.dnsbl.sorbs.net', 322 'nospam.ant.pl', 323 'nsbl.fmb.la', 324 'old.dnsbl.sorbs.net', 325 'old.spam.dnsbl.sorbs.net', 326 'omrs.dnsbl.net.au', 327 'opm.tornevall.org', 328 'orbs.dorkslayers.com', 329 'orbz.gst-group.co.uk', 330 'origin.asn.cymru.com', 331 'origin.asn.spameatingmonkey.net', 332 'origin6.asn.cymru.com', 333 'orvedb.aupads.org', 334 'osps.dnsbl.net.au', 335 'osrs.dnsbl.net.au', 336 'outputs.orbz.org', 337 'owfs.dnsbl.net.au', 338 'pacbelldsl.compu.net', 339 'paidaccessviarsync', 340 'pbl.spamhaus.org', 341 'pdl.bl.reynolds.net.au', 342 'peer.asn.cymru.com', 343 'phishing.rbl.msrbl.net', 344 'plus.bondedsender.org', 345 'pm0-no-more.compu.net', 346 'pofon.foobar.hu', 347 'policy.lbl.lagengymnastik.dk', 348 'postmaster.rfc-clueless.org', 349 'postmaster.rfc-ignorant.org', 350 'ppbl.beat.st', 351 'probes.dnsbl.net.au', 352 'probes.dnsbl.net.auproxy.bl.gweep.ca', 353 'problems.dnsbl.sorbs.net', 354 'proxies.blackholes.easynet.nl', 355 'proxies.dnsbl.sorbs.net', 356 'proxies.exsilia.net', 357 'proxies.relays.monkeys.com', 358 'proxy.bl.gweep.ca', 359 'proxy.block.transip.nl', 360 'proxy.drbl.be.net.ru', 361 'psbl.surriel.com', 362 'pss.spambusters.org.ar', 363 'q.mail-abuse.com', 364 'query.bondedsender.org', 365 'query.senderbase.org', 366 'r.mail-abuse.com', 367 'rabl.nuclearelephant.com', 368 'random.bl.gweep.ca', 369 'rbl-plus.mail-abuse.org', 370 'rbl.abuse.ro', 371 'rbl.atlbl.net', 372 'rbl.blakjak.net', 373 'rbl.blockedservers.com', 374 'rbl.bulkfeeds.jp', 375 'rbl.cbn.net.id', 376 'rbl.choon.net', 377 'rbl.dns-servicios.com', 378 'rbl.echelon.pl', 379 'rbl.efnet.org', 380 'rbl.efnethelp.net', 381 'rbl.efnetrbl.org', 382 'rbl.eznettools.com', 383 'rbl.fasthosts.co.uk', 384 'rbl.firstbase.com', 385 'rbl.init1.nl', 386 'rbl.interserver.net', 387 'rbl.iprange.net', 388 'rbl.ipv6wl.eu', 389 'rbl.jp', 390 'rbl.lugh.ch', 391 'rbl.ma.krakow.pl', 392 'rbl.mail-abuse.org', 393 'rbl.megarbl.net', 394 'rbl.ntvinet.net', 395 'rbl.pil.dk', 396 'rbl.polarcomm.net', 397 'rbl.rope.net', 398 'rbl.schulte.org', 399 'rbl.snark.net', 400 'rbl.spamlab.com', 401 'rbl.suresupport.com', 402 'rbl.talkactive.net', 403 'rbl.triumf.ca', 404 'rbl2.triumf.ca', 405 'rdts.bl.reynolds.net.au', 406 'rdts.dnsbl.net.au', 407 'recent.dnsbl.sorbs.net', 408 'recent.spam.dnsbl.sorbs.net', 409 'relayips.rbl.shub-inter.net', 410 'relays.bl.gweep.ca', 411 'relays.bl.kundenserver.de', 412 'relays.dnsbl.sorbs.net', 413 'relays.dorkslayers.com', 414 'relays.mail-abuse.org', 415 'relays.nether.net', 416 'relays.radparker.com', 417 'relays.sandes.dk', 418 'relaywatcher.n13mbl.com', 419 'rep.mailspike.net', 420 'reputation-domain.rbl.scrolloutf1.com', 421 'reputation-ip.rbl.scrolloutf1.com', 422 'reputation-ns.rbl.scrolloutf1.com', 423 'residential.block.transip.nl', 424 'rf.senderbase.org', 425 'rhsbl.rymsho.ru', 426 'rhsbl.scientificspam.net', 427 'rhsbl.sorbs.net', 428 'rhsbl.zapbl.net', 429 'ricn.dnsbl.net.au', 430 'ripe-main.bogons.dnsiplists.completewhois.com', 431 'rmst.dnsbl.net.au', 432 'rot.blackhole.cantv.net', 433 'rsbl.aupads.org', 434 'rwl.choon.net', 435 'sa-accredit.habeas.com', 436 'sa.senderbase.org', 437 'safe.dnsbl.sorbs.net', 438 'sbl-xbl.spamhaus.org', 439 'sbl.nszones.com', 440 'sbl.spamhaus.org', 441 'schizo-bl.kundenserver.de', 442 'score.senderscore.com', 443 'sender-address.sjesl.monkeys.com', 444 'sender-domain-validate.sjesl.monkeys.com', 445 'sender-domain.sjesl.monkeys.com', 446 'service.mailwhitelist.com', 447 'short.fmb.la', 448 'short.rbl.jp', 449 'singlebl.spamgrouper.com', 450 'singular.ttk.pte.hu', 451 'smtp.dnsbl.sorbs.net', 452 'socks.dnsbl.sorbs.net', 453 'sohul.habeas.com', 454 'sorbs.dnsbl.net.au', 455 'spam.abuse.ch', 456 'spam.dnsbl.anonmails.de', 457 'spam.dnsbl.rangers.eu.org', 458 'spam.dnsbl.sorbs.net', 459 'spam.exsilia.net', 460 'spam.lbl.lagengymnastik.dk', 461 'spam.olsentech.net', 462 'spam.pedantic.org', 463 'spam.rbl.blockedservers.com', 464 'spam.rbl.msrbl.net', 465 'spam.shri.net', 466 'spam.spamrats.com', 467 'spam.wonk.org', 468 'spam.wytnij.to', 469 'spam.zapjunk.com', 470 'spamblock.kundenserver.de', 471 'spambot.bls.digibase.ca', 472 'spamdomain.block.transip.nl', 473 'spamdomains.blackholes.easynet.nl', 474 'spamguard.leadmon.net', 475 'spamips.rbl.shub-inter.net', 476 'spamlist.or.kr', 477 'spamrbl.imp.ch', 478 'spamsource.block.transip.nl', 479 'spamsources.fabel.dk', 480 'spamsources.spamblocked.com', 481 'spamsupport.dnsbl.rangers.eu.org', 482 'spbl.bl.winbots.org', 483 'spews.block.transip.nl', 484 'srn.surgate.net', 485 'srnblack.surgate.net', 486 'st.technovision.dk', 487 'stabl.rbl.webiron.net', 488 'stale.dict.rbl.arix.com', 489 'stale.sa_slip.arix.com', 490 'superblock.ascams.com', 491 'swl.spamhaus.org', 492 't3direct.dnsbl.net.au', 493 'taiwan.rominet.net', 494 'tor.dan.me.uk', 495 'tor.dnsbl.sectoor.de', 496 'tor.efnet.org', 497 'torexit.dan.me.uk', 498 'torserver.tor.dnsbl.sectoor.de', 499 'truncate.gbudb.net', 500 'trusted.nether.net', 501 'ubl.lashback.com', 502 'ubl.nszones.com', 503 'ubl.unsubscore.com', 504 'unsure.nether.net', 505 'uribl.abuse.ro', 506 'uribl.pofon.foobar.hu', 507 'uribl.spameatingmonkey.net', 508 'uribl.swinog.ch', 509 'uribl.zeustracker.abuse.ch', 510 'urired.spameatingmonkey.net', 511 'url.rbl.jp', 512 'v4.fullbogons.cymru.com', 513 'v6.fullbogons.cymru.com', 514 'vbl.mookystick.com', 515 'virbl.bit.nl', 516 'virbl.dnsbl.bit.nl', 517 'virus.rbl.jp', 518 'virus.rbl.msrbl.net', 519 'vote.drbl.be.net.ru', 520 'vote.drbl.caravan.ru', 521 'vote.drbl.croco.net', 522 'vote.drbl.dataforce.net', 523 'vote.drbl.gremlin.ru', 524 'vote.drbl.host.kz', 525 'vote.drbldf.dsbl.ru', 526 'vote.rbl.ntvinet.net', 527 'vouch.dwl.spamhaus.org', 528 'wadb.isipp.com', 529 'wbl.triumf.ca', 530 'wdl.bl.reynolds.net.au', 531 'web.dnsbl.sorbs.net', 532 'web.rbl.msrbl.net', 533 'whitelist.sci.kun.nl', 534 'whitelist.surriel.com', 535 'whois.rfc-clueless.org', 536 'whois.rfc-ignorant.org', 537 'wl.mailspike.net', 538 'wl.nszones.com', 539 'wl.shlink.org', 540 'wl.summersault.com', 541 'wl.trusted-forwarder.org', 542 'work.drbl.caravan.ru', 543 'work.drbl.croco.net', 544 'work.drbl.dataforce.net', 545 'work.drbl.gremlin.ru', 546 'work.drbl.host.kz', 547 'work.drbldf.dsbl.ru', 548 'worm.dnsbl.rangers.eu.org', 549 'wormrbl.imp.ch', 550 'worms-bl.kundenserver.de', 551 'wpb.bl.reynolds.net.au', 552 'xbl.selwerd.cx', 553 'xbl.spamhaus.org', 554 'ybl.megacity.org', 555 'z.mailspike.net', 556 'zebl.zoneedit.com', 557 'zen.spamhaus.org', 558 'zombie.dnsbl.sorbs.net', 559 'zta.birdsong.org', 560 'ztl.dorkslayers.com', 561 'zz.countries.nerd.dk' 562 ] 563 564 async def check_dnsbl(ip: str, dnsbl: str, semaphore: asyncio.Semaphore): 565 ''' 566 Check if an IP address is blacklisted on a DNSBL. 567 568 :param ip: IP address to check. 569 :param dnsbl: DNSBL to check. 570 :param semaphore: Semaphore to limit the number of concurrent requests. 571 ''' 572 async with semaphore: 573 reversed_ip = '.'.join(reversed(ip.split('.'))) 574 try: 575 resolver = aiodns.DNSResolver() 576 lookup = f'{reversed_ip}.{dnsbl}' 577 for item in await resolver.query(lookup, 'TXT'): 578 response = await resolver.query(lookup, 'A') 579 if response: 580 print(f'{GREEN}{ip} is blacklisted on {dnsbl}: {response[0].host}{RESET}') 581 else: 582 if args.verbose: 583 print(f'{RED}{ip} has no reply from {dnsbl}{RESET}') 584 except aiodns.error.DNSError as e: 585 if args.verbose: 586 if e.args[0] == 4: 587 print(f'{GREY}{ip} is not blacklisted on {dnsbl}{RESET}') 588 else: 589 print(f'{RED}{ip} errored on {dnsbl} with {lookup}: {e}{RESET}') 590 591 async def main(ip, concurrency): 592 semaphore = asyncio.Semaphore(concurrency) 593 tasks = [check_dnsbl(ip, dnsbl, semaphore) for dnsbl in DNSBL_LIST] 594 await asyncio.gather(*tasks) 595 596 if __name__ == '__main__': 597 parser = argparse.ArgumentParser(description='DNSBL Lookup Tool') 598 parser.add_argument('input', help='IP address or file with IP addresses') 599 parser.add_argument('-c', '--concurrency', type=int, default=50, help='Number of concurrent lookups') 600 parser.add_argument('-v', '--verbose', action='store_true', help='Enable verbose output') 601 args = parser.parse_args() 602 603 try: 604 ipaddress.ip_address(args.input) 605 asyncio.run(main(args.input, args.concurrency)) 606 except: 607 if os.path.isfile(args.input): 608 with open(args.input, 'r') as file: 609 for line in file: 610 ip = line.strip() 611 try: 612 ipaddress.ip_address(ip) 613 asyncio.run(main(args.input, args.concurrency)) 614 except: 615 logging.warning(f'Invalid IP address: {ip}') 616 else: 617 raise SystemExit(f'Invalid IP address or file: {args.input}')