|
@ -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) |
|
|
GPLv3 - 2013 by psy (epsylon@riseup.net) |
|
|
""" |
|
|
""" |
|
|
from xml.dom.minidom import parseString |
|
|
from xml.dom.minidom import parseString |
|
|
|
|
|
|
|
|
# extract data from a xml file |
|
|
# extract data from a xml file |
|
|
file = open('data.xml','r') |
|
|
file = open('data.xml','r') |
|
|
data = file.read() |
|
|
data = file.read() |
|
@ -21,6 +22,24 @@ xmlCountry = dom.getElementsByTagName('country')[0].toxml() |
|
|
xmlServerName = dom.getElementsByTagName('server_name')[0].toxml() |
|
|
xmlServerName = dom.getElementsByTagName('server_name')[0].toxml() |
|
|
xmlMeta = dom.getElementsByTagName('meta')[0].toxml() |
|
|
xmlMeta = dom.getElementsByTagName('meta')[0].toxml() |
|
|
|
|
|
|
|
|
|
|
|
# parse XML inputs |
|
|
|
|
|
xmlLongitude = xmlLongitude.replace('<longitude>','') |
|
|
|
|
|
xmlLatitude = xmlLatitude.replace('<latitude>','') |
|
|
|
|
|
xmlLongitude = xmlLongitude.replace('</longitude>','') |
|
|
|
|
|
xmlLatitude = xmlLatitude.replace('</latitude>','') |
|
|
|
|
|
xmlMeta = xmlMeta.replace('<meta>','') |
|
|
|
|
|
xmlMeta = xmlMeta.replace('</meta>','') |
|
|
|
|
|
xmlHost = xmlHost.replace('<host>','') |
|
|
|
|
|
xmlHost = xmlHost.replace('</host>','') |
|
|
|
|
|
xmlIP = xmlIP.replace('<ip>','') |
|
|
|
|
|
xmlIP = xmlIP.replace('</ip>','') |
|
|
|
|
|
xmlCity = xmlCity.replace('<city>','') |
|
|
|
|
|
xmlCity = xmlCity.replace('</city>','') |
|
|
|
|
|
xmlCountry = xmlCountry.replace('<country>','') |
|
|
|
|
|
xmlCountry = xmlCountry.replace('</country>','') |
|
|
|
|
|
xmlServerName = xmlServerName.replace('<server_name>','') |
|
|
|
|
|
xmlServerName = xmlServerName.replace('</server_name>','') |
|
|
|
|
|
|
|
|
output = """ |
|
|
output = """ |
|
|
<html> |
|
|
<html> |
|
|
<head> |
|
|
<head> |
|
@ -28,6 +47,8 @@ output = """ |
|
|
<link rel="stylesheet" href="js/leaflet/leaflet.css" /> |
|
|
<link rel="stylesheet" href="js/leaflet/leaflet.css" /> |
|
|
<link rel="stylesheet" href="style.css" /> |
|
|
<link rel="stylesheet" href="style.css" /> |
|
|
<script src="js/leaflet/leaflet.js"></script> |
|
|
<script src="js/leaflet/leaflet.js"></script> |
|
|
|
|
|
<!--<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>--> |
|
|
|
|
|
<meta http-equiv="refresh" content="5"> |
|
|
</head> |
|
|
</head> |
|
|
<body> |
|
|
<body> |
|
|
<center> |
|
|
<center> |
|
@ -35,18 +56,13 @@ output = """ |
|
|
<tr> |
|
|
<tr> |
|
|
<td><center><div id="map" style="width: 600px; height: 400px"></div></center></td> |
|
|
<td><center><div id="map" style="width: 600px; height: 400px"></div></center></td> |
|
|
<script> |
|
|
<script> |
|
|
var map = L.map('map').setView(["""+xmlLongitude+""", """+xmlLatitude+"""], 14); |
|
|
var map = L.map('map').setView(["""+xmlLatitude+""", """+xmlLongitude+"""], 14); |
|
|
L.tileLayer('Border Check', { |
|
|
|
|
|
maxZoom: 18, |
|
|
|
|
|
attribution: 'Map: <a href="http://openstreetmap.org">OpenStreetMap</a>' |
|
|
|
|
|
}).addTo(map); |
|
|
|
|
|
|
|
|
|
|
|
L.marker(["""+xmlLongitude+""", """+xmlLatitude+"""]).addTo(map) |
|
|
L.marker(["""+xmlLatitude+""", """+xmlLongitude+"""]).addTo(map) |
|
|
.bindPopup("<b>"""+xmlMeta+"""</b><br />").openPopup(); |
|
|
.bindPopup("<b>"""+xmlMeta+"""</b><br />").openPopup(); |
|
|
|
|
|
|
|
|
var popup = L.popup(); |
|
|
var popup = L.popup(); |
|
|
</script> |
|
|
</script> |
|
|
<br /> |
|
|
|
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td> |
|
|
<td> |
|
|