From ef1d3346eec687c99568c878121792237f661c87 Mon Sep 17 00:00:00 2001 From: psy Date: Thu, 12 Sep 2013 08:05:53 -0700 Subject: [PATCH] correctly parsed xml data to html output + web autorefresh --- main.py | 5 +++-- web/index.py | 30 +++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 7da1006..3678613 100755 --- a/main.py +++ b/main.py @@ -276,7 +276,8 @@ class bc(object): logfile.write(item) print '='*45 + "\n" + "Packages Route:\n" + '='*45 for line in a.stdout: - logfile.write(line) + if self.options.debug == True: + logfile.write(line) parts = line.split() for ip in parts: if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$",ip): @@ -393,7 +394,7 @@ class bc(object): print(str(p.version)) print('='*75) # root checker - #root = self.try_running(self.check_root, "\nInternal error checking root permissions.") + root = self.try_running(self.check_root, "\nInternal error checking root permissions.") # extract browser type and path browser = self.try_running(self.check_browser, "\nInternal error checking browser files path.") # extract url diff --git a/web/index.py b/web/index.py index ee07bad..eefdfba 100755 --- a/web/index.py +++ b/web/index.py @@ -5,6 +5,7 @@ BC (Border-Check) is a tool to retrieve info of traceroute tests over website na GPLv3 - 2013 by psy (epsylon@riseup.net) """ from xml.dom.minidom import parseString + # extract data from a xml file file = open('data.xml','r') data = file.read() @@ -21,6 +22,24 @@ xmlCountry = dom.getElementsByTagName('country')[0].toxml() xmlServerName = dom.getElementsByTagName('server_name')[0].toxml() xmlMeta = dom.getElementsByTagName('meta')[0].toxml() +# parse XML inputs +xmlLongitude = xmlLongitude.replace('','') +xmlLatitude = xmlLatitude.replace('','') +xmlLongitude = xmlLongitude.replace('','') +xmlLatitude = xmlLatitude.replace('','') +xmlMeta = xmlMeta.replace('','') +xmlMeta = xmlMeta.replace('','') +xmlHost = xmlHost.replace('','') +xmlHost = xmlHost.replace('','') +xmlIP = xmlIP.replace('','') +xmlIP = xmlIP.replace('','') +xmlCity = xmlCity.replace('','') +xmlCity = xmlCity.replace('','') +xmlCountry = xmlCountry.replace('','') +xmlCountry = xmlCountry.replace('','') +xmlServerName = xmlServerName.replace('','') +xmlServerName = xmlServerName.replace('','') + output = """ @@ -28,6 +47,8 @@ output = """ + +
@@ -35,18 +56,13 @@ output = """
-