diff --git a/web/index.py b/web/index.py index 408c085..132c106 100755 --- a/web/index.py +++ b/web/index.py @@ -6,6 +6,18 @@ GPLv3 - 2013 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) # extract data from a xml file f = open('data.xml', 'r') @@ -23,9 +35,11 @@ latlong= [] asn_list =[] server_name_list = [] timestamp_list = [] +telco_list = [] last_hop = int(xml.findall('hop')[-1].text) country_code_list = [] + for counter in range(0, last_hop+1): url = xml.getroot().text 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'))] 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_list.append(str(hop)) hop_ip_list.append(hop_ip.encode('utf-8')) @@ -102,12 +117,6 @@ output = """
                  

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

-
Who?
-
-

Border Check is a project by Roel Roscam Abbing. Programming by Lord Epsylon. Design by Bart Van Haren.

-

BC was developed during Summer Sessions 2013 with with the support of V2_ Institute For The Unstable Media at Laboral Centro De Arte and the MP19 Openlab. - It uses Python, OpenStreetMap, Leaflet and others.

-

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

Get in touch
Roel Roscam Abbing (rscmbbng@riseup.net, @rscmbbng)
@@ -126,6 +135,7 @@ output = """ counter_max = """+str(last_hop)+""" latlong = """+str(geoarray)+""" asn_list = """+str(asn_list)+""" + telco_list = """+str(telco_list)+""" server_name_list = """+str(server_name_list)+""" timestamp_list = """+str(timestamp_list)+""" country_code_list = """+str(country_code_list)+""" @@ -133,3 +143,6 @@ output = """ """ +x = open('test.html','w') +x.write(output) +x.close() diff --git a/web/js/bc.js b/web/js/bc.js index 2aec981..6674162 100644 --- a/web/js/bc.js +++ b/web/js/bc.js @@ -1,6 +1,6 @@ window.onload = function () { 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: cablemap.info' }) 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() - $('#legend-content').hide() $('#about-content').hide() $('#contact-content').hide() @@ -144,7 +143,7 @@ window.onload = function () { var marker = L.marker([src[0], src[1]],{icon: makeCustomMarker(index)}) var popup = L.Popup({ maxHeight: 50}) - var popupcontent = "Server name:
"+server_name_list[index]+"
Network owner:
"+asn_list[index]+"

" + var popupcontent = "Server name:
"+server_name_list[index]+"
ASN:
"+asn_list[index]+"
Network owner:
"+telco_list[index]+"

" marker.bindPopup(popupcontent) AddMarkerCluster(marker, index) }