forked from LimnoriaPlugins/SnoParser
Adding option for sample IP
Signed-off-by: Georg <georg@lysergic.dev>
This commit is contained in:
parent
7d9db9dd9d
commit
a458460cec
Binary file not shown.
Binary file not shown.
10
config.py
10
config.py
@ -61,6 +61,9 @@ conf.registerGlobalValue(SnoParser, 'AutoVhost',
|
|||||||
conf.registerGlobalValue(SnoParser, 'preventHighlight',
|
conf.registerGlobalValue(SnoParser, 'preventHighlight',
|
||||||
registry.Boolean(True, ("""Toggles in channel highlights with ZWSP""")))
|
registry.Boolean(True, ("""Toggles in channel highlights with ZWSP""")))
|
||||||
|
|
||||||
|
###
|
||||||
|
## WHOIS related settings below:
|
||||||
|
###
|
||||||
conf.registerGroup(SnoParser, 'whois')
|
conf.registerGroup(SnoParser, 'whois')
|
||||||
conf.registerGlobalValue(SnoParser.whois, 'debug',
|
conf.registerGlobalValue(SnoParser.whois, 'debug',
|
||||||
registry.Boolean('false',
|
registry.Boolean('false',
|
||||||
@ -69,6 +72,13 @@ conf.registerGlobalValue(SnoParser.whois, 'debug',
|
|||||||
"""
|
"""
|
||||||
, private=True
|
, private=True
|
||||||
))
|
))
|
||||||
|
conf.registerGlobalValue(SnoParser.whois, 'sample',
|
||||||
|
registry.String('',
|
||||||
|
"""
|
||||||
|
SnoParser: This allows to set a testing IP address, if the plugin shall be evaluated on i.e. a local network. This will override all IP addresses from SNOTICES!
|
||||||
|
"""
|
||||||
|
, private=True
|
||||||
|
))
|
||||||
conf.registerGroup(SnoParser.whois, 'redis')
|
conf.registerGroup(SnoParser.whois, 'redis')
|
||||||
conf.registerGlobalValue(SnoParser.whois.redis, 'host',
|
conf.registerGlobalValue(SnoParser.whois.redis, 'host',
|
||||||
registry.String('127.0.0.1',
|
registry.String('127.0.0.1',
|
||||||
|
10
plugin.py
10
plugin.py
@ -85,7 +85,7 @@ class SnoParser(callbacks.Plugin):
|
|||||||
asn = whoisres['asn_registry']
|
asn = whoisres['asn_registry']
|
||||||
country = whoisres['asn_country_code']
|
country = whoisres['asn_country_code']
|
||||||
description = whoisres['asn_description']
|
description = whoisres['asn_description']
|
||||||
whoisout = 'WHOIS ' + asn + ' ' + country + ' ' + description
|
whoisout = '# ' + asn + ' ' + country + ' ' + description
|
||||||
except ipwhois.exceptions.IPDefinedError:
|
except ipwhois.exceptions.IPDefinedError:
|
||||||
whoisout = 'RFC 4291 (Local)'
|
whoisout = 'RFC 4291 (Local)'
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ class SnoParser(callbacks.Plugin):
|
|||||||
print("DEBUG - ELSE WHOIS_FRESH CALLED")
|
print("DEBUG - ELSE WHOIS_FRESH CALLED")
|
||||||
print(data)
|
print(data)
|
||||||
print(sourceip)
|
print(sourceip)
|
||||||
if data.startswith("WHOIS"):
|
if data.startswith("#"):
|
||||||
#data["cache"] = False
|
#data["cache"] = False
|
||||||
print("DEBUG - CACHE: FALSE")
|
print("DEBUG - CACHE: FALSE")
|
||||||
data = json.dumps(data)
|
data = json.dumps(data)
|
||||||
@ -167,8 +167,10 @@ class SnoParser(callbacks.Plugin):
|
|||||||
nickname = couple.group(1)
|
nickname = couple.group(1)
|
||||||
username = couple.group(2)
|
username = couple.group(2)
|
||||||
host = couple.group(3)
|
host = couple.group(3)
|
||||||
#ip = couple.group(4)
|
if self.registryValue('whois.sample'):
|
||||||
ip = '2a03:4000:55:d20::'
|
ip = self.registryValue('whois.sample')
|
||||||
|
else:
|
||||||
|
ip = couple.group(4)
|
||||||
realname = couple.group(5)
|
realname = couple.group(5)
|
||||||
ip_seen = 0
|
ip_seen = 0
|
||||||
nick_seen = 0
|
nick_seen = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user