Browse Source

added some small fixes

pull/3/head
rscmbbng 11 years ago
parent
commit
7935ae8865
  1. 9
      main.py

9
main.py

@ -324,6 +324,7 @@ class bc(object):
if url != self.old_url: if url != self.old_url:
self.hop_count = 0 self.hop_count = 0
self.attempts = 0 self.attempts = 0
self.result_list = []
self.lft() self.lft()
@ -362,8 +363,8 @@ class bc(object):
latitude = str(record['latitude']) latitude = str(record['latitude'])
self.latitude = latitude self.latitude = latitude
except: except:
self.longitude = '-' self.longitude = '4.0'
self.latitude = '-' self.latitude = '40.0'
try: try:
if record.has_key('country_name') and record['city'] is not '': if record.has_key('country_name') and record['city'] is not '':
country = record['country_name'] country = record['country_name']
@ -509,6 +510,10 @@ class bc(object):
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}$', 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 pass
else: else:
if os.path.exists('data.xml'): # removing xml data to has a new map each time that bc is launched
os.remove('data.xml')
open('data.xml', 'w') # starting a new xml data container in write mode
traces = self.try_running(self.traces, "\nInternal error tracerouting.") traces = self.try_running(self.traces, "\nInternal error tracerouting.")
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save