-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop #10
Open
fbrehm
wants to merge
2
commits into
master
Choose a base branch
from
develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+160
−100
Open
Develop #10
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ from pathlib import Path | |
|
||
import concurrent.futures | ||
|
||
__version__ = '0.3.0' | ||
__version__ = '0.4.0' | ||
__author__ = 'Frank Brehm <[email protected]>' | ||
|
||
MAX_TIMEOUT = 30 | ||
|
@@ -121,6 +121,34 @@ class RequestTimeoutError(MonitoringError, IOError): | |
super(RequestTimeoutError, self).__init__(errno.ETIMEDOUT, strerror) | ||
|
||
|
||
# ============================================================================= | ||
class ListFileOptionAction(argparse.Action): | ||
"""An argparse action for a RBL list file.""" | ||
|
||
# ------------------------------------------------------------------------- | ||
def __init__(self, option_strings, *args, **kwargs): | ||
"""Initialise a ListFileOptionAction object.""" | ||
super(ListFileOptionAction, self).__init__( | ||
option_strings=option_strings, *args, **kwargs) | ||
|
||
# ------------------------------------------------------------------------- | ||
def __call__(self, parser, namespace, values, option_string=None): | ||
"""Parse the configuration file option.""" | ||
if values is None: | ||
setattr(namespace, self.dest, None) | ||
return | ||
|
||
path = Path(values) | ||
if not path.exists(): | ||
msg = 'File {!r} does not exists.'.format(values) | ||
raise argparse.ArgumentError(self, msg) | ||
if not path.is_file(): | ||
msg = 'File {!r} is not a regular file.'.format(values) | ||
raise argparse.ArgumentError(self, msg) | ||
|
||
setattr(namespace, self.dest, path.resolve()) | ||
|
||
|
||
# ============================================================================= | ||
def constant(f): | ||
|
||
|
@@ -252,6 +280,8 @@ class CheckRblListsApp(object): | |
Domain Name System blocklist. | ||
""") | ||
|
||
default_listfile = Path(__file__).parent / 'rbl-serverlist.txt' | ||
|
||
# ------------------------------------------------------------------------- | ||
@classmethod | ||
def get_generic_appname(cls, appname=None): | ||
|
@@ -278,6 +308,8 @@ class CheckRblListsApp(object): | |
self.limit_warn = DEFAULT_LIMIT_WARN | ||
self.limit_crit = DEFAULT_LIMIT_CRIT | ||
|
||
self.listfile = self.default_listfile | ||
|
||
self.blacklists = [] | ||
self.records2check = [] | ||
self.host2check = None | ||
|
@@ -351,6 +383,14 @@ class CheckRblListsApp(object): | |
help='The hostname or the IP address to check for an entry in RBL lists.', | ||
) | ||
|
||
self.arg_parser.add_argument( | ||
'-L', '--listfile', metavar="FILE", dest='listfile', | ||
action=ListFileOptionAction, | ||
help=( | ||
'A file containing a list of RBLs, which shoud be checked. Default: ' | ||
'{!r}.').format(str(self.default_listfile)), | ||
) | ||
|
||
self.arg_parser.add_argument( | ||
"-h", "--help", action='help', dest='help', | ||
help='Show this help message and exit.' | ||
|
@@ -391,15 +431,17 @@ class CheckRblListsApp(object): | |
if self.args.parallel: | ||
self.parallel = self.args.parallel | ||
|
||
if self.args.listfile: | ||
self.listfile = self.args.listfile | ||
|
||
# ------------------------------------------------------------------------- | ||
def read_rbl_server_list(self): | ||
"""Reading the file with the list of the RBL servers.""" | ||
listfile = Path(__file__).parent / 'rbl-serverlist.txt' | ||
if not listfile.exists(): | ||
raise RuntimeError('File {!r} not found.'.format(str(listfile))) | ||
if not self.listfile.exists(): | ||
raise RuntimeError('File {!r} not found.'.format(str(self.listfile))) | ||
|
||
LOG.debug('Reading {!r} ...'.format(str(listfile))) | ||
with listfile.open('rt', encoding='utf-8') as fh: | ||
LOG.debug('Reading {!r} ...'.format(str(self.listfile))) | ||
with self.listfile.open('rt', encoding='utf-8') as fh: | ||
for line in fh.read().splitlines(): | ||
line = line.strip() | ||
if line == '' or line.startswith('#'): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,115 +1,133 @@ | ||
ohps.dnsbl.net.au | ||
omrs.dnsbl.net.au | ||
osps.dnsbl.net.au | ||
osrs.dnsbl.net.au | ||
owfs.dnsbl.net.au | ||
owps.dnsbl.net.au | ||
probes.dnsbl.net.au | ||
rdts.dnsbl.net.au | ||
ricn.dnsbl.net.au | ||
rmst.dnsbl.net.au | ||
t3direct.dnsbl.net.au | ||
|
||
fl.chickenboner.biz | ||
|
||
proxy.bl.gweep.ca | ||
relays.bl.gweep.ca | ||
|
||
combined.abuse.ch | ||
drone.abuse.ch | ||
spam.abuse.ch | ||
spamrbl.imp.ch | ||
wormrbl.imp.ch | ||
blacklist.woody.ch | ||
|
||
cdl.anti-spam.org.cn | ||
|
||
dnsbl.cobion.com | ||
bogons.cymru.com | ||
bl.deadbeef.com | ||
0spam.fusionzero.com | ||
access.redhawk.org | ||
all.rbl.webiron.net | ||
all.s5h.net | ||
bad.psky.me | ||
b.barracudacentral.org | ||
bhnc.njabl.org | ||
blackholes.five-ten-sg.com | ||
blackholes.mail-abuse.org | ||
blacklist.sci.kun.nl | ||
blacklist.woody.ch | ||
hil.habeas.com | ||
hostkarma.junkemailfilter.com | ||
ubl.lashback.com | ||
cidr.bl.mcafee.com | ||
rbl.orbitrbl.com | ||
rbl.realtimeblacklist.com | ||
dynip.rothen.com | ||
dyna.spamrats.com | ||
noptr.spamrats.com | ||
spam.spamrats.com | ||
psbl.surriel.com | ||
ubl.unsubscore.com | ||
|
||
bl.blocklist.de | ||
bl.deadbeef.com | ||
bl.emailbasura.org | ||
bl.mailspike.net | ||
bl.spamcannibal.org | ||
bl.spamcop.net | ||
bl.spameatingmonkey.net | ||
dnsbl.inps.de | ||
relays.bl.kundenserver.de | ||
tor.dnsbl.sectoor.de | ||
torserver.tor.dnsbl.sectoor.de | ||
|
||
spamsources.fabel.dk | ||
no-more-funn.moensted.dk | ||
bl.technovision.dk | ||
bogons.cymru.com | ||
cbl.abuseat.org | ||
cdl.anti-spam.org.cn | ||
cidr.bl.mcafee.com | ||
combined.abuse.ch | ||
combined.rbl.msrbl.net | ||
|
||
singular.ttk.pte.hu | ||
|
||
db.wpbl.info | ||
# dnsbl.ahbl.org | ||
dnsbl-1.uceprotect.net | ||
|
||
short.rbl.jp | ||
virus.rbl.jp | ||
|
||
spamlist.or.kr | ||
|
||
bad.psky.me | ||
|
||
dnsbl.anticaptcha.net | ||
dnsbl.cobion.com | ||
dnsbl.cyberlogic.net | ||
dnsbl.dronebl.org | ||
dnsbl.inps.de | ||
spamtrap.drbl.drand.net | ||
truncate.gbudb.net | ||
rbl.interserver.net | ||
dnsbl.kempt.net | ||
dnsbl.njabl.org | ||
spamguard.leadmon.net | ||
bl.mailspike.net | ||
ix.dnsbl.manitu.net | ||
rbl.megarbl.net | ||
combined.rbl.msrbl.net | ||
images.rbl.msrbl.net | ||
phishing.rbl.msrbl.net | ||
spam.rbl.msrbl.net | ||
virus.rbl.msrbl.net | ||
relays.nether.net | ||
all.s5h.net | ||
korea.services.net | ||
dnsbl.solid.net | ||
dnsbl.sorbs.net | ||
dnsrbl.org | ||
drone.abuse.ch | ||
duinv.aupads.org | ||
dul.dnsbl.sorbs.net | ||
dul.ru | ||
dyna.spamrats.com | ||
dynip.rothen.com | ||
fl.chickenboner.biz | ||
forbidden.icm.edu.pl | ||
hil.habeas.com | ||
http.dnsbl.sorbs.net | ||
hostkarma.junkemailfilter.com | ||
images.rbl.msrbl.net | ||
ips.backscatterer.org | ||
ix.dnsbl.manitu.net | ||
korea.services.net | ||
mail-abuse.blacklist.jippg.org | ||
misc.dnsbl.sorbs.net | ||
no-more-funn.moensted.dk | ||
noptr.spamrats.com | ||
ohps.dnsbl.net.au | ||
omrs.dnsbl.net.au | ||
orvedb.aupads.org | ||
osps.dnsbl.net.au | ||
osrs.dnsbl.net.au | ||
owfs.dnsbl.net.au | ||
owps.dnsbl.net.au | ||
# pbl.spamhaus.org | ||
phishing.rbl.msrbl.net | ||
probes.dnsbl.net.au | ||
proxy.bl.gweep.ca | ||
proxy.block.transip.nl | ||
psbl.surriel.com | ||
rbl.abuse.ro | ||
rbl.interserver.net | ||
rbl.megarbl.net | ||
rbl.orbitrbl.com | ||
rbl.realtimeblacklist.com | ||
rbl.schulte.org | ||
rdts.dnsbl.net.au | ||
relays.bl.gweep.ca | ||
relays.bl.kundenserver.de | ||
relays.nether.net | ||
residential.block.transip.nl | ||
ricn.dnsbl.net.au | ||
rmst.dnsbl.net.au | ||
# sbl.spamhaus.org | ||
# sbl-xbl.spamhaus.org | ||
short.rbl.jp | ||
singular.ttk.pte.hu | ||
smtp.dnsbl.sorbs.net | ||
socks.dnsbl.sorbs.net | ||
spam.abuse.ch | ||
spam.dnsbl.sorbs.net | ||
spamguard.leadmon.net | ||
spamlist.or.kr | ||
spamrbl.imp.ch | ||
spam.rbl.msrbl.net | ||
spamsources.fabel.dk | ||
spam.spamrats.com | ||
spamtrap.drbl.drand.net | ||
web.dnsbl.sorbs.net | ||
zombie.dnsbl.sorbs.net | ||
bl.spamcop.net | ||
bl.spameatingmonkey.net | ||
srnblack.surgate.net | ||
t3direct.dnsbl.net.au | ||
# tor.ahbl.org | ||
tor.dnsbl.sectoor.de | ||
torserver.tor.dnsbl.sectoor.de | ||
truncate.gbudb.net | ||
ubl.lashback.com | ||
ubl.unsubscore.com | ||
dnsbl-1.uceprotect.net | ||
all.rbl.webiron.net | ||
|
||
virbl.dnsbl.bit.nl | ||
virbl.bit.nl | ||
virus.rbl.jp | ||
virus.rbl.msrbl.net | ||
web.dnsbl.sorbs.net | ||
wormrbl.imp.ch | ||
blacklist.sci.kun.nl | ||
proxy.block.transip.nl | ||
residential.block.transip.nl | ||
|
||
cbl.abuseat.org | ||
# dnsbl.ahbl.org | ||
# tor.ahbl.org | ||
duinv.aupads.org | ||
orvedb.aupads.org | ||
ips.backscatterer.org | ||
b.barracudacentral.org | ||
dnsrbl.org | ||
dnsbl.dronebl.org | ||
bl.emailbasura.org | ||
mail-abuse.blacklist.jippg.org | ||
blackholes.mail-abuse.org | ||
bhnc.njabl.org | ||
dnsbl.njabl.org | ||
access.redhawk.org | ||
rbl.schulte.org | ||
l.spamcannibal.org | ||
# pbl.spamhaus.org | ||
# sbl.spamhaus.org | ||
# sbl-xbl.spamhaus.org | ||
# xbl.spamhaus.org | ||
zen.spamhaus.org | ||
zombie.dnsbl.sorbs.net | ||
|
||
forbidden.icm.edu.pl | ||
|
||
rbl.abuse.ro | ||
|
||
dul.ru |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would recommend to remove the file completely or reduce it to some useful example data. There are domain in there that does not even exist anymore.