I've spent the last several days looking for a solution to this issue and while I've tried several suggested solutions (in reading) all have failed. Ultimately what I want to do is just log into this site, from there I can take care of the rest. I know that the username is being passed successfully over, it's just the password is not being passed (I believe).

Courtesy of Data::Dumper here is the form and associated fields from the page:
$VAR1 = bless( { 'default_charset' => 'UTF-8', 'enctype' => 'application/x-www-form-urlencoded', 'accept_charset' => 'UNKNOWN', 'action' => bless( do{\(my $o = 'http://*_edit_*/proc +login')}, 'URI::http' ), 'method' => 'POST', 'attr' => { 'method' => 'POST', 'id' => 'fLogin' }, 'inputs' => [ bless( { 'value_name' => '', 'value' => '', 'name' => 'txtUserID', 'class' => 'TextInput', 'id' => 'txtUserID', 'type' => 'text', 'size' => '20' }, 'HTML::Form::TextInput' ), bless( { 'readonly' => 1, 'value_name' => '', 'value' => '', 'name' => 'sessionTermNum', 'id' => 'sessionTermNum', 'type' => 'hidden', 'size' => '20' }, 'HTML::Form::TextInput' ), bless( { 'value_name' => '', 'value' => '', 'onkeypress' => 'return vfnChe +ckKeyLogin(event);', 'name' => 'txtPassword', 'class' => 'TextInput', 'id' => 'txtPassword', 'type' => 'password', 'size' => '20' }, 'HTML::Form::TextInput' ), bless( { 'readonly' => 1, 'value_name' => '', 'value' => 'login', 'name' => 'cmd', 'id' => 'cmd', 'type' => 'hidden', 'size' => '20' }, 'HTML::Form::TextInput' ) ] }, 'HTML::Form' );
Here is my simple code that I believe should be working and I'm unable to figure out why:
#!/usr/bin/perl -w use strict; use WWW::Mechanize; use Data::Dumper; use LWP; my ($user,$pass) = ("$ARGV[0]","$ARGV[1]"); $user = chomp($user);$pass = chomp($pass); my $mech = WWW::Mechanize->new(); $mech -> cookie_jar(HTTP::Cookies->new()); $mech -> get('http://*_edit_*/Login.jsp'); $mech -> submit_form( form_id => 'fLogin', fields => { txtUserID => $user, txtPassword => $pass, } ); my $html_raw = $mech -> content(); print "\n$html_raw\n";


Thanks for reading and please excuse my Perlish n3wb c0de.
./Mogul


SOLUTION:

After watching the POST in Chrome's Developer Toolkit>Network Tab, I was able to see that the password was encrypted. I was able to take the string of encrypted text from the POST and hard-code it into my script to validate that I could log in.

Mogul

In reply to WWW::Mechanize form submit w/ password failing [SOLVED] by ogmogul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.