| 1 | package Finance::Bank::PNC; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 5 | 1 | ▶ | use WWW::Mechanize; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use HTML::TokeParser; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 0 | ▶ | sub check_PNC_balance { | ||||||||||||||||||||||||||
|
Subroutine
check_PNC_balance: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | 0 | my ( $class, %opts ) = @_; | |||||||||||||||||||||||||||
| 10 | 0 | my @accounts; | |||||||||||||||||||||||||||
| 11 | 0 | ▶ | croak "Must provide a user id" unless exists $opts{userId}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | croak "Must provide a password" unless exists $opts{password}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | my $self = bless {%opts}, $class; | |||||||||||||||||||||||||||
| 15 | 0 | my $mech = WWW::Mechanize->new(); | |||||||||||||||||||||||||||
| 16 | 0 | $mech->agent_alias('Windows Mozilla'); | |||||||||||||||||||||||||||
| 17 | 0 | $mech->cookie_jar( HTTP::Cookies->new() ); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | $mech->post( | ||||||||||||||||||||||||||||
| 20 | 'https://www.onlinebanking.pnc.com/alservlet/ValidateUserIdServlet', | ||||||||||||||||||||||||||||
| 21 | { hiddenAcctLetter => 'p', origin => 'p', userId => $opts{userId} } | ||||||||||||||||||||||||||||
| 22 | 0 | ▶ | ) or die "$!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | #Security Question | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $stream = HTML::TokeParser->new( \$mech->content() ) or die "$!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 0 | $stream->get_tag('table'); | |||||||||||||||||||||||||||
| 27 | 0 | $stream->get_tag('tr'); | |||||||||||||||||||||||||||
| 28 | 0 | $stream->get_tag('tr'); | |||||||||||||||||||||||||||
| 29 | 0 | $stream->get_tag('td'); | |||||||||||||||||||||||||||
| 30 | 0 | $stream->get_tag('td'); | |||||||||||||||||||||||||||
| 31 | 0 | print $stream->get_trimmed_text('/td'), "\n"; | |||||||||||||||||||||||||||
| 32 | 0 | my $answer = <>; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | $mech->post( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 'https://www.onlinebanking.pnc.com/alservlet/SigninChallengeServlet', | ||||||||||||||||||||||||||||
| 36 | { | ||||||||||||||||||||||||||||
| 37 | counter => 0, | ||||||||||||||||||||||||||||
| 38 | challengeErrorCounter => 0, | ||||||||||||||||||||||||||||
| 39 | bindDevice => 'no', | ||||||||||||||||||||||||||||
| 40 | answer => $answer | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | ) or die "$!"; | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | $mech->post( | ||||||||||||||||||||||||||||
| 45 | 'https://www.onlinebanking.pnc.com/alservlet/VerifyPasswordServlet', | ||||||||||||||||||||||||||||
| 46 | { | ||||||||||||||||||||||||||||
| 47 | counter => 0, | ||||||||||||||||||||||||||||
| 48 | passwordErrorCounter => 0, | ||||||||||||||||||||||||||||
| 49 | oldUserId => 12345, | ||||||||||||||||||||||||||||
| 50 | password => $opts{password} | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 0 | ▶ | ) or die "$!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | #Scraping account page | ||||||||||||||||||||||||||||
| 55 | 0 | ▶ | $stream = HTML::TokeParser->new( \$mech->content() ) or die "$!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 0 | $stream->get_tag('table'); | |||||||||||||||||||||||||||
| 57 | 0 | $stream->get_tag('tr'); | |||||||||||||||||||||||||||
| 58 | 0 | ▶ | while ( my $token = $stream->get_tag("tr") ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 0 | $token = $stream->get_tag("td"); | |||||||||||||||||||||||||||
| 60 | 0 | ▶ | last if ( $token->[1]{class} and $token->[1]{class} eq 'col213' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$token->[1]{"class"} and $token->[1]{"class"} eq "col213"
MC/DC0%0/2
$token->[1]{"class"} and $token->[1]{"class"} eq "col213"
$token->[1]{"class"}
$token->[1]{"class"} eq "col213"
Truth table0%0/3
A and B
A= $token->[1]{"class"}B= $token->[1]{"class"} eq "col213"
| |||||||||||||||||||||||||||||
| 61 | 0 | $stream->get_tag("td"); | |||||||||||||||||||||||||||
| 62 | 0 | my $type = $stream->get_trimmed_text("/td"); | |||||||||||||||||||||||||||
| 63 | 0 | $stream->get_tag("td"); | |||||||||||||||||||||||||||
| 64 | 0 | my $number = $stream->get_trimmed_text("/td"); | |||||||||||||||||||||||||||
| 65 | 0 | $stream->get_tag("td"); | |||||||||||||||||||||||||||
| 66 | 0 | my $balance = $stream->get_trimmed_text("/td"); | |||||||||||||||||||||||||||
| 67 | 0 | $stream->get_tag("td"); | |||||||||||||||||||||||||||
| 68 | 0 | my $available = $stream->get_trimmed_text("/td"); | |||||||||||||||||||||||||||
| 69 | 0 | push @accounts, | |||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||
| 71 | type => $type, | ||||||||||||||||||||||||||||
| 72 | account => $number, | ||||||||||||||||||||||||||||
| 73 | balance => $balance, | ||||||||||||||||||||||||||||
| 74 | available => $available | ||||||||||||||||||||||||||||
| 75 | }; | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | 0 | return @accounts; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | 1 | 1; | |||||||||||||||||||||||||||
| 80 | __END__ | ||||||||||||||||||||||||||||