#!/usr/bin/env python # -*- coding: iso-8859-15 -*- """ BC (Border-Check) is a tool to retrieve info of traceroute tests over website navigation routes. GPLv3 - 2013-2014-2015 by psy (epsylon@riseup.net) """ from xml.dom.minidom import parseString import xml.etree.ElementTree as ET import re #function to split ISP company names from ASN def ASN_Split(asn): name_parts = [] for i in asn.split(): if re.match(r'AS\d{1,6}$', i): asn = i elif not re.match(r'AS\d{1,6}$', i): name_parts.append(i) company = ' '.join(name_parts) return (asn, company) got_data = False msg="" url="" try: # extract data from a xml file f = open('data.xml', 'r') f2 = open('data.xml', 'r') xml = ET.parse(f) data = f2.read() dom = parseString(data.encode('utf-8')) f.close() f2.close() n_hops = dom.getElementsByTagName('hop')[-1].toxml().replace('', '').replace('','').replace('','') asn = hop_element.getElementsByTagName('asn')[0].toxml().replace('','').replace('','') hop_ip = hop_element.getElementsByTagName('hop_ip')[0].toxml().replace('','').replace('','') longitude = hop_element.getElementsByTagName('longitude')[0].toxml().replace('','').replace('','') latitude = hop_element.getElementsByTagName('latitude')[0].toxml().replace('','').replace('','') timestamp = hop_element.getElementsByTagName('timestamp')[0].toxml().replace('','').replace('','') country_code = hop_element.getElementsByTagName('country_code')[0].toxml().replace('','').replace('','') if str(asn) == "": #parse when no asn present/network owner present asn_list.append(str("Not Available")) telco_list.append(str("Unknown")) else: asn_list.append(ASN_Split(asn.encode('utf-8'))[0]) telco_list.append(ASN_Split(asn.encode('utf-8'))[1]) latlong = [float(latitude.encode('utf-8')), float(longitude.encode('utf-8'))] geoarray.append(latlong) # asn_list.append(ASN_Split(asn.encode('utf-8'))[0]) # telco_list.append(ASN_Split(asn.encode('utf-8'))[1]) hop = int(hop) +1 hop_list.append(str(hop)) hop_ip_list.append(hop_ip.encode('utf-8')) server_name_list.append(server_name.encode('utf-8')) timestamp_list.append(float(timestamp)) country_code_list.append(country_code.encode('utf-8')) unique_country_code_list = set(country_code_list) except: args['error']="Data error." if 'error' in args: msg=args['error']; # HTML + JS container output = """ Border Check - Web Viewer
Travelling to:
"""+url+"""
>

About

As you surf the net, data packets are sent from your computer to the target server. These data packets go on a journey hopping from server to server, potentially crossing multiple countries and networks, until the packets reach the desired website.

Border Check allows you to retrace the path your data takes across the internet's infrastructure. It will map out all the servers your data passes and shows you in which countries or cities these servers are located. Additionally Border Check will try to provide you with additional data on these servers, such as the companies they belong to.

Visit the project homepage for more information.

------------------------------

Map legend
                  

------------------------------

New Travel (enter URL)

History

------------------------------

Get in touch

Roel Roscam Abbing (rscmbbng@riseup.net)
psy (epsylon@riseup.net)
"""+msg+"""
""" if got_data: output +=""" """