mirror of https://github.com/rscmbbng/Border-Check
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
#!/usr/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)
|
|
"""
|
|
import xml.etree.ElementTree as ET
|
|
|
|
class xml_reporting(object):
|
|
"""
|
|
Print results from a traceroute in an XML fashion
|
|
"""
|
|
def __init__(self, bc):
|
|
# initialize main BC
|
|
self.instance = bc
|
|
|
|
def print_xml_results(self, filename):
|
|
root = ET.Element("travel")
|
|
host = ET.SubElement(root, "host")
|
|
ip = ET.SubElement(root, "ip")
|
|
longitude = ET.SubElement(root, "longitude")
|
|
latitude = ET.SubElement(root, "latitude")
|
|
city = ET.SubElement(root, "city")
|
|
country = ET.SubElement(root, "country")
|
|
server_name = ET.SubElement(root, "server_name")
|
|
meta = ET.SubElement(root, "meta")
|
|
|
|
host.text = self.instance.url[0]
|
|
ip.text = self.instance.ip
|
|
longitude.text = self.instance.longitude
|
|
latitude.text = self.instance.latitude
|
|
city.text = self.instance.city
|
|
country.text = self.instance.country
|
|
server_name.text = self.instance.server_name
|
|
meta.text = "Connect here XML metadata"
|
|
|
|
tree = ET.ElementTree(root)
|
|
tree.write(filename)
|
|
|
|
|