Uses constants in chrome config

pull/26/head
Abhay Rana 8 years ago
parent d9e6e51722
commit c7a1c653d9
  1. 9
      hackertray/chrome.py

@ -5,11 +5,12 @@ import os
import sys
class Chrome:
HISTORY_TMP_LOCATION = '/tmp/hackertray.chrome'
@staticmethod
def search(urls, config_folder_path):
Chrome.setup(config_folder_path)
conn = sqlite3.connect('/tmp/hackertray.chrome')
db = conn.cursor()
conn = sqlite3.connect(Chrome.HISTORY_TMP_LOCATION)
db = conn.cursor()
result = []
for url in urls:
db_result = db.execute('SELECT url from urls WHERE url=:url',{"url":url})
@ -17,7 +18,7 @@ class Chrome:
result.append(False)
else:
result.append(True)
os.remove('/tmp/hackertray.chrome')
os.remove(Chrome.HISTORY_TMP_LOCATION)
return result
@staticmethod
def setup(config_folder_path):
@ -25,4 +26,4 @@ class Chrome:
if not os.path.isfile(file_name):
print("ERROR: ", "Could not find Chrome history file", file=sys.stderr)
sys.exit(1)
shutil.copyfile(file_name, '/tmp/hackertray.chrome')
shutil.copyfile(file_name, Chrome.HISTORY_TMP_LOCATION)

Loading…
Cancel
Save