line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Finance::Bank::PNC; |
2
|
1
|
|
|
1
|
|
5413
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
61
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
1
|
|
|
1
|
|
1075
|
use WWW::Mechanize; |
|
1
|
|
|
|
|
401675
|
|
|
1
|
|
|
|
|
74
|
|
6
|
1
|
|
|
1
|
|
15
|
use HTML::TokeParser; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
664
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub check_PNC_balance { |
9
|
0
|
|
|
0
|
0
|
|
my ( $class, %opts ) = @_; |
10
|
0
|
|
|
|
|
|
my @accounts; |
11
|
0
|
0
|
|
|
|
|
croak "Must provide a user id" unless exists $opts{userId}; |
12
|
0
|
0
|
|
|
|
|
croak "Must provide a password" unless exists $opts{password}; |
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
|
0
|
0
|
|
|
|
|
$mech->post( |
20
|
|
|
|
|
|
|
'https://www.onlinebanking.pnc.com/alservlet/ValidateUserIdServlet', |
21
|
|
|
|
|
|
|
{ hiddenAcctLetter => 'p', origin => 'p', userId => $opts{userId} } |
22
|
|
|
|
|
|
|
) or die "$!"; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#Security Question |
25
|
0
|
0
|
|
|
|
|
my $stream = HTML::TokeParser->new( \$mech->content() ) or die "$!"; |
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
|
0
|
|
|
|
|
$mech->post( |
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
|
0
|
0
|
|
|
|
|
$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
|
|
|
|
|
|
|
) or die "$!"; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
#Scraping account page |
55
|
0
|
0
|
|
|
|
|
$stream = HTML::TokeParser->new( \$mech->content() ) or die "$!"; |
56
|
0
|
|
|
|
|
|
$stream->get_tag('table'); |
57
|
0
|
|
|
|
|
|
$stream->get_tag('tr'); |
58
|
0
|
|
|
|
|
|
while ( my $token = $stream->get_tag("tr") ) { |
59
|
0
|
|
|
|
|
|
$token = $stream->get_tag("td"); |
60
|
0
|
0
|
0
|
|
|
|
last if ( $token->[1]{class} and $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; |
80
|
|
|
|
|
|
|
__END__ |