mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-01-22 21:37:18 +01:00
update baddies detector
This commit is contained in:
parent
3bbbf26094
commit
d0e76fa6eb
|
@ -10,15 +10,14 @@ class BaddieProcessor:
|
|||
|
||||
|
||||
def hook(self, entry):
|
||||
now = datetime.datetime.now()
|
||||
for f in self._filters:
|
||||
if f.process(entry) is True:
|
||||
self.add_baddie(entry, 'detected by {}'.format(f.name))
|
||||
self.add_baddie(entry, 'detected by {} on {}'.format(f.name, now.strftime("%c").replace(":",'-')))
|
||||
|
||||
def add_baddie(self, entry, reason):
|
||||
addr = util.getaddress(entry)
|
||||
if addr not in self._baddies:
|
||||
self._baddies[addr] = ''
|
||||
self._baddies[addr] += reason + ' '
|
||||
addr = util.getaddress(entry).decode('ascii')
|
||||
self._baddies[addr] = reason
|
||||
|
||||
def write_blocklist(self, f):
|
||||
f.write('# baddies blocklist generated on {}\n'.format(datetime.datetime.now()))
|
||||
|
|
|
@ -5,7 +5,9 @@ def getaddress(info):
|
|||
for addr in info.addrs:
|
||||
opts = addr.options
|
||||
if b'host' in opts:
|
||||
return opts[b'host']
|
||||
h = opts[b'host']
|
||||
if b':' not in h:
|
||||
return h
|
||||
|
||||
def getcaps(info):
|
||||
"""
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[thresholds]
|
||||
max_floodfills_per_ip = 2
|
||||
max_floodfills_per_ip = 3
|
Loading…
Reference in a new issue