Browse Source

changes to menubar

pull/3/head
rscmbbng 11 years ago
parent
commit
5a4ed70fb0
  1. 27
      web/index.py
  2. 5
      web/js/bc.js

27
web/index.py

@ -6,6 +6,18 @@ GPLv3 - 2013 by psy (epsylon@riseup.net)
""" """
from xml.dom.minidom import parseString from xml.dom.minidom import parseString
import xml.etree.ElementTree as ET 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)
# extract data from a xml file # extract data from a xml file
f = open('data.xml', 'r') f = open('data.xml', 'r')
@ -23,9 +35,11 @@ latlong= []
asn_list =[] asn_list =[]
server_name_list = [] server_name_list = []
timestamp_list = [] timestamp_list = []
telco_list = []
last_hop = int(xml.findall('hop')[-1].text) last_hop = int(xml.findall('hop')[-1].text)
country_code_list = [] country_code_list = []
for counter in range(0, last_hop+1): for counter in range(0, last_hop+1):
url = xml.getroot().text url = xml.getroot().text
hop_element = parseString(dom.getElementsByTagName('hop')[counter].toxml().encode('utf-8')) hop_element = parseString(dom.getElementsByTagName('hop')[counter].toxml().encode('utf-8'))
@ -40,7 +54,8 @@ for counter in range(0, last_hop+1):
latlong = [float(latitude.encode('utf-8')), float(longitude.encode('utf-8'))] latlong = [float(latitude.encode('utf-8')), float(longitude.encode('utf-8'))]
geoarray.append(latlong) geoarray.append(latlong)
asn_list.append(asn.encode('utf-8')) 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 = int(hop) +1
hop_list.append(str(hop)) hop_list.append(str(hop))
hop_ip_list.append(hop_ip.encode('utf-8')) hop_ip_list.append(hop_ip.encode('utf-8'))
@ -102,12 +117,6 @@ output = """
<center><pre> <img id="home" class='toggle' src='images/markers/marker-icon-0.png'></img> <img class='toggle' id="hop" src='images/markers/marker-icon-11.png'></img> <img class='toggle'id="cluster" src='images/markers/cluster-marker.png'></img> <img class='toggle' id="destination" src='images/markers/marker-icon-last.png'></img> </pre></center> <center><pre> <img id="home" class='toggle' src='images/markers/marker-icon-0.png'></img> <img class='toggle' id="hop" src='images/markers/marker-icon-11.png'></img> <img class='toggle'id="cluster" src='images/markers/cluster-marker.png'></img> <img class='toggle' id="destination" src='images/markers/marker-icon-last.png'></img> </pre></center>
<div id=legend-text></div></div> <div id=legend-text></div></div>
<p class='divider'>------------------------------</p> <p class='divider'>------------------------------</p>
<div class='toggle' id='attrib'>Who?</div>
<div id='attrib-content'>
<p> Border Check is a project by <a href="http://www.roelroscamabbing.nl">Roel Roscam Abbing</a>. Programming by <a href="http://www.lordepsylon.net">Lord Epsylon</a>. Design by <a href="http://bartvanharen.nl/">Bart Van Haren</a>.</p>
<p>BC was developed during <a href="http://summersessions.net/">Summer Sessions 2013</a> with with the support of <a href="http://v2.nl">V2_ Institute For The Unstable Media</a> at <a href="http://www.laboralcentrodearte.org">Laboral Centro De Arte</a> and the <a href="http://www.mp19.net">MP19 Openlab</a>.
It uses <a href="http://www.python.org">Python</a>, <a href="http://www.openstreetmap.org">OpenStreetMap</a>, <a href="http://www.leafletjs.com"> Leaflet</a> and <a href="https://github.com/rscmbbng/Border-Check/blob/master/doc/INSTALL"> others.</a></p></div>
<p class='divider'>------------------------------</p>
<div class='toggle' id='contact'>Get in touch</div> <div class='toggle' id='contact'>Get in touch</div>
<div id='contact-content'> <div id='contact-content'>
Roel Roscam Abbing (rscmbbng@riseup.net, @rscmbbng) <br /> Roel Roscam Abbing (rscmbbng@riseup.net, @rscmbbng) <br />
@ -126,6 +135,7 @@ output = """
counter_max = """+str(last_hop)+""" counter_max = """+str(last_hop)+"""
latlong = """+str(geoarray)+""" latlong = """+str(geoarray)+"""
asn_list = """+str(asn_list)+""" asn_list = """+str(asn_list)+"""
telco_list = """+str(telco_list)+"""
server_name_list = """+str(server_name_list)+""" server_name_list = """+str(server_name_list)+"""
timestamp_list = """+str(timestamp_list)+""" timestamp_list = """+str(timestamp_list)+"""
country_code_list = """+str(country_code_list)+""" country_code_list = """+str(country_code_list)+"""
@ -133,3 +143,6 @@ output = """
</script> </script>
</html> </html>
""" """
x = open('test.html','w')
x.write(output)
x.close()

5
web/js/bc.js

@ -1,6 +1,6 @@
window.onload = function () { window.onload = function () {
index = 0 index = 0
cables = L.tileLayer('http://{s}.tiles.mapbox.com/v3/rllfff.blank-sea-cables/{z}/{x}/{y}.png',{ cables = L.tileLayer('http://{s}.tiles.mapbox.com/v3/rllfff.Test/{z}/{x}/{y}.png',{
attribution: 'Cable data: <a href="http://cablemap.info/">cablemap.info</a>' attribution: 'Cable data: <a href="http://cablemap.info/">cablemap.info</a>'
}) })
blank_map = L.tileLayer('http://{s}.tiles.mapbox.com/v3/rllfff.blank-populations/{z}/{x}/{y}.png') blank_map = L.tileLayer('http://{s}.tiles.mapbox.com/v3/rllfff.blank-populations/{z}/{x}/{y}.png')
@ -55,7 +55,6 @@ window.onload = function () {
}) })
$('#attrib-content').hide() $('#attrib-content').hide()
$('#legend-content').hide()
$('#about-content').hide() $('#about-content').hide()
$('#contact-content').hide() $('#contact-content').hide()
@ -144,7 +143,7 @@ window.onload = function () {
var marker = L.marker([src[0], src[1]],{icon: makeCustomMarker(index)}) var marker = L.marker([src[0], src[1]],{icon: makeCustomMarker(index)})
var popup = L.Popup({ var popup = L.Popup({
maxHeight: 50}) maxHeight: 50})
var popupcontent = "Server name:<br /><b>"+server_name_list[index]+"</b><br />Network owner:<br /><b>"+asn_list[index]+"</b></p>" var popupcontent = "Server name:<br /><b>"+server_name_list[index]+"</b><br />ASN: <br /><b>"+asn_list[index]+"</b><br />Network owner:<br /><b><a href='https://duckduckgo.com/?q="+telco_list[index]+"'>"+telco_list[index]+"</a></b></p>"
marker.bindPopup(popupcontent) marker.bindPopup(popupcontent)
AddMarkerCluster(marker, index) AddMarkerCluster(marker, index)
} }

Loading…
Cancel
Save