From 3ef9e50e32995a248cab10cd991d4826eb510b49 Mon Sep 17 00:00:00 2001 From: Florian N Date: Tue, 18 Feb 2014 18:50:07 -0500 Subject: [PATCH] change ss data --- main/views.py | 4 ++-- templates/main.html | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/main/views.py b/main/views.py index ea74bdd..ec3b24f 100755 --- a/main/views.py +++ b/main/views.py @@ -299,11 +299,11 @@ def get_netstat(): Get ports and applications """ try: - pipe = os.popen("ss -tnp | grep ESTAB| awk '{print $4, $5}'") + pipe = os.popen("ss -tnp | grep ESTAB | awk '{print $4, $5}'| sed 's/::ffff://g' | awk -F: '{print $1, $2}' | sort -n | uniq -c") data = pipe.read().strip().split('\n') pipe.close() - data = [i.split(None, 3) for i in data] + data = [i.split(None, 4) for i in data] except Exception, err: data = str(err) diff --git a/templates/main.html b/templates/main.html index d69046a..2d54372 100644 --- a/templates/main.html +++ b/templates/main.html @@ -289,7 +289,9 @@ - + + + @@ -411,7 +413,7 @@ dashboard.getNetstat = function() { $.getJSON('/info/getnetstat/', function(data) { var tr=''; $.each( data, function( index, item){ - tr+=''; + tr+=''; }) tr+=''; $("#get-netstat").html( tr );
LocalCountLocal IPLocal Port Foreign
'+item[0]+''+item[1]+'
'+item[0]+''+item[1]+''+item[2]+''+item[3]+'