-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse-firefox.py
More file actions
92 lines (86 loc) · 2.93 KB
/
parse-firefox.py
File metadata and controls
92 lines (86 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# conding=UTF-8
import sqlite3
import re
import optparse
import os
def printDownloads(downloadDB):
conn = sqlite3.connect(downloadDB)
c = conn.cursor()
c.execute('SELECT name,source,datetime(endTime/1000000,\'unixepoch\') FROM moz_downloads;')
print('\n[*] --- Files Downloaded ---')
for row in c:
print('[+] File: ' + str(row[0]) + ' from source: ' + str(row[1]) + ' at:' + str(row[2]))
def printCookies(cookiesDB):
try:
conn = sqlite3.connect(cookiesDB)
c = conn.cursor()
c.execute('SELECT host,name,value FROM moz_cookies')
print('\n[*] -- Found Cookies --')
for row in c:
host = str(row[0])
name = str(row[1])
value = str(row[2])
print('[+] Host: ' + host + ',Cookie: ' + name + ',Value:' + value)
except Exception as e:
if 'encrypted' in str(e):
print('\n[*] Error reading your cookies database.')
print('[*] Upgrade your Python-Sqlite3 Library')
def printHistory(placesDB):
try:
conn = sqlite3.connect(placesDB)
c = conn.cursor()
c.execute("select url,datetime(visit_date/1000000,'unixepoch') from moz_places,moz_historyvisits where visit_count>0 and moz_places.id==moz_historyvisits.place_id;")
print('\n[*] -- Found History --')
for row in c:
url = str(row[0])
date = str(row[1])
print('[+]' + date + ' - Visited:' + url)
except Exception as e:
if 'encrypted' in str(e):
print('\n[*] Error reading your places database.')
print('[*] Upgrade your Python-Sqlite3 Library')
exit(0)
def printGoogle(placesDB):
conn = sqlite3.connect(placesDB)
c = conn.cursor()
c.execute("select url,datetime(visit_date/1000000,'unixepoch') from moz_places,moz_historyvisits where visit_count>0 and moz_places.id==moz_historyvisits.place_id;")
print('\n[*] -- Found Google --')
for row in c:
url = str(row[0])
date = str(row[1])
if 'google' in url.lower():
r = re.findall(r'q=.*\&',url)
if r:
search = r[0].split('&')[0]
search = search.replace('q=','').replace('+','')
print('[+] ' + date + ' - Searched For: ' + search)
def main():
parser = optparse.OptionParser("usage%prog -p <firefox profile path>")
parser.add_option('-p',dest='pathName',type='string',help='specify skype profile path')
(options,args) = parser.parse_args()
pathName = options.pathName
if pathName == None:
print(parser.usage)
exit(0)
elif os.path.isdir(pathName) == False:
print('[!] Path Does Not Exist:' + pathName)
exit(0)
else:
downloadDB = os.path.join(pathName,'downloads.sqlite')
if os.path.isfile(downloadDB):
printDownloads(downloadDB)
else:
print('[!] Downloads Db does not exist:' + downloadDB)
cookiesDB = os.path.join(pathName,'cookies.sqlite')
if os.path.isfile(cookiesDB):
printCookies(cookiesDB)
else:
print('[!] Cooikes Db does not exist:' + cookiesDB)
placesDB = os.path.join(pathName,'places.sqlite')
if os.path.isfile(placesDB):
printHistory(placesDB)
printGoogle(placesDB)
else:
print('[!] PlacesDb does not exist:' + placesDB)
if __name__ == '__main__':
main()