HackBrowserData icon indicating copy to clipboard operation
HackBrowserData copied to clipboard

Change formatting of cookies to be importable

Open jamiekarvans opened this issue 2 years ago • 3 comments

Hi, the cookies can not be imported to browsers like Firefox... Using different extensions to import yet there is no luck, can you please change the formatting inside the file so that it could be imported? And if you have another way to import them would you mind please share

jamiekarvans avatar Apr 10 '23 02:04 jamiekarvans

here is the correct importable format of cookies:

        if host_key and name and value != "":
            f.write(f"{host_key}\t{'FALSE' if expires_utc == 0 else 'TRUE'}\t{path}\t{'FALSE' if host_key.startswith('.') else 'TRUE'}\t{expires_utc}\t{name}\t{value}\n")

and usually in netscape format here is an example:

.ifmt.co.uk TRUE / FALSE 13354770892000000 __stripe_mid f9dca276-f11d-4db4-94da-69842a9e961679515d

jamiekarvans avatar Apr 11 '23 18:04 jamiekarvans

Hello, i wrote this short python program which does the conversion from json to netscape format, i had to use the dateparser library (the stdlib one doesn't support timezones very well) so don't forget to add it with pip install dateparser.

https://gist.github.com/ahmedlahrizi/aa5e7648f1f4ca1c8794e94c1d618aee

To import it use the cookie quick manager extension on firefox, there should be one that supports the format for chrome: https://addons.mozilla.org/fr/firefox/addon/cookie-quick-manager/

I personnally think you should add a way to export cookies to netscape format so that you could import them on browsers, or just link this program to the README file.

lennon03 avatar Aug 22 '23 11:08 lennon03

Hello, i wrote this short python program which does the conversion from json to netscape format, i had to use the dateparser library (the stdlib one doesn't support timezones very well) so don't forget to add it with pip install dateparser.

https://gist.github.com/ahmedlahrizi/aa5e7648f1f4ca1c8794e94c1d618aee

To import it use the cookie quick manager extension on firefox, there should be one that supports the format for chrome: https://addons.mozilla.org/fr/firefox/addon/cookie-quick-manager/

I personnally think you should add a way to export cookies to netscape format so that you could import them on browsers, or just link this program to the README file.

thanx but your script doesn't work trows this error Traceback (most recent call last): File "C:\Users\rdayy\OneDrive\Desktop\ns_cookies.py", line 10, in <module> s = json.load(db) ^^^^^^^^^^^^^ File "C:\Users\rdayy\AppData\Local\Programs\Python\Python311\Lib\json\__init__.py", line 293, in load return loads(fp.read(), ^^^^^^^^^ File "C:\Users\rdayy\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 691705: character maps to <undefined>

jamiekarvans avatar Sep 18 '23 23:09 jamiekarvans