Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox support wanted? #48

Closed
grandchild opened this issue Jun 21, 2023 · 5 comments
Closed

Firefox support wanted? #48

grandchild opened this issue Jun 21, 2023 · 5 comments

Comments

@grandchild
Copy link
Collaborator

grandchild commented Jun 21, 2023

My Issue

I'd like to add Firefox support, and want to gauge interest.

WHYT

I have implemented a basic Firefox cookie retrieval method that even works while Firefox is running (which has a lock on the cookies.sqlite DB).

  • Would you be interested in a PR adding this feature?
  • If yes, would you prefer I add a new source file (currently it's all one python file)?
@n8henrie
Copy link
Owner

Hi -- I'm traveling so apologies if responses are delayed, and thanks for creating an issue for this.

I'm primarily a Firefox user (created this extension before learning the true gospel of FF haha), so yes I would be happy to have FF support. A PR to this effect would be appreciated!

I would probably refactor into a separate module.

@grandchild
Copy link
Collaborator Author

Cool! That's nice to hear, so I'll start working on this.

I'll create a firefox_cookies() method that behaves the same as chrome_cookies(), to get us started. In a later PR, one could think about such things as "Get a cookie to this website, don't care about the browser, just search all available".

My initial PR will target Linux, I can test on Windows, but I can't really test Mac. But I guess in the end it's all about the canonical paths.

@n8henrie
Copy link
Owner

Sounds great. I can test on Linux and Mac. I don't support windows, as I don't have any windows devices and don't know it well.

grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 2, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Fixes n8henrie#48.
@grandchild
Copy link
Collaborator Author

I finally got it to a reviewable state 😄 -- The code itself was done in hours, but the unit tests gave me some grief. But it's all working now 🎉

More in the PR...

grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 2, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Fixes n8henrie#48.
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 2, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 2, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 2, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 2, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
@grandchild grandchild mentioned this issue Jul 2, 2023
4 tasks
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 7, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 22, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
grandchild added a commit to grandchild/pycookiecheat that referenced this issue Jul 22, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes n8henrie#48.
@grandchild
Copy link
Collaborator Author

#50 is merged.

n8henrie pushed a commit that referenced this issue Sep 22, 2023
Add a new `firefox_cookies()`, similar to `chrome_cookies()`. The
arguments are slightly different:

  - `profile_name` instead of `cookie_file`, since Firefox supports
    multiple profiles in the default config directory. `profile_name`
    may be a glob pattern because Firefox profiles have a random
    prefix that's not directly user-visible or -maintained.
  - No `password` argument, since Firefox doesn't encrypt its cookies.

Firefox stores its cookies in an SQLite3 database file. While Firefox
is running, the database is locked, so the code makes a temporary
copy of it before reading cookies from it.

If no `profile_name` is given the default profile will be returned, by
parsing the `profiles.ini` file in the Firefox config directory. This
can be overridden by passing a profile name or pattern to
`profile_name`.

A note on the unit tests: They don't test the scenario where Firefox
is running while getting the cookies. This is because the synchronous
playwright API doesn't support yielding from inside the running `with`
context manager. The asynchronous API probably does, but I haven't
looked into using that. Nonetheless the code supports retrieving
cookies while Firefox is running.

Closes #48.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants