mirror of
https://github.com/tiennm99/MTTools.git
synced 2026-10-11 12:19:09 +00:00
Update main.py
This commit is contained in:
1 parent
97213b87fc
commit
ffdba21976
1 file changed
+8
-15
@@ -9,13 +9,18 @@ import win32crypt # pip install pypiwin32
|
|||||||
from Crypto.Cipher import AES # pip install pycryptodome
|
from Crypto.Cipher import AES # pip install pycryptodome
|
||||||
|
|
||||||
# This is Windows version
|
# This is Windows version
|
||||||
# You may need to edit these values to match your OS
|
# You may want to edit these values to match your OS
|
||||||
local_state_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data",
|
local_state_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data",
|
||||||
"Local State")
|
"Local State")
|
||||||
cookies_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data", "Default",
|
cookies_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome", "User Data", "Default",
|
||||||
"Network", "Cookies")
|
"Network", "Cookies")
|
||||||
|
|
||||||
|
|
||||||
def convert_to_unix_time(expires_utc):
|
def convert_to_unix_time(expires_utc):
|
||||||
|
"""
|
||||||
|
:param expires_utc: microseconds diff since January, 1601
|
||||||
|
:return: epoch time in seconds
|
||||||
|
"""
|
||||||
if expires_utc == 0:
|
if expires_utc == 0:
|
||||||
return 0
|
return 0
|
||||||
# Define the start date as January 1, 1601
|
# Define the start date as January 1, 1601
|
||||||
@@ -28,18 +33,6 @@ def convert_to_unix_time(expires_utc):
|
|||||||
unix_time = (expires_date - epoch_start_date).total_seconds()
|
unix_time = (expires_date - epoch_start_date).total_seconds()
|
||||||
return unix_time
|
return unix_time
|
||||||
|
|
||||||
def get_chrome_datetime(chromedate):
|
|
||||||
"""Return a `datetime.datetime` object from a chrome format datetime
|
|
||||||
Since `chromedate` is formatted as the number of microseconds since January, 1601"""
|
|
||||||
if chromedate != 86400000000 and chromedate:
|
|
||||||
try:
|
|
||||||
return datetime(1601, 1, 1) + timedelta(microseconds=chromedate)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error: {e}, chromedate: {chromedate}")
|
|
||||||
return chromedate
|
|
||||||
else:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
|
|
||||||
def get_encryption_key():
|
def get_encryption_key():
|
||||||
working_local_state = "Local State"
|
working_local_state = "Local State"
|
||||||
@@ -90,8 +83,8 @@ def main():
|
|||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
# get the cookies from `cookies` table
|
# get the cookies from `cookies` table
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
SELECT host_key, name, value, encrypted_value, path, expires_utc, is_secure, is_httponly, has_expires, is_persistent, samesite
|
SELECT host_key, name, value, encrypted_value, path, expires_utc, is_secure, is_httponly, has_expires,
|
||||||
FROM cookies""")
|
is_persistent, samesite FROM cookies""")
|
||||||
|
|
||||||
encryption_key = get_encryption_key()
|
encryption_key = get_encryption_key()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user