From 415d5df94ce6ed024302852dd3fca6bc07dcaf99 Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 13:51:26 +0200 Subject: First prettifications of Redis cached whois Signed-off-by: Georg --- config.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'config.py') diff --git a/config.py b/config.py index a3a96e9..4c4f08d 100644 --- a/config.py +++ b/config.py @@ -61,4 +61,53 @@ conf.registerGlobalValue(SnoParser, 'AutoVhost', conf.registerGlobalValue(SnoParser, 'preventHighlight', registry.Boolean(True, ("""Toggles in channel highlights with ZWSP"""))) +conf.registerGroup(SnoParser, 'whois') +conf.registerGlobalValue(SnoParser.whois, 'debug', + registry.Boolean('false', + """ + SnoParser: True: Very verbose console output. False: Mostly silent operation. + """ + , private=True +)) +conf.registerGroup(SnoParser.whois, 'redis') +conf.registerGlobalValue(SnoParser.whois.redis, 'host', + registry.String('127.0.0.1', + """ + Redis: IP address or hostname. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.whois.redis, 'port', + registry.String('6379', + """ + Redis: Port. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.whois.redis, 'username', + registry.String('', + """ + Redis: Username. This is optional and has not been tested. It is recommended to perform initial tests on a local instance with no username and password. + """ + , private=True +)) +conf.registerGlobalValue(SnoParser.whois.redis, 'password', + registry.String('', + """ + Redis: Password. This is optional and has not been tested. It is recommended to perform initial tests on a local instance with no username and password. + """ +)) +conf.registerGlobalValue(SnoParser.whois.redis, 'db', + registry.String('0', + """ + Redis: Database number. It is recommended to use a dedicated, isolated, Redis instance for SnoParser instead of using an existing one with a different database. + """ +)) +conf.registerGlobalValue(SnoParser.whois.redis, 'timeout', + registry.String('5', + """ + Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results. + """ +)) + # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: -- cgit v1.2.3 From a8665607bbef6f96955ef53e1c14a4aa85a1f8d8 Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 13:52:34 +0200 Subject: Adding name to license blocks Signed-off-by: Georg --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config.py') diff --git a/config.py b/config.py index 4c4f08d..3957a57 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2021, mogad0n +# Copyright (c) 2021, mogad0n and Georg Pfuetzenreuter # All rights reserved. # # Redistribution and use in source and binary forms, with or without -- cgit v1.2.3 From 7d9db9dd9d75b5a3aaff4617b95563125d9c1bdf Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 16:36:34 +0200 Subject: Moving Redis options to config values Signed-off-by: Georg --- config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'config.py') diff --git a/config.py b/config.py index 3957a57..cb1084a 100644 --- a/config.py +++ b/config.py @@ -78,7 +78,7 @@ conf.registerGlobalValue(SnoParser.whois.redis, 'host', , private=True )) conf.registerGlobalValue(SnoParser.whois.redis, 'port', - registry.String('6379', + registry.Integer('6379', """ Redis: Port. """ @@ -98,13 +98,13 @@ conf.registerGlobalValue(SnoParser.whois.redis, 'password', """ )) conf.registerGlobalValue(SnoParser.whois.redis, 'db', - registry.String('0', + registry.Integer('0', """ Redis: Database number. It is recommended to use a dedicated, isolated, Redis instance for SnoParser instead of using an existing one with a different database. """ )) conf.registerGlobalValue(SnoParser.whois.redis, 'timeout', - registry.String('5', + registry.Integer('5', """ Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results. """ -- cgit v1.2.3 From a458460cec77aceefdcd9b966e5c1813ea16c883 Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 16:58:04 +0200 Subject: Adding option for sample IP Signed-off-by: Georg --- config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'config.py') 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', -- cgit v1.2.3 From 78161bda7f95cfd72b1386ab7bb93c4aad7b741c Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 19:18:14 +0200 Subject: Added nickname and IP address counting Signed-off-by: Georg --- config.py | 66 +++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 19 deletions(-) (limited to 'config.py') diff --git a/config.py b/config.py index 9617979..983cb6d 100644 --- a/config.py +++ b/config.py @@ -61,62 +61,90 @@ conf.registerGlobalValue(SnoParser, 'AutoVhost', conf.registerGlobalValue(SnoParser, 'preventHighlight', registry.Boolean(True, ("""Toggles in channel highlights with ZWSP"""))) +conf.registerGlobalValue(SnoParser, 'debug', + registry.Boolean('false', + """ + SnoParser: Verbose output. Note: there is a seperate debug option for the `whois` client. + """ + , private=True +)) + ### -## WHOIS related settings below: +# REDIS related settings below: ### -conf.registerGroup(SnoParser, 'whois') -conf.registerGlobalValue(SnoParser.whois, 'debug', - registry.Boolean('false', +conf.registerGroup(SnoParser, 'redis') +conf.registerGlobalValue(SnoParser.redis, 'db1', + registry.Integer('1', """ - SnoParser: True: Very verbose console output. False: Mostly silent operation. + Redis: Database number for counting of NICKNAMES. """ , private=True )) -conf.registerGlobalValue(SnoParser.whois, 'sample', - registry.String('', +conf.registerGlobalValue(SnoParser.redis, 'db2', + registry.Integer('2', """ - 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! + Redis: Database number for counting of IP ADDRESSES. """ , private=True )) -conf.registerGroup(SnoParser.whois, 'redis') -conf.registerGlobalValue(SnoParser.whois.redis, 'host', +conf.registerGlobalValue(SnoParser.redis, 'host', registry.String('127.0.0.1', """ Redis: IP address or hostname. """ , private=True )) -conf.registerGlobalValue(SnoParser.whois.redis, 'port', +conf.registerGlobalValue(SnoParser.redis, 'port', registry.Integer('6379', """ Redis: Port. """ , private=True )) -conf.registerGlobalValue(SnoParser.whois.redis, 'username', +conf.registerGlobalValue(SnoParser.redis, 'username', registry.String('', """ Redis: Username. This is optional and has not been tested. It is recommended to perform initial tests on a local instance with no username and password. """ , private=True )) -conf.registerGlobalValue(SnoParser.whois.redis, 'password', +conf.registerGlobalValue(SnoParser.redis, 'password', registry.String('', """ Redis: Password. This is optional and has not been tested. It is recommended to perform initial tests on a local instance with no username and password. """ )) -conf.registerGlobalValue(SnoParser.whois.redis, 'db', - registry.Integer('0', +conf.registerGlobalValue(SnoParser.redis, 'timeout', + registry.Integer('5', """ - Redis: Database number. It is recommended to use a dedicated, isolated, Redis instance for SnoParser instead of using an existing one with a different database. + Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results. """ )) -conf.registerGlobalValue(SnoParser.whois.redis, 'timeout', - registry.Integer('5', + + +### +## WHOIS related settings below: +### +conf.registerGroup(SnoParser, 'whois') +conf.registerGlobalValue(SnoParser.whois, 'debug', + registry.Boolean('false', """ - Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results. + SnoParser: True: Very verbose console output. False: Mostly silent operation. + """ + , 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, 'db', + registry.Integer('0', + """ + Redis: Database number for WHOIS query caching. """ )) -- cgit v1.2.3 From c5a37126bc71f8330db54376f46d1ef0d5251c83 Mon Sep 17 00:00:00 2001 From: Georg Date: Thu, 26 Aug 2021 19:32:58 +0200 Subject: Improved `ipcounting` Signed-off-by: Georg --- config.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'config.py') diff --git a/config.py b/config.py index 983cb6d..90dd9c9 100644 --- a/config.py +++ b/config.py @@ -140,6 +140,13 @@ conf.registerGlobalValue(SnoParser.whois, 'sample', """ , private=True )) +conf.registerGlobalValue(SnoParser.whois, 'ttl', + registry.Integer('3600', + """ + SnoParser: How long to cache WHOIS entries for. + """ + , private=True +)) conf.registerGroup(SnoParser.whois, 'redis') conf.registerGlobalValue(SnoParser.whois.redis, 'db', registry.Integer('0', -- cgit v1.2.3 From 46596e0b33a9a5dc086028f8e0e023a4b599bc95 Mon Sep 17 00:00:00 2001 From: Georg Date: Tue, 31 Aug 2021 16:29:17 +0200 Subject: ipquery IP validation + repaired config integers Signed-off-by: Georg --- config.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'config.py') diff --git a/config.py b/config.py index 90dd9c9..5a9ebbd 100644 --- a/config.py +++ b/config.py @@ -74,14 +74,14 @@ conf.registerGlobalValue(SnoParser, 'debug', ### conf.registerGroup(SnoParser, 'redis') conf.registerGlobalValue(SnoParser.redis, 'db1', - registry.Integer('1', + registry.Integer(1, """ Redis: Database number for counting of NICKNAMES. """ , private=True )) conf.registerGlobalValue(SnoParser.redis, 'db2', - registry.Integer('2', + registry.Integer(2, """ Redis: Database number for counting of IP ADDRESSES. """ @@ -95,7 +95,7 @@ conf.registerGlobalValue(SnoParser.redis, 'host', , private=True )) conf.registerGlobalValue(SnoParser.redis, 'port', - registry.Integer('6379', + registry.Integer(6379, """ Redis: Port. """ @@ -115,7 +115,7 @@ conf.registerGlobalValue(SnoParser.redis, 'password', """ )) conf.registerGlobalValue(SnoParser.redis, 'timeout', - registry.Integer('5', + registry.Integer(5, """ Redis: Socket Timeout. The developer does not know what to recommend here, but `5` seems to yield good results. """ @@ -141,7 +141,7 @@ conf.registerGlobalValue(SnoParser.whois, 'sample', , private=True )) conf.registerGlobalValue(SnoParser.whois, 'ttl', - registry.Integer('3600', + registry.Integer(3600, """ SnoParser: How long to cache WHOIS entries for. """ @@ -149,7 +149,7 @@ conf.registerGlobalValue(SnoParser.whois, 'ttl', )) conf.registerGroup(SnoParser.whois, 'redis') conf.registerGlobalValue(SnoParser.whois.redis, 'db', - registry.Integer('0', + registry.Integer(0, """ Redis: Database number for WHOIS query caching. """ -- cgit v1.2.3 From ca02bba8c341b00973497e6f37a8ee34d75fcf0a Mon Sep 17 00:00:00 2001 From: Pratyush Desai Date: Tue, 7 Sep 2021 16:33:00 +0200 Subject: TargetChannel config + requirements.txt (#17) Added requirements.txt Updated configuration value errors Reviewed-on: https://git.com.de/LimnoriaPlugins/SnoParser/pulls/17 Co-authored-by: Pratyush Desai Co-committed-by: Pratyush Desai --- config.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'config.py') diff --git a/config.py b/config.py index 5a9ebbd..a585def 100644 --- a/config.py +++ b/config.py @@ -28,7 +28,7 @@ ### -from supybot import conf, registry +from supybot import conf, registry, ircutils try: from supybot.i18n import PluginInternationalization _ = PluginInternationalization('SnoParser') @@ -37,6 +37,12 @@ except: # without the i18n module _ = lambda x: x +class ValidChannel(registry.string): + """Value must be a valid channel""" + def setValue(self, v): + if not (ircutils.isChannel(v)): + self.error() + registry.String.setValue(self, v) def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -52,8 +58,8 @@ SnoParser = conf.registerPlugin('SnoParser') # conf.registerGlobalValue(SnoParser, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) -conf.registerGlobalValue(SnoParser, 'targetChannel', - registry.String(None, ("""Sends reformatted snolines to the """))) +conf.registerNetworkValue(SnoParser, 'targetChannel', ValidChannel, + ("", ("""Determines which channel the bot should send snolines"""))) conf.registerGlobalValue(SnoParser, 'AutoVhost', registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account"""))) -- cgit v1.2.3 From a321b6584d6dc11ed800cbceef3e68cbc63aac9a Mon Sep 17 00:00:00 2001 From: Georg Date: Sat, 11 Sep 2021 12:09:36 +0200 Subject: Disabling channel validation Signed-off-by: Georg --- config.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'config.py') diff --git a/config.py b/config.py index a585def..0e59428 100644 --- a/config.py +++ b/config.py @@ -37,12 +37,12 @@ except: # without the i18n module _ = lambda x: x -class ValidChannel(registry.string): - """Value must be a valid channel""" - def setValue(self, v): - if not (ircutils.isChannel(v)): - self.error() - registry.String.setValue(self, v) +#class ValidChannel(registry.string): +# """Value must be a valid channel""" +# def setValue(self, v): +# if not (ircutils.isChannel(v)): +# self.error() +# registry.String.setValue(self, v) def configure(advanced): # This will be called by supybot to configure this module. advanced is @@ -58,8 +58,8 @@ SnoParser = conf.registerPlugin('SnoParser') # conf.registerGlobalValue(SnoParser, 'someConfigVariableName', # registry.Boolean(False, _("""Help for someConfigVariableName."""))) -conf.registerNetworkValue(SnoParser, 'targetChannel', ValidChannel, - ("", ("""Determines which channel the bot should send snolines"""))) +#conf.registerNetworkValue(SnoParser, 'targetChannel', ValidChannel, +# ("", ("""Determines which channel the bot should send snolines"""))) conf.registerGlobalValue(SnoParser, 'AutoVhost', registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account"""))) -- cgit v1.2.3 From 8cacf16cb94920033b8d0c491eb7d931d552e98c Mon Sep 17 00:00:00 2001 From: Pratyush Desai Date: Sat, 16 Oct 2021 11:43:34 +0530 Subject: fix target chan issues Signed-off-by: Pratyush Desai --- config.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'config.py') diff --git a/config.py b/config.py index 0e59428..10df78b 100644 --- a/config.py +++ b/config.py @@ -61,6 +61,9 @@ SnoParser = conf.registerPlugin('SnoParser') #conf.registerNetworkValue(SnoParser, 'targetChannel', ValidChannel, # ("", ("""Determines which channel the bot should send snolines"""))) +conf.registerNetworkValue(SnoParser, 'targetChannel', + registry.String("", ("""Determines which channel the bot should snolines example: `#snotices`"""))) + conf.registerGlobalValue(SnoParser, 'AutoVhost', registry.String('libcasa/user/', ("""Configure the vhost eg. libcasa/user/$account"""))) -- cgit v1.2.3