I am trying to knock up a quick DOS based app in C# to assist me with some tedius tasks I have to perform on websites every so often. One of the pages I need to access requires you to be logged in to view the source. This shouldn't really be a problem, I have a valid username and password. I found this question here:
which tells me how I can send a POST request to a specific URL and retrieve a cookie from the header for future use with any page that requires me to be logged in.
This would work nicely if it wasn't for the fact that the POST form on the login page is a little more complicated than just a "username" and "password" field. Looking at the form it has an "OnSubmit" call to a javascript function, which takes the username and password and encrypts them into some kind of hash (maybe md5 plus a little extra bits and bobs) then saves them in further hidden fields in the login form.
I was thinking it is probably possible to run the javascript function from C# somehow? If I could maybe retrieve the HTML file (with included JS) and then run that JS function from with C# and then retrieve the cookie from the POST request the JS effectively sends. A further complication may lie in the fact that I am not sure if the JS function is stored locally or is linked in via a tag.