From 7649d0304f234ad3a883a877f4f0cb7acc24f6f1 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 22 Feb 2014 16:25:14 -0500 Subject: [PATCH 01/16] small fix for ips --- main/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/views.py b/main/views.py index 71b7fb4..ba11243 100755 --- a/main/views.py +++ b/main/views.py @@ -71,12 +71,15 @@ def get_ipaddress(): Get the IP Address """ try: - pipe = os.popen(" ip addr | grep -A3 'LOWER_UP' | awk '{printf \"%s,\",$2}'|awk -F,, '{print $0}'") + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") data = pipe.read().strip().split(',,') pipe.close() - data = [n for n in data if not n.startswith(('lo', '127'))] data = [i.split(',', 4) for i in data] + if len(data) == 2: + del data[0] + if len(data) > 2: + data = data[1:-1] itf = [] for e in data: From 6ed4f3ee6e29eaf42f915c4a27330b72d73888d7 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 22 Feb 2014 16:49:27 -0500 Subject: [PATCH 02/16] small fix for arch --- main/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/views.py b/main/views.py index ba11243..e352373 100755 --- a/main/views.py +++ b/main/views.py @@ -71,7 +71,10 @@ def get_ipaddress(): Get the IP Address """ try: - pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") + if get_platform()['osname'] == "Linux": + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") + else: + pipe = os.popen("ip addr | grep -A3 'LOWER_UP' | awk '{if ($2 == \"forever\"){printf \"unavailable,,\"} else{ printf \"%s,\",$2}}'|awk -F,, '{print $0}'") data = pipe.read().strip().split(',,') pipe.close() From e4e387cfe280e55ac8a9ae0abd7e0563770ba893 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sun, 23 Feb 2014 13:10:51 -0500 Subject: [PATCH 03/16] fix #18 --- main/views.py | 7 +++++-- static/js/dashboard.js | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/main/views.py b/main/views.py index e352373..cee502a 100755 --- a/main/views.py +++ b/main/views.py @@ -129,8 +129,11 @@ def get_users(): data = pipe.read().strip().split('\n') pipe.close() - data = [i.split(None, 3) for i in data] - + if data == [""]: + data = None + else: + data = [i.split(None, 3) for i in data] + except Exception, err: data = str(err) diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 57c5d63..355e7a4 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -153,11 +153,14 @@ dashboard.getUsers = function() { { sTitle: "USER" }, { sTitle: "TTY" }, { sTitle: "LOOGED IN FROM", - sDefaultContent: "unavailable" } + sDefaultContent: "unavailable" } ], - bPaginate: false, - bFilter: true, - sDom: "lrtip", + aaSorting: [ + [0, "desc"] + ], + bPaginate: true, + sPaginationType: "two_button", + bFilter: false, bAutoWidth: false, bInfo: false }).fadeIn(); From 733399e6084aca123f915c9c2fcc911b597e509b Mon Sep 17 00:00:00 2001 From: Florian N Date: Mon, 24 Feb 2014 19:44:45 -0500 Subject: [PATCH 04/16] Update settings.py --- pydash/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydash/settings.py b/pydash/settings.py index 5e0d2e0..c4649df 100644 --- a/pydash/settings.py +++ b/pydash/settings.py @@ -19,7 +19,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '1)$crmowu-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3af' -#SECRET_KEY = '1)$-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3a9' + # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False From ba2544a9d769f30096c94ae2187aa6da474b79b9 Mon Sep 17 00:00:00 2001 From: Jordan Milne Date: Thu, 27 Feb 2014 15:38:38 -0400 Subject: [PATCH 05/16] Change eval(cookies) to json.loads(cookies) This fixes an RCE vulnerability in the cookie handling. If you rely on an attacker not being able to set cookies for security, you're going to have a bad time. Also, eval(cookies) will choke on valid JSON. See http://stackoverflow.com/a/1083302 --- usage/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usage/views.py b/usage/views.py index 33cdffc..7d896ba 100755 --- a/usage/views.py +++ b/usage/views.py @@ -244,7 +244,7 @@ def memusage(request): if not cookies: datasets.append(0) else: - datasets = eval(cookies) + datasets = json.loads(cookies) if len(datasets) > 10: while datasets: del datasets[0] @@ -303,7 +303,7 @@ def loadaverage(request): if not cookies: datasets.append(0) else: - datasets = eval(cookies) + datasets = json.loads(cookies) if len(datasets) > 10: while datasets: del datasets[0] @@ -375,7 +375,7 @@ def gettraffic(request): datasets_out.append(0) datasets_out_o.append(0) else: - datasets = eval(cookies) + datasets = json.loads(cookies) datasets_in = datasets[0] datasets_out = datasets[1] datasets_in_i = datasets[2] @@ -498,7 +498,7 @@ def getdiskio(request): datasets_out.append(0) datasets_out_o.append(0) else: - datasets = eval(cookies) + datasets = json.loads(cookies) datasets_in = datasets[0] datasets_out = datasets[1] datasets_in_i = datasets[2] From 17ac565e48af7c217090a364d9af2cdab818b397 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 1 Mar 2014 22:07:00 -0500 Subject: [PATCH 06/16] expand/collapse any table --- pydash/settings.py | 3 +-- static/css/style.css | 5 ----- static/js/dashboard.js | 9 +++++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pydash/settings.py b/pydash/settings.py index c4649df..8acb3a8 100644 --- a/pydash/settings.py +++ b/pydash/settings.py @@ -20,7 +20,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '1)$crmowu-23tz@i2-d=7tb3t+1u&(pm!lnjyuarki^72h!3af' - # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -37,7 +36,7 @@ TIME_JS_REFRESH = 30000 TIME_JS_REFRESH_LONG = 120000 TIME_JS_REFRESH_NET = 2000 -VERSION = 1.4 +VERSION = 1.4.1 ALLOWED_HOSTS = ['*'] diff --git a/static/css/style.css b/static/css/style.css index 42c55ff..ce10fee 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -410,12 +410,8 @@ textarea { .widget-content { padding: 20px 15px 15px; - background: #FFF; - - border: 1px solid #D5D5D5; - -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; @@ -423,7 +419,6 @@ textarea { .widget-header+.widget-content { border-top: none; - -webkit-border-top-left-radius: 0; -webkit-border-top-right-radius: 0; -moz-border-radius-topleft: 0; diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 355e7a4..7542790 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -250,3 +250,12 @@ dashboard.getIps = function() { }); } +//Expand-Collapse div/table +jQuery(document).ready(function() { + jQuery(".widget-content").show(); + //toggle the componenet with class msg_body + jQuery(".widget-header").click(function() + { + jQuery(this).next(".widget-content").slideToggle(500); + }); +}); \ No newline at end of file From 4210cfb2b8d34cb10313801dfa05e93970054551 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 1 Mar 2014 22:08:45 -0500 Subject: [PATCH 07/16] v 1.4.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 725194b..db360d5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -pyDash - v1.4 +pyDash - v1.4.1 ====== A small web monitoring dashboard for your linux pc/server writen in Python and Django + Chart.js. From 36dadb8e9951e42a844258aa7d7df961b70d616f Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 1 Mar 2014 22:11:44 -0500 Subject: [PATCH 08/16] typo --- static/js/dashboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 7542790..1a54f88 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -250,7 +250,7 @@ dashboard.getIps = function() { }); } -//Expand-Collapse div/table +//Expand-Contract div/table jQuery(document).ready(function() { jQuery(".widget-content").show(); //toggle the componenet with class msg_body From 0156a2710fd17f8685431221fe5679019ad78803 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 1 Mar 2014 22:13:01 -0500 Subject: [PATCH 09/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index db360d5..30c95bf 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ pyDash - v1.4.1 ====== -A small web monitoring dashboard for your linux pc/server writen in Python and Django + Chart.js. +A small web-based monitoring dashboard for your linux pc/server writen in Python and Django + Chart.js. The dashboard is built using only Python libraries available in the main Python distribution, trying to create a small list of dependencies without the need of installing many packages or libraries. From 833f19cbac733f726b403f865ad5ecc19907d8f8 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 1 Mar 2014 22:25:52 -0500 Subject: [PATCH 10/16] version value fix --- pydash/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydash/settings.py b/pydash/settings.py index 8acb3a8..face6fd 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.4.1 +VERSION = "1.4.1" ALLOWED_HOSTS = ['*'] From db03c17252400f5eb28093e899424af9155760f2 Mon Sep 17 00:00:00 2001 From: Florian N Date: Mon, 3 Mar 2014 15:16:07 -0500 Subject: [PATCH 11/16] add contract/expand icons, small fixes --- README.md | 2 +- pydash/settings.py | 2 +- static/js/dashboard.js | 12 ++++++------ templates/main.html | 39 ++++++++++++++++++--------------------- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 30c95bf..8b43a6f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -pyDash - v1.4.1 +pyDash - v1.4.2 ====== A small web-based monitoring dashboard for your linux pc/server writen in Python and Django + Chart.js. diff --git a/pydash/settings.py b/pydash/settings.py index face6fd..ade20e6 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.4.1" +VERSION = "1.4.2" ALLOWED_HOSTS = ['*'] diff --git a/static/js/dashboard.js b/static/js/dashboard.js index 1a54f88..a2eb107 100644 --- a/static/js/dashboard.js +++ b/static/js/dashboard.js @@ -251,11 +251,11 @@ dashboard.getIps = function() { } //Expand-Contract div/table -jQuery(document).ready(function() { - jQuery(".widget-content").show(); - //toggle the componenet with class msg_body - jQuery(".widget-header").click(function() +$(document).ready(function() { + $(".widget-content").show(); + $(".widget-header").click(function() { - jQuery(this).next(".widget-content").slideToggle(500); + $(this).next(".widget-content").slideToggle(500); + $("i",this).toggleClass("icon-minus icon-plus"); }); -}); \ No newline at end of file +}); diff --git a/templates/main.html b/templates/main.html index 1362f5d..0d1859d 100644 --- a/templates/main.html +++ b/templates/main.html @@ -61,12 +61,10 @@
-
-

