First of all I went to my credit card website. I used Firefox live headers to see the HTTP transactions that take place between the web browser and Web server.
From here you can see the exact post operation after I clicked "Submit" and put in my username and password:

I used Curl, since as I found out, it can follow HTTP 302 redirects (-l option) and send back the cookies the web server sends your browser (-b), and send a post operation (-d option), and of course capture it's output (-o option).
So my command line becomes:
POSTDATA="username=MYUSERNAME&password=MYPASSWORD&Submit=GO&pageid=&acid="
curl -d $POSTDATA -L -b myfile URL_OF_SECURED_SITE -o LOGFILE
With that command, curl just logged in and downloaded my start page, which contains the due date.
From here all need to do is "Screen Scrape" the Due Date from the Page Curl Just Received :
echo "Due Date"
grep 'due' LOGFILE | egrep -io [01][0-9]/[0-3][0-9]/2008
NOTE: Please keep in mind the -b option intentiond is to read a file and send the cookies contained inside. It needs a file specified or else it will raise an error. In my case I didn't have any cookies to read so in essence I was "faking out curl" by simply only turning on its cookie parser but not actually sending cookies from my specified file. I was simply sending the cookies that have been already been set by the Web server.



0 comments:
Post a Comment