Curl or Lynx scripting with Chrome Cookie

656 Views Asked by At

Just looking for someone to point me in the right direction. I need to script an interaction with a site that uses a "trust this device" cookie, and uses a log in portal. I found the cookie in Chrome, but not sure what to do next. This will be hosted on a CentOS 7 system.

After authenticating to the login portal, I need to access another page using the "trust this device" cookie and the session cookie so I can download files. Manually downloading files everyday gets tedious, and the owner of the site does not want to use SFTP.

Update 1 : There was some confusion in my request (I could have made it more clear), I am NOT looking for someone to "write code" for me. This is more a sanity check as I learn how this process works. Please simply point me in the right direction as far as tools and general procedure.

Update 2 : Using the "Copy as curl" option found in most web browsers, I was able to get the correct header information needed for authenticating.

Instead of

curl -b "xxx=xxx"

I needed

curl  -H "Cookie: XXXX="%"2Fwpsnew; xxx=xxx"

When adding the -c switch, I can now save the session cookie. Further testing is needed, but at least there is progress.

EDIT

Using the Chrome feature for copying curl commands from the history (this is found in Firefox as well), I was able to partially reproduce results. However in my case I was not able to log in as the site I was working with uses additional js that modifies the cookies.

This initial question can be closed, I will open a new post for more specific parts of my project.

0

There are 0 best solutions below