diff --git a/main.py b/main.py index 762ecba..98e6919 100755 --- a/main.py +++ b/main.py @@ -357,6 +357,11 @@ class bc(object): line = line.split() for ip in line: + if re.match(r'\d{1,4}\.\dms$', ip): + self.timestamp = ip.replace('ms', '') + print self.timestamp + print ('*'*45) + if re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$",ip): self.hop_ip = ip record = self.geoip.record_by_addr(ip) @@ -381,14 +386,14 @@ class bc(object): if record.has_key('country_name') and record['city'] is not '': country = record['country_name'] city = record['city'] - print "Trace:", self.hop_count, "->", ip, "->", longitude + ":" + latitude, "->", city, "->", country, "->", self.hop_host_name, "->", self.asn + print "Trace:", self.hop_count, "->", ip, "->", longitude + ":" + latitude, "->", city, "->", country, "->", self.hop_host_name, "->", self.asn, '->', self.timestamp+'ms' #self.hop_count +=1 self.city = city self.country = country self.server_name = self.hop_host_name elif record.has_key('country_name'): country = record['country_name'] - print "Trace:", self.hop_count, "->", ip, "->", longitude + ":" + latitude, "->", country, "->", self.hop_host_name, "->", self.asn + print "Trace:", self.hop_count, "->", ip, "->", longitude + ":" + latitude, "->", country, "->", self.hop_host_name, "->", self.asn, '->', self.timestamp+'ms' self.country = country self.city = '-' self.server_name = self.hop_host_name @@ -404,8 +409,7 @@ class bc(object): xml_results = xml_reporting(self) xml_results.print_xml_results('data.xml') - if re.match(r'\d{1,2}\.\dms$', ip): - self.timestamp = ip.replace('ms', '') + if self.options.debug == True: logfile.close() diff --git a/web/index.py b/web/index.py index 1dcc891..1b83eac 100755 --- a/web/index.py +++ b/web/index.py @@ -22,6 +22,7 @@ geoarray = [] latlong= [] asn_list =[] server_name_list = [] +timestamp_list = [] last_hop = int(xml.findall('hop')[-1].text) for counter in range(1, last_hop+1): @@ -33,6 +34,7 @@ for counter in range(1, last_hop+1): 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('','') latlong = [float(latitude.encode('utf-8')), float(longitude.encode('utf-8'))] geoarray.append(latlong) @@ -40,6 +42,7 @@ for counter in range(1, last_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)) f = open('kaart.html', 'w') @@ -101,6 +104,7 @@ output = """ var latlong = """+str(geoarray)+""" var asn_list = """+str(asn_list)+""" server_name_list = """+str(server_name_list)+""" + timestamp_list = """+str(timestamp_list)+""" //var polyline = L.polyline(latlong, {color: 'red'}).addTo(map); index = 0 @@ -136,6 +140,11 @@ function processStep (index) { AddStep(latlong[index], latlong[index], index) }, 500);} + else + if (index = counter_max-1){ + console.log('fin') + } + index = index + 1 } };