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
| #!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use HTML::Form;
use HTTP::Cookies;
# initialisation de l'agent
my $ua = LWP::UserAgent->new(
agent => 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0',
cookie_jar => HTTP::Cookies->new(
file => 'LWPcookies.txt',
autosave => 1,
ignore_discard => 1,
)
);
# initialisation de la requete
my $base = 'http://178.33.132.12/';
my $res = $ua->request(HTTP::Request->new( GET => $base ));
my $form = HTML::Form->parse($res->decoded_content,
base => $res->base,
charset => $res->content_charset,
);
# afficher le Infolog
my $infolog = $form->find_input('infolog')->value;
print($infolog);
# se logger
my $user = 'LOGIN';
my $pass = 'PASSWORD';
my $loginlink = 'http://178.33.132.12/index.php?infolog=' . $infolog . '&Login=' . $user . '&password=' . $pass . '&btn_login.x=66&btn_login.y=17';
$ua->request(HTTP::Request->new( GET => $loginlink )); |
Partager