aboutsummaryrefslogtreecommitdiffstats
path: root/extract_token_from_browser.py
diff options
context:
space:
mode:
Diffstat (limited to 'extract_token_from_browser.py')
-rwxr-xr-xextract_token_from_browser.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/extract_token_from_browser.py b/extract_token_from_browser.py
index d42bd5b..a4a0d2c 100755
--- a/extract_token_from_browser.py
+++ b/extract_token_from_browser.py
@@ -4,6 +4,7 @@ import argparse
from configparser import ConfigParser
import json
from pathlib import Path
+from snappy import snappy
import sqlite3
import sys
@@ -62,12 +63,23 @@ if cookie_ds_values:
else:
cookie_value = cookie_d_value
-local_storage_path = default_profile_path.joinpath("webappsstore.sqlite")
-con = sqlite3.connect(f"file:{local_storage_path}?immutable=1", uri=True)
-local_storage_query = "SELECT value FROM webappsstore2 WHERE key = 'localConfig_v2'"
-local_config_str = con.execute(local_storage_query).fetchone()[0]
+storage_path = default_profile_path.joinpath(
+ "storage/default/https+++app.slack.com/ls/data.sqlite"
+)
+con = sqlite3.connect(f"file:{storage_path}?immutable=1", uri=True)
+storage_query = "SELECT compression_type, conversion_type, value FROM data WHERE key = 'localConfig_v2'"
+is_compressed, conversion, payload = con.execute(storage_query).fetchone()
con.close()
+if is_compressed:
+ payload = snappy.decompress(payload)
+
+if conversion == 1:
+ local_config_str = payload.decode("utf-8")
+else:
+ # untested; possibly Windows-only?
+ local_config_str = payload.decode("utf-16")
+
local_config = json.loads(local_config_str)
teams = [
team for team in local_config["teams"].values() if not team["id"].startswith("E")