aboutsummaryrefslogtreecommitdiffstats
path: root/extract_token_from_browser.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-06-29 01:31:39 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2023-06-29 22:15:55 +0200
commit6e8b8f80177937b99bb4fc74f62300632f0a4eae (patch)
treef1d996796db9cba41295855102ffb64f3bcbf427 /extract_token_from_browser.py
parentbf3f34ecd582b9ef57f208bf46493a444215cafb (diff)
downloadwee-slack-6e8b8f80177937b99bb4fc74f62300632f0a4eae.tar.gz
Refactor unsupported browser check
Diffstat (limited to 'extract_token_from_browser.py')
-rwxr-xr-xextract_token_from_browser.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/extract_token_from_browser.py b/extract_token_from_browser.py
index 2e1184c..4b54436 100755
--- a/extract_token_from_browser.py
+++ b/extract_token_from_browser.py
@@ -61,30 +61,32 @@ parser.add_argument(
)
args = parser.parse_args()
-if args.browser not in ["firefox", "firefox-snap", "chrome", "chrome-beta"]:
- print(
- "Currently only firefox. firefox-snap, chrome, "
- "chrome-beta are supported by this script",
- file=sys.stderr,
- )
- sys.exit(1)
-
if sys.platform.startswith("linux"):
iterations = 1
if args.browser == "firefox-snap":
browser_data = Path.home().joinpath("snap/firefox/common/.mozilla/firefox")
elif args.browser == "firefox":
browser_data = Path.home().joinpath(".mozilla/firefox")
- else:
+ elif args.browser in ["chrome", "chrome-beta"]:
browser_data = Path.home().joinpath(".config/google-%s" % args.browser)
+ else:
+ print(
+ f'Unsupported browser "{args.browser}" on platform Linux.', file=sys.stderr
+ )
+ sys.exit(1)
elif sys.platform.startswith("darwin"):
iterations = 1003
if args.browser in ["firefox", "firefox-snap"]:
browser_data = Path.home().joinpath(
"Library/Application Support/Firefox/Profiles"
)
- else:
+ elif args.browser in ["chrome", "chrome-beta"]:
browser_data = Path.home().joinpath("Library/Application Support/Chrome")
+ else:
+ print(
+ f'Unsupported browser "{args.browser}" on platform macOS.', file=sys.stderr
+ )
+ sys.exit(1)
else:
print("Currently only Linux and macOS is supported by this script", file=sys.stderr)
sys.exit(1)