Browse Source

added some more debug mode output, cleaned up/simplified code in check_browser()

pull/3/head
rscmbbng 11 years ago
parent
commit
656f4f21ce
  1. 26
      main.py

26
main.py

@ -147,25 +147,19 @@ class bc(object):
self.browser_history_path = chromium_lin self.browser_history_path = chromium_lin
print "Browser Options:\n" + '='*45 + "\n" print "Browser Options:\n" + '='*45 + "\n"
if self.browser == "F": print "Currently used:", self.browser_path.split('/')[-1], "\n"
print "Browser used: Firefox \n"
elif self.browser == "C":
print "Browser used: Chrome \n"
elif self.browser == "CHROMIUM":
print "Browser used: Chromium \n"
elif self.browser == "S":
print "Browser used: Safari \n"
if self.options.debug == True: if self.options.debug == True:
if self.browser == "F" and sys.platform == 'darwin': if sys.platform == 'darwin':
if self.browser == "F" or self.browser == "C" or self.browser == "CHROMIUM":
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n') self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
elif self.browser == "F" and sys.platform.startswith('linux'): elif sys.platform.startswith('linux') and self.browser == "F":
self.browser_version = subprocess.check_output(['firefox', '--version']).strip('\n') self.browser_version = subprocess.check_output(['firefox', '--version']).strip('\n')
elif self.browser == "C" and sys.platform == 'darwin':
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
elif self.browser == "CHROMIUM" and sys.platform == 'darwin':
self.browser_version = subprocess.check_output([self.browser_path, '--version']).strip('\n')
if self.browser == "S":
print "Can't get Safari version information, you'll have to look it up manually \n"
else:
print "Version:", self.browser_version, "\n" print "Version:", self.browser_version, "\n"
print "History:", self.browser_history_path, "\n" print "History:", self.browser_history_path, "\n"
@ -229,6 +223,8 @@ class bc(object):
url = url.replace('www.','') #--> doing a tracert to example.com and www.example.com yields different results. url = url.replace('www.','') #--> doing a tracert to example.com and www.example.com yields different results.
url_ip = socket.gethostbyname(url) url_ip = socket.gethostbyname(url)
print "Host:", url, "\n" print "Host:", url, "\n"
if self.options.debug == True:
print "Host ip:", url_ip, "\n"
if url != self.old_url: if url != self.old_url:
count = 1 count = 1
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
@ -257,9 +253,11 @@ class bc(object):
except: except:
print "Error: network is not responding correctly. Aborting...\n" print "Error: network is not responding correctly. Aborting...\n"
sys.exit(2) sys.exit(2)
if self.options.debug == True:
logfile = open('logfile', 'a') logfile = open('logfile', 'a')
print '='*45 + "\n" + "Packages Route:\n" + '='*45 print '='*45 + "\n" + "Packages Route:\n" + '='*45
for line in a.stdout: for line in a.stdout:
if self.options.debug == True:
logfile.write(line) logfile.write(line)
parts = line.split() parts = line.split()
for ip in parts: for ip in parts:

Loading…
Cancel
Save