summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg2021-08-26 16:58:04 +0200
committerGeorg2021-08-26 16:58:04 +0200
commita458460cec77aceefdcd9b966e5c1813ea16c883 (patch)
treefb471dbb886e14b1b43793ee986c70d65b56a575
parent7d9db9dd9d75b5a3aaff4617b95563125d9c1bdf (diff)
downloadsnoparser-a458460cec77aceefdcd9b966e5c1813ea16c883.tar.gz
snoparser-a458460cec77aceefdcd9b966e5c1813ea16c883.tar.bz2
snoparser-a458460cec77aceefdcd9b966e5c1813ea16c883.zip
Adding option for sample IP
Signed-off-by: Georg <georg@lysergic.dev>
-rw-r--r--__pycache__/config.cpython-38.pycbin2233 -> 2453 bytes
-rw-r--r--__pycache__/plugin.cpython-38.pycbin8221 -> 8248 bytes
-rw-r--r--config.py10
-rw-r--r--plugin.py10
4 files changed, 16 insertions, 4 deletions
diff --git a/__pycache__/config.cpython-38.pyc b/__pycache__/config.cpython-38.pyc
index ee342f3..172cadd 100644
--- a/__pycache__/config.cpython-38.pyc
+++ b/__pycache__/config.cpython-38.pyc
Binary files differ
diff --git a/__pycache__/plugin.cpython-38.pyc b/__pycache__/plugin.cpython-38.pyc
index 37a61da..461f9d9 100644
--- a/__pycache__/plugin.cpython-38.pyc
+++ b/__pycache__/plugin.cpython-38.pyc
Binary files differ
diff --git a/config.py b/config.py
index cb1084a..9617979 100644
--- a/config.py
+++ b/config.py
@@ -61,6 +61,9 @@ conf.registerGlobalValue(SnoParser, 'AutoVhost',
conf.registerGlobalValue(SnoParser, 'preventHighlight',
registry.Boolean(True, ("""Toggles in channel highlights with ZWSP""")))
+###
+## WHOIS related settings below:
+###
conf.registerGroup(SnoParser, 'whois')
conf.registerGlobalValue(SnoParser.whois, 'debug',
registry.Boolean('false',
@@ -69,6 +72,13 @@ conf.registerGlobalValue(SnoParser.whois, 'debug',
"""
, 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.registerGlobalValue(SnoParser.whois.redis, 'host',
registry.String('127.0.0.1',
diff --git a/plugin.py b/plugin.py
index 39e2457..10eddb5 100644
--- a/plugin.py
+++ b/plugin.py
@@ -85,7 +85,7 @@ class SnoParser(callbacks.Plugin):
asn = whoisres['asn_registry']
country = whoisres['asn_country_code']
description = whoisres['asn_description']
- whoisout = 'WHOIS ' + asn + ' ' + country + ' ' + description
+ whoisout = '# ' + asn + ' ' + country + ' ' + description
except ipwhois.exceptions.IPDefinedError:
whoisout = 'RFC 4291 (Local)'
@@ -124,7 +124,7 @@ class SnoParser(callbacks.Plugin):
print("DEBUG - ELSE WHOIS_FRESH CALLED")
print(data)
print(sourceip)
- if data.startswith("WHOIS"):
+ if data.startswith("#"):
#data["cache"] = False
print("DEBUG - CACHE: FALSE")
data = json.dumps(data)
@@ -167,8 +167,10 @@ class SnoParser(callbacks.Plugin):
nickname = couple.group(1)
username = couple.group(2)
host = couple.group(3)
- #ip = couple.group(4)
- ip = '2a03:4000:55:d20::'
+ if self.registryValue('whois.sample'):
+ ip = self.registryValue('whois.sample')
+ else:
+ ip = couple.group(4)
realname = couple.group(5)
ip_seen = 0
nick_seen = 0