diff options
Diffstat (limited to '')
| -rwxr-xr-x | www/html/ip_destination.py (renamed from www/html/destination.py) | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/www/html/destination.py b/www/html/ip_destination.py index 062ab2f..f93b13d 100755 --- a/www/html/destination.py +++ b/www/html/ip_destination.py @@ -7,7 +7,9 @@ import socket def index(req): req.content_type="text/html" - + +#partie socket + #check si ip est bien la try: ip=req.form["ip"] @@ -22,6 +24,14 @@ def index(req): content=str() +#reverse dns + try: + rdns=socket.gethostbyaddr(ip)[0] + except socket.herror: + rdns="<em>Non connu</em>" + +#partie socket + #sql part conn=connexionBD() cur=conn.cursor() @@ -45,16 +55,18 @@ def index(req): content+=("""<tr>""" + """<td>""" + str(i[1]) + """</td>""" + """<td>""" + str(i[2]) + """</td>""" + -"""<td>""" + str(i[3]) + """</td>""" + -"""<td>""" + lien('destination.py?ip=' + str(i[4]), str(i[4])) + """</td>""" + -"""<td>""" + str(i[5]) + """</td>""" + -"""<td>""" + str(i[6]) + """</td>""" + +"""<td>""" + lien('ip_source.py?ip=' + str(i[3]), str(i[3])) + """</td>""" + +"""<td>""" + lien('ip_destination.py?ip=' + str(i[4]), str(i[4])) + """</td>""" + +"""<td>""" + lien('port_source.py?port=' + str(i[5]), str(i[5])) + """</td>""" + +"""<td>""" + lien('port_destination.py?port=' + str(i[6]), str(i[6])) + """</td>""" + """</tr>""") - + + #write the html page - req.write(baseHTML(ip,""" -<h1>IP Destination : """ + ip + """</h1> + req.write(baseHTML("ATS - " + ip,""" +<h1>IP destination : """ + ip + """</h1> <p>Nombre de paquets en destination de """+ ip + """ : <b>"""+ str(count[0])+ """</b></p> +<p>Reverse DNS : <b>"""+rdns+"""</b><p> <div id="tab"> <table class="data_tab"> <tr><th>Heure</th><th>Protocole</th><th>IP Source</th><th>IP Destination</th><th>Port Source</th><th>Port Destination</th></tr> |
