| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Finance::Bank::ES::INGDirect; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25213
|
use WWW::Mechanize; |
|
|
1
|
|
|
|
|
253397
|
|
|
|
1
|
|
|
|
|
52
|
|
|
4
|
1
|
|
|
1
|
|
1223
|
use HTML::Tree; |
|
|
1
|
|
|
|
|
40453
|
|
|
|
1
|
|
|
|
|
48
|
|
|
5
|
1
|
|
|
1
|
|
15
|
use Digest::MD5 qw (md5_base64); |
|
|
1
|
|
|
|
|
15
|
|
|
|
1
|
|
|
|
|
92
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1435
|
|
|
8
|
|
|
|
|
|
|
our $VERSION='0.04'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $inicio='https://www.ingdirect.es/WebTransactional/Transactional/AccesoClientes.asp'; |
|
12
|
|
|
|
|
|
|
my $cpin='https://www.ingdirect.es/WebTransactional/Transactional/clientes/access/Cappin.asp'; |
|
13
|
|
|
|
|
|
|
my $imagenes="https://www.ingdirect.es/WebTransactional/Transactional/clientes/images/acceso/"; |
|
14
|
|
|
|
|
|
|
my $todosdatos="https://www.ingdirect.es/WebTransactional/Transactional/clientes/position/globalinf_all_products.asp?opcion1=1&opcion2=1"; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub entra { |
|
17
|
0
|
|
|
0
|
0
|
|
my($self,$clave,$documento,$tipo,$fechan)=(@_); |
|
18
|
0
|
|
|
|
|
|
$self = {}; |
|
19
|
0
|
|
|
|
|
|
bless $self; |
|
20
|
0
|
|
|
|
|
|
my ($birthDay,$birthMonth,$birthYear)=split("/",$fechan); |
|
21
|
0
|
|
|
|
|
|
my @aclave=split "",$clave; |
|
22
|
0
|
|
|
|
|
|
my %numeros; |
|
23
|
|
|
|
|
|
|
my %posicion; |
|
24
|
0
|
|
|
|
|
|
$numeros{2}="kGZIA+MhSDZwAJNbKPVQuw"; |
|
25
|
0
|
|
|
|
|
|
$numeros{0}="/G8ZknsmSdWsGKieoJPTAQ"; |
|
26
|
0
|
|
|
|
|
|
$numeros{1}="gzlcyXsBJ39n4/zwAxXcuQ"; |
|
27
|
0
|
|
|
|
|
|
$numeros{6}="gbuU5oA87kDZVI/6iFHwqQ"; |
|
28
|
0
|
|
|
|
|
|
$numeros{5}="oYkWYg/mzWdTQ5/tWKIbiw"; |
|
29
|
0
|
|
|
|
|
|
$numeros{4}="JZvMzVSO6KoUA/F79ietTA"; |
|
30
|
0
|
|
|
|
|
|
$numeros{7}="2X4WjJJmFRbvvhr/tW/n0Q"; |
|
31
|
0
|
|
|
|
|
|
$numeros{3}="IgHJh1ghY+ibtkZobrCM/w"; |
|
32
|
0
|
|
|
|
|
|
$numeros{8}="jTch8Vwv19eh0YgpirETiA"; |
|
33
|
0
|
|
|
|
|
|
$numeros{9}="+EFFvwg3jNmSxVxk/GJt+g"; |
|
34
|
0
|
|
|
|
|
|
%hashes=reverse %numeros; |
|
35
|
|
|
|
|
|
|
# Thanks to Dev Holland for the proxy trick |
|
36
|
0
|
|
|
|
|
|
my $https_proxy=$ENV{https_proxy}; |
|
37
|
0
|
0
|
|
|
|
|
delete $ENV{https_proxy} if($https_proxy); |
|
38
|
0
|
|
|
|
|
|
$mech = WWW::Mechanize->new(env_proxy=>1); |
|
39
|
0
|
|
|
|
|
|
$mech->env_proxy; # Load proxy settings (but not the https proxy) |
|
40
|
0
|
|
|
|
|
|
$mech2 = WWW::Mechanize->new(env_proxy=>1); |
|
41
|
0
|
|
|
|
|
|
$mech2->env_proxy; # Load proxy settings (but not the https proxy) |
|
42
|
0
|
0
|
|
|
|
|
$ENV{https_proxy}=$https_proxy if($https_proxy); |
|
43
|
0
|
|
|
|
|
|
$mech->agent_alias('Windows IE 6'); |
|
44
|
0
|
|
|
|
|
|
$mech2->agent_alias('Windows IE 6'); |
|
45
|
0
|
|
|
|
|
|
$self{m1}=$mech; |
|
46
|
0
|
|
|
|
|
|
$self{m2}=$mech2; |
|
47
|
0
|
|
|
|
|
|
my $resultado=$mech->get($inicio); |
|
48
|
|
|
|
|
|
|
#print $resultado->content(); |
|
49
|
0
|
|
|
|
|
|
$resultado=$mech->follow_link( url_regex => qr/entrada.asp/i ); |
|
50
|
|
|
|
|
|
|
#print $resultado->content(); |
|
51
|
0
|
|
|
|
|
|
my $f1=$mech->form_name('form1'); |
|
52
|
0
|
|
|
|
|
|
$f1->method('POST'); |
|
53
|
0
|
|
|
|
|
|
$f1->action($cpin); |
|
54
|
0
|
|
|
|
|
|
$f1->value('cbodocument',$tipo); |
|
55
|
0
|
|
|
|
|
|
$f1->value('id',$documento); |
|
56
|
0
|
|
|
|
|
|
$f1->value('birthDay',$birthDay); |
|
57
|
0
|
|
|
|
|
|
$f1->value('birthMonth',$birthMonth); |
|
58
|
0
|
|
|
|
|
|
$f1->value('birthYear',$birthYear); |
|
59
|
0
|
|
|
|
|
|
$resultado=$mech->submit_form(form_name=>'form1'); |
|
60
|
0
|
|
|
|
|
|
my $texto=$resultado->content(); |
|
61
|
|
|
|
|
|
|
#print $texto; |
|
62
|
0
|
|
|
|
|
|
my $pos=0; |
|
63
|
0
|
|
|
|
|
|
while ( $texto=~/src=....images.acceso.([^\s]*?gif). onclick/mgs) { |
|
64
|
0
|
|
|
|
|
|
my $i=$1; |
|
65
|
0
|
|
|
|
|
|
my $imagen=$mech2->get($imagenes.$i); |
|
66
|
0
|
|
|
|
|
|
my $digest=md5_base64($imagen->content()); |
|
67
|
|
|
|
|
|
|
#print $hashes{$digest}.":".$imagenes.$i."->".$digest."\n"; |
|
68
|
0
|
|
|
|
|
|
$posicion{$hashes{$digest}}=$pos; |
|
69
|
0
|
|
|
|
|
|
$pos++; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
0
|
|
|
|
|
|
$f1=$mech->form_name('LoginForm'); |
|
72
|
0
|
|
|
|
|
|
while ( $texto=~/name="txt_Pin(\d)"/mgs) { |
|
73
|
0
|
|
|
|
|
|
my $cual=$1; |
|
74
|
0
|
|
|
|
|
|
$f1->value("txt_Pin".$cual,$posicion{$aclave[$cual-1]}); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
0
|
|
|
|
|
|
$resultado=$mech->submit_form(form_name=>'LoginForm'); |
|
77
|
0
|
|
|
|
|
|
$texto=$resultado->content(); |
|
78
|
0
|
|
|
|
|
|
return $self; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub balances { |
|
82
|
0
|
|
|
0
|
0
|
|
my ($self)=(@_); |
|
83
|
0
|
|
|
|
|
|
my $mech=$self{m1}; |
|
84
|
0
|
|
|
|
|
|
my $resultado=$mech->get($todosdatos); |
|
85
|
|
|
|
|
|
|
#print $resultado->content(); |
|
86
|
0
|
|
|
|
|
|
my $tree = HTML::TreeBuilder->new(); |
|
87
|
0
|
|
|
|
|
|
$tree->parse($resultado->content()); |
|
88
|
0
|
|
|
|
|
|
$tree->eof(); |
|
89
|
0
|
|
|
|
|
|
$tree->elementify(); |
|
90
|
0
|
|
|
|
|
|
my $datos=""; |
|
91
|
0
|
|
|
|
|
|
my @elementos=$tree->look_down("_tag","td","class","negro10tablewithoutline"); |
|
92
|
0
|
|
|
|
|
|
foreach my $el (@elementos) { |
|
93
|
0
|
0
|
|
|
|
|
if($el->as_text()=~/pciones/) { |
|
94
|
0
|
|
|
|
|
|
$datos=$datos."\n"; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
else { |
|
97
|
0
|
|
|
|
|
|
$datos=$datos.$el->as_text()."\t"; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
} |
|
100
|
0
|
|
|
|
|
|
@elementos=$tree->look_down("_tag","td","class","negro10tableline"); |
|
101
|
0
|
|
|
|
|
|
foreach my $el (@elementos) { |
|
102
|
0
|
0
|
|
|
|
|
if($el->as_text()=~/pciones/) { |
|
103
|
0
|
|
|
|
|
|
$datos=$datos."\n"; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
else { |
|
106
|
0
|
|
|
|
|
|
$datos=$datos.$el->as_text()."\t"; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
} |
|
109
|
0
|
|
|
|
|
|
my @cuentas; |
|
110
|
0
|
|
|
|
|
|
foreach my $lin (split "\n",$datos) { |
|
111
|
0
|
|
|
|
|
|
my @t=split "\t",$lin; |
|
112
|
0
|
|
|
|
|
|
$t[2]=~s/[^\d|^,]//g; |
|
113
|
|
|
|
|
|
|
#print $t[2]; |
|
114
|
0
|
0
|
0
|
|
|
|
push @cuentas,( { descripcion =>$t[0], |
|
115
|
|
|
|
|
|
|
numero => $t[1], |
|
116
|
|
|
|
|
|
|
saldo => $t[2] } ) if defined ($t[2]) and length($t[2])>0; |
|
117
|
|
|
|
|
|
|
} |
|
118
|
0
|
|
|
|
|
|
return @cuentas; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub ver_saldos { |
|
122
|
0
|
|
|
0
|
0
|
|
my ($class,%opts)=@_; |
|
123
|
0
|
0
|
|
|
|
|
croak "Debe proporcionar un Documento" unless exists $opts{documento}; |
|
124
|
0
|
0
|
|
|
|
|
croak "Debe proporcionar una fecha de nacimiento DD/MM/AAAA" unless exists $opts{fecha_nacimiento}; |
|
125
|
0
|
0
|
|
|
|
|
croak "Debe proporcionar un PIN" unless exists $opts{pin}; |
|
126
|
0
|
0
|
|
|
|
|
$opts{tipo_documento}="NIF" unless exists $opts{tipo_documento}; |
|
127
|
0
|
|
|
|
|
|
my %tipodoc=(NIF => 0, |
|
128
|
|
|
|
|
|
|
Pasaporte=> 1, |
|
129
|
|
|
|
|
|
|
TarjetaResidencia=> 2); |
|
130
|
0
|
|
|
|
|
|
my $cbodocument=$tipodoc{NIF}; |
|
131
|
0
|
|
|
|
|
|
my $temporal=$class->entra($opts{pin},$opts{documento},$cbodocument,$opts{fecha_nacimiento}); |
|
132
|
0
|
|
|
|
|
|
return $temporal->balances(); |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
|
137
|
|
|
|
|
|
|
__END__ |