From 105fd7b6ce1c08ead2284598d2627aa13c733ea5 Mon Sep 17 00:00:00 2001 From: rscmbbng Date: Wed, 25 Sep 2013 14:55:37 +0200 Subject: [PATCH] started implementing barts design, improved local ip filter on main, changed js animation flows --- main.py | 129 ++++---- web/images/bclogo.png | Bin 0 -> 5264 bytes web/images/marker-icon.png | Bin 0 -> 2034 bytes web/index.py | 18 +- web/js/bc.js | 99 ++++-- web/js/leaflet/leaflet.css | 17 +- web/js/rlayer-src.js | 599 +++++++++++++++++++++++++++++++++++++ web/style.css | 66 +++- 8 files changed, 809 insertions(+), 119 deletions(-) create mode 100644 web/images/bclogo.png create mode 100644 web/images/marker-icon.png create mode 100755 web/js/rlayer-src.js diff --git a/main.py b/main.py index a61579b..38b9625 100755 --- a/main.py +++ b/main.py @@ -322,6 +322,9 @@ class bc(object): if self.options.debug == True: print 'Target open, with results \n' return + if '[prohibited]' in output[-1]: + if self.options.debug == True: + print 'prohibited' def traces(self): ''' @@ -345,7 +348,7 @@ class bc(object): self.lft() if self.options.debug == True: logfile = open('tracelogfile', 'a') - thingstolog = ['='*45 + "\n", "Browser: ", self.browser_path.split('/')[-1], "\n", "Version: ", self.browser_version, "\n", "Path to browser: ", self.browser_path, "\n", "History db: ", self.browser_history_path, "\n","URL: ", self.url[0], "\n", "Host: ",url, "\n", "Host ip: ", url_ip, "\n", '='*45, "\n"] + thingstolog = ['='*45 + "\n", "Browser: ", self.browser_path.split('/')[-1], "\n", "Version: ", self.browser_version, "\n", "Path to browser: ", self.browser_path, "\n", "History db: ", self.browser_history_path, "\n","URL: ", self.url, "\n", "Host: ",url, "\n", "Host ip: ", url_ip, "\n", '='*45, "\n"] for item in thingstolog: logfile.write(item) print '='*45 + "\n" + "Packages Route:\n" + '='*45 @@ -357,57 +360,61 @@ class bc(object): for ip in line: if re.match(r'\d{1,4}\.\dms$', ip): self.timestamp = ip.replace('ms', '') - 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) - try: - self.asn = self.geoasn.org_by_addr(ip) - except: - self.asn = 'No ASN provided' - #print record - try: - self.hop_host_name = socket.gethostbyaddr(ip)[0] - except: - self.hop_host_name = 'No hostname' - try: - longitude = str(record['longitude']) - self.longitude = longitude - latitude = str(record['latitude']) - self.latitude = latitude - except: - self.longitude = '-' - self.latitude = '-' - try: - 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, '->', self.timestamp+'ms' - #self.hop_count +=1 - self.city = city - self.country = country - self.server_name = self.hop_host_name - cc = record['country_code'].lower() - 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, '->', self.timestamp+'ms' - self.country = country - self.city = '-' - self.server_name = self.hop_host_name - cc = record['country_code'].lower() - #self.hop_count+=1 - self.vardict = {'url': self.url, 'destination_ip': self.destination_ip, 'hop_count': self.hop_count,'hop_ip': self.hop_ip, 'server_name': self.server_name, 'country': self.country, 'city': self.city, 'longitude': self.longitude, 'latitude': self.latitude, 'asn' : self.asn, 'timestamp' : self.timestamp, 'country_code': cc } - except: - print "Trace:", self.hop_count, "->", "Not allowed" - self.vardict = {'url': self.url, 'destination_ip': self.destination_ip, 'hop_count': self.hop_count,'hop_ip': self.hop_ip, 'server_name': self.server_name, 'country': '-', 'city': '-', 'longitude': '-', 'latitude': '-', 'asn' : self.asn, 'timestamp' : self.timestamp, 'country_code': '-' } + if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', ip) or re.match(r'^192.168\.\d{1,3}\.\d{1,3}$', ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', ip): + pass + else: + 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) + try: + self.asn = self.geoasn.org_by_addr(ip) + except: + self.asn = 'No ASN provided' + #print record + try: + self.hop_host_name = socket.gethostbyaddr(ip)[0] + except: + self.hop_host_name = 'No hostname' + try: + longitude = str(record['longitude']) + self.longitude = longitude + latitude = str(record['latitude']) + self.latitude = latitude + except: + self.longitude = '-' + self.latitude = '-' + try: + 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, '->', self.timestamp+'ms' + #self.hop_count +=1 + self.city = city + self.country = country + self.server_name = self.hop_host_name + cc = record['country_code'].lower() + 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, '->', self.timestamp+'ms' + self.country = country + self.city = '-' + self.server_name = self.hop_host_name + cc = record['country_code'].lower() + #self.hop_count+=1 + self.vardict = {'url': self.url, 'destination_ip': self.destination_ip, 'hop_count': self.hop_count,'hop_ip': self.hop_ip, 'server_name': self.server_name, 'country': self.country, 'city': self.city, 'longitude': self.longitude, 'latitude': self.latitude, 'asn' : self.asn, 'timestamp' : self.timestamp, 'country_code': cc } + except: + #pass + print "Trace:", self.hop_count, "->", "Not allowed", ip + self.vardict = {'url': self.url, 'destination_ip': self.destination_ip, 'hop_count': self.hop_count,'hop_ip': self.hop_ip, 'server_name': self.server_name, 'country': '-', 'city': '-', 'longitude': '-', 'latitude': '-', 'asn' : self.asn, 'timestamp' : self.timestamp, 'country_code': '-' } - self.hop_count+=1 - # write xml data to file - self.result_list.append(self.vardict) - xml_results = xml_reporting(self) - xml_results.print_xml_results('data.xml') - if self.options.export_xml: - open(self.options.export_xml, 'w') # starting a new xml data container in write mode - xml_results.print_xml_results(self.options.export_xml) + self.hop_count+=1 + # write xml data to file + self.result_list.append(self.vardict) + xml_results = xml_reporting(self) + xml_results.print_xml_results('data.xml') + if self.options.export_xml: + open(self.options.export_xml, 'w') # starting a new xml data container in write mode + xml_results.print_xml_results(self.options.export_xml) if self.options.debug == True: logfile.close() @@ -493,7 +500,7 @@ class bc(object): # run traceroutes match_ip = self.url[0].strip('http://').strip(':8080') #regex for filtering local network IPs - if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^192.168\.\d{1,3}$', match_ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', match_ip) or match_ip.startswith('file://'): + if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^192.168\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', match_ip) or match_ip.startswith('file://'): print '='*45 + "\n", "Target:\n" + '='*45 + "\n" print "URL:", self.url[0], "\n" print "Warning: This target is not valid!.\n" @@ -507,14 +514,14 @@ class bc(object): else: traces = self.try_running(self.traces, "\nInternal error tracerouting.") # start web mode (on a different thread) - try: - t = threading.Thread(target=BorderCheckWebserver, args=(self, )) - t.daemon = True - t.start() - time.sleep(2) - except (KeyboardInterrupt, SystemExit): - t.join() - sys.exit() + try: + t = threading.Thread(target=BorderCheckWebserver, args=(self, )) + t.daemon = True + t.start() + time.sleep(2) + except (KeyboardInterrupt, SystemExit): + t.join() + sys.exit() # open same browser of history access on a new tab try: webbrowser.open('http://127.0.0.1:8080', new=1) @@ -537,7 +544,7 @@ class bc(object): print "URL:", self.url[0], "\n" pass if url != self.old_url: - if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^192.168\.\d{1,3}$', match_ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', match_ip): + if re.match(r'^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^10\.\d{1,3}\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^192.168\.\d{1,3}\.\d{1,3}$', match_ip) or re.match(r'^172.(1[6-9]|2[0-9]|3[0-1]).[0-9]{1,3}.[0-9]{1,3}$', match_ip): pass else: if self.url[0].startswith('file://'): diff --git a/web/images/bclogo.png b/web/images/bclogo.png new file mode 100644 index 0000000000000000000000000000000000000000..d4d6f2952543b3d9782cf86cf353d943181679b5 GIT binary patch literal 5264 zcmeHL_fr#GvyLELKtKsKGy&GA-MN4_Pe~I--yo9Sh+Gg4SKz$~|nLE{G%>U5H$_xO2ivR%eN&h+@zYYL|$pQcy zZU6xI6#xK)7Gv+J0RR-|mZmoPmz@8s|0wYPP=P;x{;Ub`(p}#C9A;&14WOZv6rh&n zzQTIrnj(V&8=c|%YNOoM@6m$luZbf;4+{rFdCf6fpPlJV>wa~+e%Sk%_cKOF<9rzE zIdCyXKHfiZgUnR$P!z!|e!JAyIE;h-GE;gPs~MbvYxv@RR%=YPKD%=3&D3a8$3_^V z<>BPr36k_zeyQ}Oi0!^dD&N9&?v!9{IZck*?sMo@HFG`oc=GHm@M;0mbz1S{$mgd% zdd#XrEt~f5#8B)uYr+c#xA~@X?(M#~X{FWl_W|5m#IcnHU8((`lYm^z-f7PY!OO&b z^6gp94=A^j6aA6t@9ouF49@793sgqP`{|ZBm8Le%r^QP|JxxgLZ-pKeT?%o9>fV9v*b|tb>GaLY5c7y0?+eFT8Ekrrpm;?bxSDYPIs_2d+>9nV5 z2%!*rP+?92v(A3shNDAjJYB_FqN4sa{nia?lpyU2r6Oe1l2uqs;kUP^%x| z`T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IG2bw*RDi^BG*yi0@%8H711Q0c(B z;63p>bQW&dw(_|UiwN1}HxUcQf0%(j`zE~_5BU;J6J^TpEe#*QLw9u1Tyk_vA!qxh z8q2G%hdBc`9T0^Equc{Kg}%wn6R_fF@uw8xSP%Kc1q#c>6c_v0T4QShQiD?i{&am# z0dPF`3<+54iiqI&x0|D-_j2!L#i0GK#puovcSeXy+rQUN?}p!h{a&A`gt6ic%q{b= zu%=;S5yC2ntY%JJOc1F))HQiEN&f(=VCu}D-?fyf1BHS!@cI(k)=5`xVsyK76MR$X z0X7_cOSvJz6%13Nw4{TCZiD{Sx+Nj2flq0>Lmm&j4vxROEtl>QQ7FXY2d#_l^04%U QZU6uP07*qoM6N<$f`uxcMF0Q* literal 0 HcmV?d00001 diff --git a/web/index.py b/web/index.py index 7601cec..759af8e 100755 --- a/web/index.py +++ b/web/index.py @@ -26,7 +26,7 @@ timestamp_list = [] last_hop = int(xml.findall('hop')[-1].text) country_code_list = [] -for counter in range(1, last_hop+1): +for counter in range(0, last_hop+1): url = xml.getroot().text hop_element = parseString(dom.getElementsByTagName('hop')[counter].toxml().encode('utf-8')) hop = xml.findall('hop')[counter].text @@ -60,7 +60,7 @@ output = """ - + @@ -79,9 +79,19 @@ output = """
- +
Travelling to:
+
"""+url+"""
-
+
+
>
+
+
+
for some reason if the text is tooo
wide/long nothing appears here..fucking black magicfor some reason if the text is tooofor some reason if the text is tooo +
+
+
+
+