Skip to content

Commit 9d6add7

Browse files
authored
Update browser_history.py
1 parent 9ef9359 commit 9d6add7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

browser_history.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ def query_firefox(conn):
4646

4747
def get_username_from_path(database_file):
4848
try:
49-
parent_dir = database_file.split("/")[database_file.split("/").index("Users")+1]
49+
try:
50+
parent_dir = database_file.split("/")[database_file.split("/").index("Users")+1]
51+
except ValueError:
52+
parent_dir = database_file.split("/")[database_file.split("/").index("Library")-1]
53+
return parent_dir
5054
except ValueError:
51-
parent_dir = database_file.split("/")[database_file.split("/").index("Library")-1]
52-
return parent_dir
53-
55+
return "Anon_User"
56+
5457
def setup_argparse():
5558
parser = argparse.ArgumentParser(description='Automatically find and process browser history databases within a specified directory to export the browsing history into CSV format.')
5659
parser.add_argument('directory', nargs='?', default=os.getcwd(), help='Directory to search for browser history database files. Defaults to the current working directory if not specified.')

0 commit comments

Comments
 (0)