From e65bf3fdf3d8bda76e5dd170097b117d00fda819 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Fri, 11 May 2007 09:07:15 +0000 Subject: [PATCH] Allow admin tool to look for Bongo updates --- src/libs/python/bongo/msgapi.c | 35 +++++++++++++++++++++++++++++++ src/www/bongo/hawkeye/RootView.py | 10 +++++++++ src/www/css/hawkeye.css | 3 +++ src/www/hawkeye/root/index.tpl | 12 +++++++---- 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/libs/python/bongo/msgapi.c b/src/libs/python/bongo/msgapi.c index 9f36b0b..63745cd 100644 --- a/src/libs/python/bongo/msgapi.c +++ b/src/libs/python/bongo/msgapi.c @@ -573,6 +573,39 @@ msgapi_NmapChallenge(PyObject *self, PyObject *args) return Py_BuildValue("s", buf); } +PyDoc_STRVAR(GetBuildVersion_doc, +"GetBuildVersion() -> (integer, boolean)\n \ +\n\ +Returns a tuple containing version number and whether the build is custom.\n\ +"); + +static PyObject * +msgapi_GetBuildVersion(PyObject *self, PyObject *args) +{ + int version; + BOOL custom; + + MsgGetBuildVersion (&version, &custom); + + return Py_BuildValue("ib", version, custom); +} + +PyDoc_STRVAR(GetAvailableVersion_doc, +"GetBuildVersion() -> integer response\n \ +\n\ +Returns the version of the latest software on this branch.\n\ +"); + +static PyObject * +msgapi_GetAvailableVersion(PyObject *self, PyObject *args) +{ + int version; + + MsgGetAvailableVersion (&version); + + return Py_BuildValue("i", version); +} + extern PyObject *msgapi_GetConfigProperty(PyObject *, PyObject *); PyMethodDef MsgApiMethods[] = { @@ -593,6 +626,8 @@ PyMethodDef MsgApiMethods[] = { {"NmapChallenge", msgapi_NmapChallenge, METH_VARARGS | METH_STATIC, NmapChallenge_doc}, {"GetConfigProperty", msgapi_GetConfigProperty, METH_VARARGS | METH_STATIC, GetConfigProperty_doc}, {"GetUnprivilegedUser", msgapi_GetUnprivilegedUser, METH_VARARGS | METH_STATIC, GetUnprivilegedUser_doc}, + {"GetBuildVersion", msgapi_GetBuildVersion, METH_VARARGS | METH_STATIC, GetBuildVersion_doc}, + {"GetAvailableVersion", msgapi_GetAvailableVersion, METH_VARARGS | METH_STATIC, GetAvailableVersion_doc}, {NULL, NULL, 0, NULL} }; diff --git a/src/www/bongo/hawkeye/RootView.py b/src/www/bongo/hawkeye/RootView.py index b21f97d..7b48972 100644 --- a/src/www/bongo/hawkeye/RootView.py +++ b/src/www/bongo/hawkeye/RootView.py @@ -3,6 +3,7 @@ import os import bongo.dragonfly.BongoUtil from HawkeyeHandler import HawkeyeHandler import bongo.hawkeye.Auth as Auth +from bongo.libs import msgapi class RootHandler(HawkeyeHandler): def NeedsAuth(self, rp): @@ -39,6 +40,15 @@ class RootHandler(HawkeyeHandler): self.SetVariable("mem", str(round(used, 2)) + "MB / " + str(round(cm, 2)) + "MB") self.SetVariable("breadcrumb", "Desktop") self.SetVariable("dsktab", "selecteditem") + (build_ver, build_custom) = msgapi.GetBuildVersion() + sw_current = "Current revision: %d" % build_ver + if build_custom: + sw_current += " (custom build)" + sw_available = msgapi.GetAvailableVersion() + self.SetVariable("sw_current", sw_current) + self.SetVariable("sw_available", sw_available) + if (sw_available - build_ver) > 9: + self.SetVariable("sw_upgrade", 1) return self.SendTemplate(req, rp, "index.tpl") def test_GET(self, req, rp): diff --git a/src/www/css/hawkeye.css b/src/www/css/hawkeye.css index bf800ca..209f1da 100644 --- a/src/www/css/hawkeye.css +++ b/src/www/css/hawkeye.css @@ -143,6 +143,9 @@ background-color: #2e3436; color: #eeeeec; padding-left: 4px; } +.drow { +border-bottom: 1px dotted #2e3436; +} .tlist { padding-bottom: 3px; padding-top: 3px; diff --git a/src/www/hawkeye/root/index.tpl b/src/www/hawkeye/root/index.tpl index bd7de04..a469586 100644 --- a/src/www/hawkeye/root/index.tpl +++ b/src/www/hawkeye/root/index.tpl @@ -15,13 +15,17 @@ Agent Status - Operation normal. + Operation normal. Bongo Updates - Critical security update available. - Warning + +

Running version: unknown
+ Latest available: unknown

+

Upgrade to new version recommended.

+ + Warning Memory Usage @@ -36,4 +40,4 @@ -%(include|footer.tpl)s \ No newline at end of file +%(include|footer.tpl)s