mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-23 18:54:05 +01:00
servprotect: only track kills and saves to PyLink clients
why wasn't this done before...
This commit is contained in:
parent
ead20f5be9
commit
76ecc60675
@ -17,12 +17,14 @@ def handle_kill(irc, numeric, command, args):
|
|||||||
Tracks kills against PyLink clients. If too many are received,
|
Tracks kills against PyLink clients. If too many are received,
|
||||||
automatically disconnects from the network.
|
automatically disconnects from the network.
|
||||||
"""
|
"""
|
||||||
if killcache.setdefault(irc.name, 1) >= length:
|
|
||||||
log.error('(%s) servprotect: Too many kills received, aborting!', irc.name)
|
|
||||||
irc.disconnect()
|
|
||||||
|
|
||||||
log.debug('(%s) servprotect: Incrementing killcache by 1', irc.name)
|
if (args['userdata'] and irc.isInternalServer(args['userdata'].server)) or irc.isInternalClient(args['target']):
|
||||||
killcache[irc.name] += 1
|
if killcache.setdefault(irc.name, 1) >= length:
|
||||||
|
log.error('(%s) servprotect: Too many kills received, aborting!', irc.name)
|
||||||
|
irc.disconnect()
|
||||||
|
|
||||||
|
log.debug('(%s) servprotect: Incrementing killcache by 1', irc.name)
|
||||||
|
killcache[irc.name] += 1
|
||||||
|
|
||||||
utils.add_hook(handle_kill, 'KILL')
|
utils.add_hook(handle_kill, 'KILL')
|
||||||
|
|
||||||
@ -31,11 +33,12 @@ def handle_save(irc, numeric, command, args):
|
|||||||
Tracks SAVEs (nick collision) against PyLink clients. If too many are received,
|
Tracks SAVEs (nick collision) against PyLink clients. If too many are received,
|
||||||
automatically disconnects from the network.
|
automatically disconnects from the network.
|
||||||
"""
|
"""
|
||||||
if savecache.setdefault(irc.name, 0) >= length:
|
if irc.isInternalClient(args['target']):
|
||||||
log.error('(%s) servprotect: Too many nick collisions, aborting!', irc.name)
|
if savecache.setdefault(irc.name, 0) >= length:
|
||||||
irc.disconnect()
|
log.error('(%s) servprotect: Too many nick collisions, aborting!', irc.name)
|
||||||
|
irc.disconnect()
|
||||||
|
|
||||||
log.debug('(%s) servprotect: Incrementing savecache by 1', irc.name)
|
log.debug('(%s) servprotect: Incrementing savecache by 1', irc.name)
|
||||||
savecache[irc.name] += 1
|
savecache[irc.name] += 1
|
||||||
|
|
||||||
utils.add_hook(handle_save, 'SAVE')
|
utils.add_hook(handle_save, 'SAVE')
|
||||||
|
Loading…
Reference in New Issue
Block a user