diff --git a/main/views.py b/main/views.py index 5878bd8..b59f2d6 100755 --- a/main/views.py +++ b/main/views.py @@ -255,7 +255,7 @@ def get_cpu_usage(): """ Get the CPU usage and running processes """ - try: + try: pipe = os.popen("ps aux --sort -%cpu,-rss") data = pipe.read().strip().split('\n') pipe.close() @@ -295,19 +295,25 @@ def get_load(): return data def get_netstat(): + """ + Get ports and applications + """ try: - pipe = os.popen("netstat -tlnp|grep LISTEN|awk '{print $4, $5, $7}'") + pipe = os.popen("netstat -tlnp |" + "grep 'LISTEN' |" + "awk '{print $4, $5, $7}'") data = pipe.read().strip().split('\n') pipe.close() + data = [i.split(None, 3) for i in data] + except Exception, err: data = str(err) + if data[0] == []: - data = [['No', 'data', 'available']] - #for i in data: - # temp = i.split() - # print temp[3] + temp[4] + data = [['No', 'data', 'available']] + return data + + @login_required(login_url='/login/') def getall(request): diff --git a/pydash/settings.py b/pydash/settings.py index 4e56a0a..0238db5 100644 --- a/pydash/settings.py +++ b/pydash/settings.py @@ -36,7 +36,7 @@ TIME_JS_REFRESH = 30000 TIME_JS_REFRESH_LONG = 120000 TIME_JS_REFRESH_NET = 2000 -VERSION = 1.2 +VERSION = 1.3 ALLOWED_HOSTS = ['*'] diff --git a/templates/main.html b/templates/main.html index f9bd6cd..edbbdc0 100644 --- a/templates/main.html +++ b/templates/main.html @@ -415,7 +415,6 @@ dashboard.getNetstat = function() { tr+='