aboutsummaryrefslogtreecommitdiffstats
path: root/extract_token_from_browser.py
Commit message (Collapse)AuthorAgeFilesLines
* Close LevelDB connection in extract_token_from_browser.pyTrygve Aaberge2024-03-291-0/+2
| | | | | | This fixes an issue where the temporary directory couldn't be deleted after use because the connection to the LevelDB file in it was still open.
* Make the help text for --no-secretstorage more detailedTrygve Aaberge2023-12-131-1/+4
|
* Add no-secretstorage option for extract_token_from_browser.pyKrzysztof Konopko2023-12-131-15/+23
| | | | | | | | | | | On some Linux systems org.freedesktop.Secret D-Bus service is not available (installed/enabled), typically as a deliberate choice. In those cases `extract_token_from_browser.py` hands for the duration of D-Bus timeout and eventually fails. Note that it does not handle the timeout exception, so a fallback is not used. This commit adds `--no-secretstorage` option which skips using that service.
* Handle Firefox containers in extract_token_from_browser.py (#909)Toke Høiland-Jørgensen2023-10-181-7/+42
| | | | | | | | | | | | | | | | | | | | | The extract_token_from_browser.py script does not handle Firefox containers correctly. The container support works by namespacing cookies and local storage with a 'userContextId'. In effect this means that when containers are used, running the script will select the cookie from whichever container happens to be returned first by the database query, which will be combined with the non-containerised instance of the local storage. Add correct handling by adding a new --container flag which specifies a container either by numeric ID or by name, and including the correct userContextId into the cookie query and local storage path (or excluding all cookies from containers from the query if no --container flag is supplied). With this the script can be run like: python extract_token_from_browser.py --container Work firefox to get the Slack auth token for the 'Work' container. Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
* Fix indentation errorTrygve Aaberge2023-06-291-1/+1
| | | | | This line was wrongly indented after the merge conflict resolution in commit e86e05e.
* Update readme for extract_token_from_browser.py scriptTrygve Aaberge2023-06-291-1/+4
|
* Merge pull request #887 from frozencemetery/default-profileTrygve Aaberge2023-06-291-13/+50
|\
| * extract_token_from_browser: Add manual --profile-pathRobbie Harwood2023-03-131-14/+31
| | | | | | | | | | | | | | | | | | This flag overrides detction and uses the specified profile path. This helps when a non-default profile is used for Slack. It also helps if autodetection fails; accordingly, recommend use of the flag in that case. Signed-off-by: Robbie Harwood <rharwood@redhat.com>
| * extract_token_from_browser: use new local storage pathRobbie Harwood2023-03-131-4/+16
| | | | | | | | | | | | | | | | | | webappsstore.sqlite seems to be deprecated, and firefox is migrating to per-page locations. The values inside the database can be snappy-compressed, so handle decoding with a new dependency on python-snappy. Suggested by Trygve Aaberge. Signed-off-by: Robbie Harwood <rharwood@redhat.com>
| * extract_token_from_browser: read default from profiles.iniRobbie Harwood2023-03-131-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | Firefox's default profile can have several different name suffixes, including ".default-release", the legacy ".default", and others for different release channels. Rather than guessing, just parse profiles.ini to determine the default path. Suggested by Trygve Aaberge. Link: https://support.mozilla.org/gl/questions/1264072 Link: https://support.mozilla.org/en-US/kb/understanding-depth-profile-installation Signed-off-by: Robbie Harwood <rharwood@redhat.com>
* | Fix or ignore flake8 errorsTrygve Aaberge2023-06-291-1/+4
| |
* | Gracefully handle not finding Chrome local storage valuesTrygve Aaberge2023-06-291-1/+1
| |
* | Delete temp copy of leveldb after reading itTrygve Aaberge2023-06-291-11/+11
| |
* | Simplify defining cookie queriesTrygve Aaberge2023-06-291-24/+9
| |
* | Reorder some variablesTrygve Aaberge2023-06-291-14/+14
| |
* | Refactor get_cookiesTrygve Aaberge2023-06-291-11/+14
| |
* | Clearly separate code for Firefox and ChromeTrygve Aaberge2023-06-291-51/+61
| | | | | | | | | | This makes the code much easier to read in my opinion. It also fixes some errors about potentially unbound variables.
* | Don't try to read webappsstore.sqlite for ChromeTrygve Aaberge2023-06-291-10/+11
| | | | | | | | | | | | | | Although this file exists in the Chromium profile directory, it's empty. I would assume Chrome/Chromium always uses the LevelDB file, so there's no point in checking the webappsstore.sqlite file. Doing this allows us to refactor some code in the next commit.
* | Add support for Chromium in extract_token_from_browser.pyTrygve Aaberge2023-06-291-6/+7
| | | | | | | | | | | | 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.
* | Rename variable to be more descriptiveTrygve Aaberge2023-06-291-3/+3
| |
* | Fix path to Chrome profile on macOSTrygve Aaberge2023-06-291-1/+1
| |
* | Refactor unsupported browser checkTrygve Aaberge2023-06-291-10/+12
| |
* | Use a contextmanager for connecting to sqlite3Trygve Aaberge2023-06-291-14/+22
| |
* | Remove the token option from extract_token_from_browser.pyTrygve Aaberge2023-06-291-11/+7
| | | | | | | | | | I see no value of having this option, and it's just confusing since the script is meant for extracting the token.
* | Fix extract_token_from_browser.py for firefoxTrygve Aaberge2023-06-291-0/+2
| | | | | | | | The script didn't work anymore for firefox after commit c7868cc.
* | Fix usage of potentially unbound variablesTrygve Aaberge2023-06-291-2/+6
| |
* | Remove redundant pass statementsTrygve Aaberge2023-06-291-2/+0
| |
* | Fix incorrect placement of f for an f-stringTrygve Aaberge2023-06-291-2/+2
| |
* | Remove examples from top of extract_token_from_browser.pyTrygve Aaberge2023-06-291-4/+0
| | | | | | | | | | | | The script prints usage if you run it with --help, so I don't see a need for these examples. The examples are likely to get outdated when the script options are changed, so I rather not have them there.
* | Run black to format extract_token_from_browser.pyTrygve Aaberge2023-06-291-46/+52
| |
* | Firefox-snap and chrome/chrome-beta support (#884)Bogdan Dobrelya2023-06-291-30/+180
|/ | | | | | | | | | | | | | | | | | | * Add support for cookies decryption for Chrome/beta * Add support for firefox-snap, and multiple default/custom profiles paths * If no token can be found, like no key localConfig_v2 in webappsstore2, try the best to fetch it from leveldb (or online copy of it, if locked by running browser). When no luck even with that, suggest the user to fetch it manually from dev console, and pass it as an extra argument. This way it still saves some extra cycles for the script users by fetching d/d-s values, and formatting the ultimate registration command string. Not tested on Darwin, leaving this as an exercise for you Adding Chromium support should be straightforward and can be done in follow-ups. Signed-off-by: Bohdan Dobrelia <bdobreli@redhat.com> Co-authored-by: Bogdan Dobrelya <bogdando@mail.ru>
* Support including the d-s cookieTrygve Aaberge2022-09-181-4/+14
| | | | | According to one comment it was necessary for them to include this cookie as well.
* Improve output format for extract_token_from_browser.pyTrygve Aaberge2022-09-181-4/+8
|
* Don't list enterprise grid top level teamsTrygve Aaberge2022-09-181-1/+2
| | | | The individual teams in the enterprise grid is still listed.
* Add a script to get session tokens and cookies from FirefoxTrygve Aaberge2022-09-181-0/+50