Browse Source

fix ss output

windows^2
Florian N 12 years ago
parent
commit
ffde36ff1d
  1. 3
      main/views.py
  2. 3
      templates/main.html

3
main/views.py

@ -299,12 +299,11 @@ def get_netstat():
Get ports and applications
"""
try:
pipe = os.popen("ss -tlnp | awk '{print $4, $5, $6}'")
pipe = os.popen("ss -tnp | grep ESTAB| awk '{print $4, $5}'")
data = pipe.read().strip().split('\n')
pipe.close()
data = [i.split(None, 3) for i in data]
del data[0]
except Exception, err:
data = str(err)

3
templates/main.html

@ -291,7 +291,6 @@
<tr>
<th>Local</th>
<th>Foreign</th>
<th>PID/Program Name</th>
</tr>
</thead>
<tbody id="get-netstat">
@ -412,7 +411,7 @@ dashboard.getNetstat = function() {
$.getJSON('/info/getnetstat/', function(data) {
var tr='';
$.each( data, function( index, item){
tr+='<tr><td>'+item[0]+'</td><td>'+item[1]+'</td><td>'+item[2]+'</td></tr>';
tr+='<tr><td>'+item[0]+'</td><td>'+item[1]+'</td></tr>';
})
tr+='';
$("#get-netstat").html( tr );

Loading…
Cancel
Save