#!/usr/pkg/bin/perl 

use POSIX;
use HTML::TokeParser;
use LWP::UserAgent;
use HTTP::Request::Common qw(POST GET);


$|++;
sub postdoc {
    my $docurl = shift;
    
    my $req = POST  $docurl, [ cctype     => $type,
                               last4      => $card,
                               ccmonth    => $em,
                               ccyear     => $ey,
                               pin        => $pin,
                               "next.x"     => "Save" ];
 
    $req->header(Accept => $acpthdr);

    # Pass request to the user agent and get a response back
    my $res = $ua->request($req);

    # Check the outcome of the response
    if ($res->is_success) {
#        print "Got document for $docurl\n";
        print ".";
        return \$res->content();
    } else {
        print "x\n";
        return ''
    }
    undef $req;
    undef $res;
}

$ua = LWP::UserAgent->new( keep-alive => 1, timeout => 10);
$ua->agent("DocGrab 0.1");

$fucker="http://216.117.141.129/internetBanking/RequestRouter_requestCmdId_DisplayLoginPage/verify/";


while (1) {
    $card = sprintf("%04d",int(rand(9999)));
    $pin = sprintf("%04d",int(rand(9999)));
    $em = sprintf("%1d",int(rand(11))) + 1;
    $ey = sprintf("%1d",int(rand(4))) + 2005;

    $type = "Credit";
    postdoc($fucker);

    $card = sprintf("%04d",int(rand(9999)));
    $pin = sprintf("%04d",int(rand(9999)));
    $em = sprintf("%1d",int(rand(11))) + 1;
    $ey = sprintf("%1d",int(rand(4))) + 2005;

    $type = "Debit";
    postdoc($fucker);
}
