aboutsummaryrefslogtreecommitdiffstats
path: root/extract_token_from_browser.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-06-29 01:46:59 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2023-06-29 22:15:55 +0200
commitff81d48fdb72cc7bf273ecb4e48a37149befd266 (patch)
tree76fb9e5e3147ff8f31abec052ff09632972ffa08 /extract_token_from_browser.py
parenta77252086748326ff57f9b1d1022b98d740db022 (diff)
downloadwee-slack-ff81d48fdb72cc7bf273ecb4e48a37149befd266.tar.gz
Add support for Chromium in extract_token_from_browser.py
Chromium encrypted values start with v10, while Chrome values start with v11. I don't see any reason to check that the prefix is either of these really, just remove it unconditionally.
Diffstat (limited to 'extract_token_from_browser.py')
-rwxr-xr-xextract_token_from_browser.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/extract_token_from_browser.py b/extract_token_from_browser.py
index 6548f0e..b9407c7 100755
--- a/extract_token_from_browser.py
+++ b/extract_token_from_browser.py
@@ -67,6 +67,8 @@ if sys.platform.startswith("linux"):
browser_data = Path.home().joinpath("snap/firefox/common/.mozilla/firefox")
elif args.browser == "firefox":
browser_data = Path.home().joinpath(".mozilla/firefox")
+ elif args.browser == "chromium":
+ browser_data = Path.home().joinpath(".config/chromium")
elif args.browser in ["chrome", "chrome-beta"]:
browser_data = Path.home().joinpath(".config/google-%s" % args.browser)
else:
@@ -80,6 +82,8 @@ elif sys.platform.startswith("darwin"):
browser_data = Path.home().joinpath(
"Library/Application Support/Firefox/Profiles"
)
+ elif args.browser == "chromium":
+ browser_data = Path.home().joinpath("Library/Application Support/Chromium")
elif args.browser in ["chrome", "chrome-beta"]:
browser_data = Path.home().joinpath("Library/Application Support/Google/Chrome")
else:
@@ -115,8 +119,6 @@ else:
print("Missing required modules for Chrome browser support", file=sys.stderr)
raise import_err
- # b'v10' is for Chromium, but not Chrome, it seems?
- prefix = b"v11"
cookie_d_query = (
"SELECT encrypted_value FROM cookies WHERE "
"host_key = '.slack.com' AND name = 'd'"
@@ -143,7 +145,7 @@ except TypeError:
print("Couldn't find the 'd' cookie value", file=sys.stderr)
sys.exit(1)
-if args.browser in ["chrome", "chrome-beta"]:
+if args.browser in ["chromium", "chrome", "chrome-beta"]:
bus = secretstorage.dbus_init()
try:
collection = secretstorage.get_default_collection(bus)
@@ -167,10 +169,9 @@ if args.browser in ["chrome", "chrome-beta"]:
cipher = AESCipher(key)
- if cookie_d_value[:3] == prefix:
- cookie_d_value = cipher.decrypt(cookie_d_value[3:]).decode("utf8")
+ cookie_d_value = cipher.decrypt(cookie_d_value[3:]).decode("utf8")
- if cookie_ds_value and cookie_ds_value[:3] == prefix:
+ if cookie_ds_value:
cookie_ds_value = cipher.decrypt(cookie_ds_value[3:]).decode("utf8")
if cookie_ds_value: