Having Trouble with a CGI login script

Discussion in 'Perl Misc' started by WhiteFungus@gmail.com, Jan 5, 2005.

  1. Guest

    I am trying to script a program to autologin for me with the following
    HTML code data. Although for some reason I can not seem to be able to
    fill the password field properly with WWW::Mechanize. Is the some
    hidden jewel of syntax structure I am not yet aware of? Any help
    concerning this issue would be much appreciated! :)

    -Thanks in advance.
    _______________________________________________________________


    #!usr/bin/perl

    use WWW::Mechanize;
    use WWW::Mechanize::FormFiller;

    my $mech = WWW::Mechanize->new();
    my $formfiller = WWW::Mechanize::FormFiller->new();

    my $username = "user_name";
    my $password = "password";
    my $url = "http://www.myurl.com/default.aspx";

    # Grab the home page, and click the login button to redirect to the
    correct page(HTML listed below).
    $mech->get($url);
    $mech->click_button(number => 1);

    # Set the username and password fields accordingly and submit.
    $mech->set_visible( $username, [password => $password] ) ;
    $mech->submit();

    # Store new HTML content in a temporary file and open it for viewing.
    $html = $mech->content();
    open (OUT,">tmp.html");
    print OUT $html;
    close (OUT);
    system("tmp.html");


    _______________________________________________________________


    <html>
    <head>
    <title>Login</title>
    </head>
    <body bgcolor="#FFFFFF">
    <form id="frmLogin" name="frmLogin" method="post"
    action="Login.aspx?__ufps=933290">
    <input type="hidden" name="__VIEWSTATE"
    value="aDxfX1A7QDw716znrKftnYTgo4csMTs+Oz6urRmZvy6aJZj20y+gGEkgSS1/NA==">
    <input type="hidden" name="__EVENTTARGET" value="">
    <input type="hidden" name="__EVENTARGUMENT" value="">
    <script language=javascript><!--
    function __doPostBack(target, argument){
    var theform = document.frmLogin
    theform.__EVENTTARGET.value = target
    theform.__EVENTARGUMENT.value = argument
    theform.submit()
    }
    // -->
    </script>
    <font size="-1" color="Black">Authorized users, please enter your
    trading user ID and password:<br>
    Please enter your user ID:<br>
    <input name="txtUID" size="32"/><br>
    Please enter your password:<br>
    <input name="txtPWD" size="32" type="password"/><br>
    <input name="cmdGo" type="image" src="Brand/00/go.gif" alt="Go"/><br>
    <input name="cmdHomeFromfrmLogin" type="image" src="Brand/00/home.gif"
    alt="Home"/></font></form></body></html>
    _______________________________________________________________
     
    , Jan 5, 2005
    #1
    1. Advertising

  2. <> wrote:

    > #!usr/bin/perl



    use warnings;
    use strict;


    You should ask for all the help you can get.


    > system("tmp.html");

    ^^^^^^^^

    That is an odd name for an executable program...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jan 6, 2005
    #2
    1. Advertising

  3. Guest

    Hi,

    Thanks for that info. Can you tell me anything
    about Javascript::SHA1 or Javascript::MD5? They seem
    to be implementable but I'm not certain of their
    capabilities.

    Thanks again, hope I can crack the code!
     
    , Jan 6, 2005
    #3
  4. Guest

    I found out what the problem is. The errors are not syntaxal. As it
    turns out, the problem lays in that i'm attempteing to axcess a
    javascript with PERL.
     
    , Jan 6, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jozef
    Replies:
    0
    Views:
    744
    Jozef
    Nov 15, 2005
  2. epsilon
    Replies:
    4
    Views:
    347
    Gabriel Genellina
    Aug 22, 2007
  3. Jozef
    Replies:
    0
    Views:
    191
    Jozef
    Nov 15, 2005
  4. Replies:
    1
    Views:
    159
    Paul Lalli
    Jan 6, 2005
  5. kath
    Replies:
    4
    Views:
    739
    J. Gleixner
    Apr 9, 2007
Loading...

Share This Page