Browse Source

added option to set browser's history path manually

pull/3/head
psy 11 years ago
parent
commit
c3d9dd0412
  1. 45
      main.py
  2. 6
      web/index.py

45
main.py

@ -136,26 +136,40 @@ class bc(object):
pass pass
latest_subdir = max(all_subdirs, key=os.path.getmtime) latest_subdir = max(all_subdirs, key=os.path.getmtime)
osx_profile = os.path.join(f_his_osx, latest_subdir) osx_profile = os.path.join(f_his_osx, latest_subdir)
self.browser_history_path = os.path.join(osx_profile, 'places.sqlite') if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = os.path.join(osx_profile, 'places.sqlite')
else: else:
for folder in os.listdir(f_his_osx): for folder in os.listdir(f_his_osx):
if folder.endswith('.default'): if folder.endswith('.default'):
osx_default = os.path.join(f_his_osx, folder) osx_default = os.path.join(f_his_osx, folder)
self.browser_history_path = os.path.join(osx_default, 'places.sqlite') if self.options.browser: # if exists, extract user browser's history path
#print "Setting:", self.browser_history_path, "as history file" self.browser_history_path = self.options.browser
else:
self.browser_history_path = os.path.join(osx_default, 'places.sqlite')
self.browser = "F" self.browser = "F"
self.browser_path = f_osx self.browser_path = f_osx
elif os.path.exists(c_his_osx): elif os.path.exists(c_his_osx):
self.browser = "C" self.browser = "C"
self.browser_history_path = c_his_osx if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = c_his_osx
self.browser_path = c_osx self.browser_path = c_osx
elif os.path.exists(chromium_his_osx): elif os.path.exists(chromium_his_osx):
self.browser = "CHROMIUM" self.browser = "CHROMIUM"
self.browser_history_path = chromium_his_osx if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = chromium_his_osx
self.browser_path = chromium_osx self.browser_path = chromium_osx
elif os.path.exists(s_his_osx): elif os.path.exists(s_his_osx):
self.browser = "S" self.browser = "S"
self.browser_history_path = s_his_osx if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = s_his_osx
self.browser_path = s_osx self.browser_path = s_osx
except: except:
print "Warning: None of the currently supported browsers (Firefox, Chrome, Chromium, Safari) are installed." print "Warning: None of the currently supported browsers (Firefox, Chrome, Chromium, Safari) are installed."
@ -170,14 +184,23 @@ class bc(object):
for folder in os.listdir(f_lin): for folder in os.listdir(f_lin):
if folder.endswith('.default'): if folder.endswith('.default'):
lin_default = os.path.join(f_lin, folder) lin_default = os.path.join(f_lin, folder)
self.browser_history_path = os.path.join(lin_default, 'places.sqlite') if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = os.path.join(lin_default, 'places.sqlite')
self.browser = "F" self.browser = "F"
elif os.path.exists(c_lin): elif os.path.exists(c_lin):
self.browser = "C" self.browser = "C"
self.browser_history_path = c_lin if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = c_lin
elif os.path.exists(chromium_lin): elif os.path.exists(chromium_lin):
self.browser = "CHROMIUM" self.browser = "CHROMIUM"
self.browser_history_path = chromium_lin if self.options.browser: # if exists, extract user browser's history path
self.browser_history_path = self.options.browser
else:
self.browser_history_path = chromium_lin
print "Browser Options:\n" + '='*45 + "\n" print "Browser Options:\n" + '='*45 + "\n"
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
if self.browser == "F": if self.browser == "F":
@ -201,7 +224,7 @@ class bc(object):
if self.browser == "S": if self.browser == "S":
print "Can't get Safari version information, you'll have to look it up manually \n" print "Can't get Safari version information, you'll have to look it up manually \n"
else: else:
print "Version:", self.browser_version, "\n" print "Version:", self.browser_version
print "History:", self.browser_history_path, "\n" print "History:", self.browser_history_path, "\n"
def getURL(self): def getURL(self):
@ -489,7 +512,7 @@ class bc(object):
print "Error: Browser is not responding correctly.\n" print "Error: Browser is not responding correctly.\n"
print '='*45 + "\n" print '='*45 + "\n"
print "Status: Waiting for new urls\n" print "Status: Waiting for new urls ...\n"
print "Type 'Control+C' to exit.\n" print "Type 'Control+C' to exit.\n"
print '='*45 + "\n" print '='*45 + "\n"
# stay latent waiting for new urls # stay latent waiting for new urls

6
web/index.py

@ -47,9 +47,7 @@ for counter in range(1, last_hop+1):
timestamp_list.append(float(timestamp)) timestamp_list.append(float(timestamp))
country_code_list.append(country_code.encode('utf-8')) country_code_list.append(country_code.encode('utf-8'))
# HTML + JS container
#f = open('kaart.html', 'w')
#the html
output = """ output = """
<html> <html>
<head> <head>
@ -96,4 +94,4 @@ output = """
# except: # except:
# output = """ # output = """
# <html> loading </html> # <html> loading </html>
# """ # """

Loading…
Cancel
Save