using Perl to auto-login to capitalone.com

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default using Perl to auto-login to capitalone.com

    I am attempting to write a Perl script that can login to my account at capitalone.com,
    grab my balance and available credit and email them to me. I did this successfully with my
    online banking, but Capitalone's login is a pain in the ass to wrap my head around. It
    redirects you through 3 or pages before an actual login screen and sets cookies at each
    one. On one of the last pages, it has JavaScript that generates some more cookies. So far,
    I've got:


    #!/usr/bin/perl

    use LWP::UserAgent;
    use HTTP::Cookies;

    my $res, $req;
    my $ua = LWP::UserAgent->new;
    $ua->cookie_jar(HTTP::Cookies->new(file => "bankcookies.txt", autosave => 1));

    $req = HTTP::Request->new(GET => 'http://www.capitalone.com/indexrfa.php');
    $res = $ua->request($req);
    #$req = HTTP::Request->new(GET =>
    'http://www.capitalone.com/redirect.html?Log=1&linkid=WWW_Z_Z_Z_HMLFT_L1_01_G _OASL&dest=https://service.capitalone.com/cgi/Home?Login');
    #$res = $ua->request($req);
    #print $res->as_string;
    $req = HTTP::Request->new(GET => 'https://service.capitalone.com/cgi/Home?Login');
    $res = $ua->request($req);
    #print $res->as_string;
    $req = HTTP::Request->new(GET =>
    'https://service.capitalone.com/oas_secure/oas/login.do?objectclicked=LoginSplash');
    $res = $ua->request($req);
    print $res->as_string;


    I'm not sure how much of the above is actually necessary, but those are the pages that you
    go through when manually logging in. That last page is where it starts using JavaScript to
    generate cookies just to make sure that you have JavaScript and cookies enabled in the
    browser. Can anyone help me out? Thanks.

    --
    Andrew Gaffney
    System Administrator
    Skyline Aeronautics, LLC.
    776 North Bell Avenue
    Chesterfield, MO 63005
    636-357-1548

    Andrew Gaffney Guest

  2. Similar Questions and Discussions

    1. Cross Domain Auto Login
      I have multiple asp.net websites living in different domains. The websites (pages, code, etc) are all identical. The databases driving the...
    2. perl module to prevent auto registration scripts
      Hello all, I am writing a web based registration module. I want to prevent people writing automated scripts ( like using lwp ) and auto register...
    3. Windows Auto Login
      Hi, this may not strictly be a lingo question, but I was hoping someone who has had a similar problem may have an answer. We have a digital...
    4. Auto Login on Solaris 8 x86
      I need a way of doing an auto login of an user after a reboot. Is it possible? (on solaris 8 x86) --------------------------------------- Andre...
    5. perl\site\lib\auto\... (DLLs, LIB, EXP etc) to another location under your dev directory?
      Would it be possible to move support files under perl\site\lib\auto\... (DLLs, LIB, EXP etc) to another location under your dev directory? I am...
  3. #2

    Default capturing a webpage in a variable

    IS this how I capture a web page code to a variable?
    > #!/usr/bin/perl
    >
    > use LWP::UserAgent;
    >
    > my $req;
    > my $ua = LWP::UserAgent->new;
    > $req = HTTP::Request->new(GET => 'http://www.yahoo.com');
    print $req; ## ?????????????
    from here I can print at the code for the web page?


    ################################################## ######3

    Luinrandir Hernsen Guest

  4. #3

    Default Re: using Perl to auto-login to capitalone.com

    Have you look at WWW::Mechanize on CPAN. It seems to make navigating
    sites (virtually) and using forms, etc. much easier.

    It's worth a shot.

    HTH,
    Kevin

    On Wed, 2004-01-28 at 02:37, Andrew Gaffney wrote:
    > I am attempting to write a Perl script that can login to my account at capitalone.com,
    > grab my balance and available credit and email them to me. I did this successfully with my
    > online banking, but Capitalone's login is a pain in the ass to wrap my head around. It
    > redirects you through 3 or pages before an actual login screen and sets cookies at each
    > one. On one of the last pages, it has JavaScript that generates some more cookies. So far,
    > I've got:
    >
    >
    > #!/usr/bin/perl
    >
    > use LWP::UserAgent;
    > use HTTP::Cookies;
    >
    > my $res, $req;
    > my $ua = LWP::UserAgent->new;
    > $ua->cookie_jar(HTTP::Cookies->new(file => "bankcookies.txt", autosave => 1));
    >
    > $req = HTTP::Request->new(GET => 'http://www.capitalone.com/indexrfa.php');
    > $res = $ua->request($req);
    > #$req = HTTP::Request->new(GET =>
    > 'http://www.capitalone.com/redirect.html?Log=1&linkid=WWW_Z_Z_Z_HMLFT_L1_01_G _OASL&dest=https://service.capitalone.com/cgi/Home?Login');
    > #$res = $ua->request($req);
    > #print $res->as_string;
    > $req = HTTP::Request->new(GET => 'https://service.capitalone.com/cgi/Home?Login');
    > $res = $ua->request($req);
    > #print $res->as_string;
    > $req = HTTP::Request->new(GET =>
    > 'https://service.capitalone.com/oas_secure/oas/login.do?objectclicked=LoginSplash');
    > $res = $ua->request($req);
    > print $res->as_string;
    >
    >
    > I'm not sure how much of the above is actually necessary, but those are the pages that you
    > go through when manually logging in. That last page is where it starts using JavaScript to
    > generate cookies just to make sure that you have JavaScript and cookies enabled in the
    > browser. Can anyone help me out? Thanks.
    >
    > --
    > Andrew Gaffney
    > System Administrator
    > Skyline Aeronautics, LLC.
    > 776 North Bell Avenue
    > Chesterfield, MO 63005
    > 636-357-1548
    --
    Kevin Old <kold@kold.homelinux.com>

    Kevin Old Guest

  5. #4

    Default Re: using Perl to auto-login to capitalone.com

    Kevin Old wrote:
    >
    > Have you look at WWW::Mechanize on CPAN. It seems to make navigating
    > sites (virtually) and using forms, etc. much easier.
    >
    > It's worth a shot.
    Seconded.

    It's definitely worthwhile for well-behaved sites, but can be tricky
    to debug if the site doesn't behave as you expect.

    Rob


    Rob Dixon Guest

  6. #5

    Default Re: using Perl to auto-login to capitalone.com

    > I am attempting to write a Perl script that can login to my account at
    capitalone.com,
    > grab my balance and available credit and email them to me. I did this
    successfully with my
    > online banking, but Capitalone's login is a pain in the ass to wrap my
    head around. It
    > redirects you through 3 or pages before an actual login screen and
    sets cookies at each
    > one. On one of the last pages, it has JavaScript that generates some
    more cookies. So far,
    > I've got:
    >
    <snip code>
    >
    > I'm not sure how much of the above is actually necessary, but those
    are the pages that you
    > go through when manually logging in. That last page is where it starts
    using JavaScript to
    > generate cookies just to make sure that you have JavaScript and
    cookies enabled in the
    > browser. Can anyone help me out? Thanks.
    >
    Just a couple thoughts. Make sure you aren't violating user agreements,
    etc. Some instituitions could view this as a denial of service
    depending on how often you intend to run it, etc.

    Because you are looking to wrangle the HTTP request/response headers,
    etc. there is a new (to me at least) extension for the Firebird
    (Mozilla) browser, Live HTTP Headers, that allows you to view and
    capture as you are browsing all of the actual response/request headers.
    This might help show exactly what is happening in the browser making it
    easier to mimic in LWP or whatever.

    More here:
    [url]http://www.texturizer.net/firebird/extensions/#livehttpheaders[/url]

    Very cool for web app developers...

    [url]http://danconia.org[/url]
    Wiggins D Anconia Guest

  7. #6

    Default Re: capturing a webpage in a variable

    On Wed, 28 Jan 2004, Luinrandir Hernsen wrote:
    > IS this how I capture a web page code to a variable?
    >
    > > #!/usr/bin/perl
    > >
    > > use LWP::UserAgent;
    > >
    > > my $req;
    > > my $ua = LWP::UserAgent->new;
    > > $req = HTTP::Request->new(GET => 'http://www.yahoo.com');
    >
    > print $req; ## ?????????????
    > from here I can print at the code for the web page?
    >
    print $req->as_string; #print the html

    --
    Maranatha!
    John McKown

    John McKown Guest

  8. #7

    Default Re: using Perl to auto-login to capitalone.com

    It does not appear that this module would solve my problem. It won't handle the JavaScript
    generation of cookies.

    Kevin Old wrote:
    > Have you look at WWW::Mechanize on CPAN. It seems to make navigating
    > sites (virtually) and using forms, etc. much easier.
    >
    > It's worth a shot.
    >
    > HTH,
    > Kevin
    >
    > On Wed, 2004-01-28 at 02:37, Andrew Gaffney wrote:
    >
    >>I am attempting to write a Perl script that can login to my account at capitalone.com,
    >>grab my balance and available credit and email them to me. I did this successfully with my
    >>online banking, but Capitalone's login is a pain in the ass to wrap my head around. It
    >>redirects you through 3 or pages before an actual login screen and sets cookies at each
    >>one. On one of the last pages, it has JavaScript that generates some more cookies. So far,
    >>I've got:
    >>
    >>
    >>#!/usr/bin/perl
    >>
    >>use LWP::UserAgent;
    >>use HTTP::Cookies;
    >>
    >>my $res, $req;
    >>my $ua = LWP::UserAgent->new;
    >>$ua->cookie_jar(HTTP::Cookies->new(file => "bankcookies.txt", autosave => 1));
    >>
    >>$req = HTTP::Request->new(GET => 'http://www.capitalone.com/indexrfa.php');
    >>$res = $ua->request($req);
    >>#$req = HTTP::Request->new(GET =>
    >>'http://www.capitalone.com/redirect.html?Log=1&linkid=WWW_Z_Z_Z_HMLFT_L1_01_G _OASL&dest=https://service.capitalone.com/cgi/Home?Login');
    >>#$res = $ua->request($req);
    >>#print $res->as_string;
    >>$req = HTTP::Request->new(GET => 'https://service.capitalone.com/cgi/Home?Login');
    >>$res = $ua->request($req);
    >>#print $res->as_string;
    >>$req = HTTP::Request->new(GET =>
    >>'https://service.capitalone.com/oas_secure/oas/login.do?objectclicked=LoginSplash');
    >>$res = $ua->request($req);
    >>print $res->as_string;
    >>
    >>
    >>I'm not sure how much of the above is actually necessary, but those are the pages that you
    >>go through when manually logging in. That last page is where it starts using JavaScript to
    >>generate cookies just to make sure that you have JavaScript and cookies enabled in the
    >>browser. Can anyone help me out? Thanks.
    --
    Andrew Gaffney
    System Administrator
    Skyline Aeronautics, LLC.
    776 North Bell Avenue
    Chesterfield, MO 63005
    636-357-1548

    Andrew Gaffney Guest

  9. #8

    Default Re: using Perl to auto-login to capitalone.com

    Wiggins d Anconia wrote:
    >>I am attempting to write a Perl script that can login to my account at
    >
    > capitalone.com,
    >
    >>grab my balance and available credit and email them to me. I did this
    >
    > successfully with my
    >
    >>online banking, but Capitalone's login is a pain in the ass to wrap my
    >
    > head around. It
    >
    >>redirects you through 3 or pages before an actual login screen and
    >
    > sets cookies at each
    >
    >>one. On one of the last pages, it has JavaScript that generates some
    >
    > more cookies. So far,
    >
    >>I've got:
    >>
    >
    >
    > <snip code>
    >
    >>I'm not sure how much of the above is actually necessary, but those
    >
    > are the pages that you
    >
    >>go through when manually logging in. That last page is where it starts
    >
    > using JavaScript to
    >
    >>generate cookies just to make sure that you have JavaScript and
    >
    > cookies enabled in the
    >
    >>browser. Can anyone help me out? Thanks.
    >>
    >
    >
    > Just a couple thoughts. Make sure you aren't violating user agreements,
    > etc. Some instituitions could view this as a denial of service
    > depending on how often you intend to run it, etc.
    >
    > Because you are looking to wrangle the HTTP request/response headers,
    > etc. there is a new (to me at least) extension for the Firebird
    > (Mozilla) browser, Live HTTP Headers, that allows you to view and
    > capture as you are browsing all of the actual response/request headers.
    > This might help show exactly what is happening in the browser making it
    > easier to mimic in LWP or whatever.
    >
    > More here:
    > [url]http://www.texturizer.net/firebird/extensions/#livehttpheaders[/url]
    >
    > Very cool for web app developers...
    That is a very cool plugin. It appears to work with Mozilla, also. I think that will help
    a lot. Thanks.

    --
    Andrew Gaffney
    System Administrator
    Skyline Aeronautics, LLC.
    776 North Bell Avenue
    Chesterfield, MO 63005
    636-357-1548

    Andrew Gaffney Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139