#!/usr/local/bin/python
# -*- coding: iso-8859-15 -*-
"""
BC (Border-Check) is a tool to retrieve info of traceroute tests over website navigation routes.
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()
file.close()
dom = parseString(data)
xmlTag = dom.getElementsByTagName('travel')[0].toxml()
xmlData= xmlTag.replace('','').replace('','')
xmlHost = dom.getElementsByTagName('host')[0].toxml()
xmlIP = dom.getElementsByTagName('hop_ip')[0].toxml()
xmlLongitude = dom.getElementsByTagName('longitude')[0].toxml()
xmlLatitude = dom.getElementsByTagName('latitude')[0].toxml()
xmlCity = dom.getElementsByTagName('city')[0].toxml()
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 = """
Border Check - Web Visualizator
|
Host: |
"""+xmlHost+""" |
IP: |
"""+xmlIP+""" |
Coordinates: |
"""+xmlLongitude+""" : """+xmlLatitude+""" |
Server name: |
"""+xmlServerName+""" |
Country: |
"""+xmlCountry+""" |
City: |
"""+xmlCity+""" |
Metadata: |
"""+xmlMeta+""" |
|
"""