From a458460cec77aceefdcd9b966e5c1813ea16c883 Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 16:58:04 +0200 Subject: [PATCH] Adding option for sample IP Signed-off-by: Georg --- __pycache__/config.cpython-38.pyc | Bin 2233 -> 2453 bytes __pycache__/plugin.cpython-38.pyc | Bin 8221 -> 8248 bytes config.py | 10 ++++++++++ plugin.py | 10 ++++++---- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/__pycache__/config.cpython-38.pyc b/__pycache__/config.cpython-38.pyc index ee342f3ce1d412b456e0e698371a56d199263644..172cadd5c7b0679b0bf6d57baffefd77e68382db 100644 GIT binary patch delta 471 zcmZvWJ5Rz;6vulDA~Zar_!jk`D53^82Um4qL1NMU>N!B6w4}E{;vk>EMAEoJ;-V{) zo1eqaqR~;JR+M z1=uDCvVnt5!q$v3w#+mYH_{EZ9*^&(6W?u?Yeox zbuh?on^r9g#iL|AFXm3p)TFo4>G>Oj*(v5@31=>N b$nKoeU@8^}Gld11?2|wIU;b&Q7R-MG-p7I~ delta 227 zcmbO#yi<@bl$V!_0SJ=X)Ds^IPUMqeESac%Ae<+aBa1ghY#|dPLn`9}P7p7PFGW0+ zDT^ybB1JNVKSi{cc_A~3tQ1g|KSer42CJ+rNbh6^Mj5vSTq$xXiVK<0v@4}DE#Oa4 zPEo;-Q3cDWrKm$>QaFPdG&MFKVEoH8xtKMd=@!H0N34v@j8c=IaOg7@O%~x)VP@uG Job1l&2LNFOH@W}- diff --git a/__pycache__/plugin.cpython-38.pyc b/__pycache__/plugin.cpython-38.pyc index 37a61da964b9a05a366f15e0dfb8a293b4b12042..461f9d94d4d2abe8a7376f916948b79b5a7ea095 100644 GIT binary patch delta 974 zcmZ9KPfQa*6vp@MmTkM;?QWOtUkWXPK@zE&iYCMoP)sz@hNvVaTxdH*5Lj@*n2;$N zy_sm5OrjVe0S`z#7)>u6Ja{ni;N63F4_rN%=mC8@w4|_``SP1L-+TMsWY>pwhO{wF zQv`hAT~F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>>c=whdg2Pau)LjA!Zh z_++#MepWXNIt$L2xKZf#qxgGBa7g5Xyoh|rjeiJACg6+ RH+p;h2vr*=QVK%L{{f)f0PFw& 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