Of course you can POST any data you like to a HTTP server, with LWP::UserAgent for example, and I'm quite sure WWW::Mechanize allows that as well. Your perl script doesn't hit any button, it just sends data to the server.
All a server does is send data to a user agent - and that data has the form of HTML with embedded javascript - it doesn' t have any kind of control over how the user agent interprets the data.
So all your script has to do is to send the same data as a web browser would do.
If you don't want a general solution, but only one that works for you, there might be shortcut. If you look at that function again:
function validate_form(form)
{
if ( form.user_id.value == "" || form.password.value == "" )
{
alert( "Enter a username and password." );
return false;
}
//short-cut if challenge/response is disabled.
if ( !_useChallenge )
{
form.encoded_pw.value = base64encode( form.password.value );
form.encoded_pw_unicode.value = b64_unicode( form.password.value )
+;
form.password.value = "";
return true;
}
...
}
There seems to be a chance that the system accepts login without challenge/response, so all you have to do is to login once manually, and record the the values that are stored in form.encoded_pw_unicode and in the username field, and then uses this data each time you want to log in. |