From 6bbbca9bb98c8a3c37bfc8795048995c673b795a Mon Sep 17 00:00:00 2001
From: Thuban <thuban@yeuxdelibad.net>
Date: Mon, 26 Feb 2018 16:38:51 +0000
Subject: [PATCH] example config file installed

---
 vilainreport.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/vilainreport.py b/vilainreport.py
index 5a259dd..11a974f 100644
--- a/vilainreport.py
+++ b/vilainreport.py
@@ -1,8 +1,12 @@
 #!/usr/bin/env python3
 # -*- coding:Utf-8 -*-
+"""
+Author : Yax https://blogduyax.madyanne.fr/
+"""
 
 import re
 import sys
+import socket
 
 pattern = '(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+).*Blacklisting (\d+\.\d+\.\d+\.\d+), reason (.*), return'
 regex = re.compile(pattern)
@@ -120,4 +124,8 @@
 for k, v in tcounters.topitems():
     if v < 2:
         break
-    sys.stdout.write("IP {:16}: {}\n".format(k, v))
+    try:
+        ns = socket.gethostbyaddr(k.strip())[0]
+    except:
+        ns = '?'
+    sys.stdout.write("IP {:16}: {} - {}\n".format(k, v, ns))

--
Gitblit v1.9.3