diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-06-29 01:31:39 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2023-06-29 22:15:55 +0200 |
commit | 6e8b8f80177937b99bb4fc74f62300632f0a4eae (patch) | |
tree | f1d996796db9cba41295855102ffb64f3bcbf427 | |
parent | bf3f34ecd582b9ef57f208bf46493a444215cafb (diff) | |
download | wee-slack-6e8b8f80177937b99bb4fc74f62300632f0a4eae.tar.gz |
Refactor unsupported browser check
-rwxr-xr-x | extract_token_from_browser.py | 22 |
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) |