diff options
| author | Georg | 2021-08-26 19:32:58 +0200 |
|---|---|---|
| committer | Georg | 2021-08-26 19:32:58 +0200 |
| commit | c5a37126bc71f8330db54376f46d1ef0d5251c83 (patch) | |
| tree | 3f384814b97746182421fd18287722544eb8ded1 /plugin.py | |
| parent | 78161bda7f95cfd72b1386ab7bb93c4aad7b741c (diff) | |
| download | snoparser-c5a37126bc71f8330db54376f46d1ef0d5251c83.tar.gz snoparser-c5a37126bc71f8330db54376f46d1ef0d5251c83.tar.bz2 snoparser-c5a37126bc71f8330db54376f46d1ef0d5251c83.zip | |
Improved `ipcounting`
Signed-off-by: Georg <georg@lysergic.dev>
Diffstat (limited to 'plugin.py')
| -rw-r--r-- | plugin.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -141,7 +141,8 @@ class SnoParser(callbacks.Plugin): def whois_set_cache(self, key: str, value: str) -> bool: """Data to Redis.""" - state = self.redis_client_whois.setex(key, timedelta(seconds=3600), value=value,) + duration = self.registryValue('whois.ttl') + state = self.redis_client_whois.setex(key, timedelta(seconds=duration), value=value,) return state def whois_run(self, sourceip: str) -> dict: @@ -238,12 +239,13 @@ class SnoParser(callbacks.Plugin): """ data = self.whois_get_cache(key=ipaddress) - decoded = data.decode('utf-8') + decoded_data = data.decode('utf-8') ttl = self.redis_client_whois.ttl(ipaddress) count = self.redis_client_ips.get(ipaddress) + decoded_count = count.decode('utf-8') print('SnoParser manual query: ', data, ' ', ttl) - irc.reply(f'{decoded} - Count: {count} - Remaining: {ttl}s') + irc.reply(f'{decoded_data} - Count: {decoded_count} - Remaining: {ttl}s') ipquery = wrap(ipquery, ['anything']) |
