From 15126d9a74187426eac0ee10e099166b371adb79 Mon Sep 17 00:00:00 2001
From: Thuban <thuban@yeuxdelibad.net>
Date: Sat, 16 Sep 2017 12:40:02 +0000
Subject: [PATCH] Merge branch 'develop' into 'master'

---
 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