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