General Info

- +
+

General Info

-
@@ -87,8 +85,8 @@
-
-

CPU Usage %

+
+

CPU Usage %

@@ -108,9 +106,8 @@
-
- -

Memory Usage

+
+

Memory Usage

@@ -130,7 +127,7 @@
-

Disk Usage

+

Disk Usage

@@ -146,7 +143,7 @@
-

Load Average

+

Load Average

@@ -167,8 +164,8 @@
-
-

IP Adresses

+
+

IP Adresses

@@ -185,8 +182,8 @@
-
-

Internet Traffic

+
+

Internet Traffic

@@ -207,8 +204,8 @@
-
-

Disk Reads/Writes

+
+

Disk Reads/Writes

@@ -233,7 +230,7 @@
-

Online

+

Online

@@ -250,7 +247,7 @@
-

Netstat

+

Netstat

@@ -270,8 +267,8 @@
-
-

Processes

+
+

Processes

From dcf38c6c3a5faf08e4c5f66bb376871b6215a3e7 Mon Sep 17 00:00:00 2001 From: Florian N Date: Mon, 3 Mar 2014 20:47:05 -0500 Subject: [PATCH 12/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b43a6f..63dcb30 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ __[View Demo](http://pydash.hostechs.com/)__ pass: admin -![pyDash](https://www.yaktab.com/en/2btxew) +![pyDash](https://www.yaktab.com/en/2btxe) Installation From 9a4c4bd053d5b57ab44847c8cc03761ff8258a45 Mon Sep 17 00:00:00 2001 From: Florian N Date: Mon, 3 Mar 2014 20:47:36 -0500 Subject: [PATCH 13/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63dcb30..8b43a6f 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ __[View Demo](http://pydash.hostechs.com/)__ pass: admin -![pyDash](https://www.yaktab.com/en/2btxe) +![pyDash](https://www.yaktab.com/en/2btxew) Installation From 875914a1c88f39c24139d57857a4717e7c965e8f Mon Sep 17 00:00:00 2001 From: Bitdeli Chef Date: Wed, 5 Mar 2014 15:40:39 +0000 Subject: [PATCH 14/16] Add a Bitdeli badge to README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8b43a6f..93d1485 100644 --- a/README.md +++ b/README.md @@ -67,3 +67,7 @@ Credits [Dashboard Template](http://www.egrappler.com/templatevamp-free-twitter-bootstrap-admin-template/), [Bootstrap](http://getbootstrap.com/), [Font Awesome](http://fontawesome.io/) + + +[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/k3oni/pydash/trend.png)](https://bitdeli.com/free "Bitdeli Badge") + From 5aca01a7893b6378b8112874132c171d3b852e12 Mon Sep 17 00:00:00 2001 From: Florian N Date: Wed, 5 Mar 2014 20:42:51 -0500 Subject: [PATCH 15/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93d1485..cb7fe8a 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,5 @@ Credits [Font Awesome](http://fontawesome.io/) -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/k3oni/pydash/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +Follow [@hostechs](https://twitter.com/hostechs) on Twitter From 8878387d8acabb77246a7869dd75f39a9b3ea726 Mon Sep 17 00:00:00 2001 From: Florian N Date: Sat, 8 Mar 2014 16:16:44 -0500 Subject: [PATCH 16/16] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cb7fe8a..e0e0121 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,4 @@ Credits Follow [@hostechs](https://twitter.com/hostechs) on Twitter +[![Flattr this](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/2630601/k3onipydash-on-GitHub "Flattr this")