I am using bash to to POST to a website that requires that I be logged in first. So I need to send the request with login cookie. So I tried logging in and keeping the cookies, but it doesn't work because the site uses javascript to hash the password in a really weird fashion, so instead I'm going to just take my login cookies for the site from Chrome. How do get the cookies from Chrome and format them for Curl?
I'm trying to do this:
curl --request POST -d "a=X&b=Y" -b "what goes here?" "site.com/a.php"
To hand over cookies from one browser to another you most likely will have to copy-paste cookie's properties. This works if you have just a handful of cookies, but it requires manually copy-and-past for each one.
For Google Chrome go to View > Developer > Developer Tools or CMD + ALT + I on Mac or F12 on Windows. Now open the Application tab and check the cookies for each domain. Usually the cookies have names that resemble the name of the service they are being used by.
Yes it is possible. how hard it would be? Depends on what mechanism is used by Gmail to identify if it is the same browser.
This will give you the curl command for the action you triggered, fully populated with cookies and all. You can of course also copy the flags as a basis for new curl commands.
In Chrome:
In the terminal
--cookie "cookiename=cookievalue"
to your curl request.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With