Browse Source

added option to set browser's history path manually

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

29
main.py

@ -136,25 +136,39 @@ 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)
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') 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)
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_default, 'places.sqlite') self.browser_history_path = os.path.join(osx_default, 'places.sqlite')
#print "Setting:", self.browser_history_path, "as history file"
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"
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_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"
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_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"
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_history_path = s_his_osx
self.browser_path = s_osx self.browser_path = s_osx
except: except:
@ -170,13 +184,22 @@ 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)
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_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"
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 self.browser_history_path = c_lin
elif os.path.exists(chromium_lin): elif os.path.exists(chromium_lin):
self.browser = "CHROMIUM" self.browser = "CHROMIUM"
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 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'):
@ -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

4
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>

Loading…
Cancel
Save