Salut le forum, premier post! Et donc avant tout; je tiens à remercier tous les gens qui s'occupent et developpent Jdownloader. Je le trouve fantastique.
Il y a quelques temps j'ai aussi fait un script pour piloter l'interface web de la livebox2 en perl (testé sous linux et pour windows j'en ai fait un .exe).
http-://p.quinput.eu/debfarm/livebox.exe
Ca permet de tout faire ce que l'on peut faire en accedant à l'interface web (meme faire sonner le téléphone VOIP

)
Si ca peut aider .. :
Quote:
Simple mechanizer to post forms on the livebox2. Can also dump.
Examples:
Display sys info
./livebox.pl -v -pa=infosys_main | html2text
Display adsl info
./livebox.pl -v -pa=infosys_adsl | html2text
Change wireless mode to 2 (b/g)
./livebox.pl mode=2 --page=wireless
Stop broadcasting SSID, set WPA2-PSK (AES) and activate MAC filtering
./livebox.pl -pa=wireless broadcast=0,securitymode=6,macfiltering=1
Change WPA Passphrase to 12345678
./livebox.pl -pa=wireless key=12345678
Reboot livebox
./livebox.pl action=submit action=reboot --page=reboot
etc..
|
PHP Code:
#!/usr/bin/perl
use warnings;
use strict;
use feature 'say';
use WWW::Mechanize::Sleepy;
use Getopt::Long;
use Pod::Usage;
use Digest::MD5 qw /md5/;
my $user = 'admin';
my $md5passwd = unpack( 'H*', md5('admin') );
my $uri = '**External links are only visible to Support Staff**;
my $page;
my ($verbose, $progress) = (0,0);
GetOptions(
'user=s' => \$user,
'md5pass=s' => \$md5passwd,
'ip=s' => \$uri,
'page=s' => \$page,
'progress' => \$progress,
'verbose' => \$verbose,
help => sub { pod2usage(1); },
) or pod2usage(2);
=head1 SYNOPSIS
livebox.pl [opt] [key=value,key=value, ...] [key=value,key=value, ...]
Options:
--user=user Set the username (default to 'admin')
--md5pass=md5 Set the md5 of the user's password (default to md5 of 'admin')
--ip=uri URI of the Livebox2 (default to 'http://192.168.1.1')
--page=page Which page to post to
--progress Print Progress state
--verbose Print html traffic
--help Show this message
=cut
my $mech = WWW::Mechanize::Sleepy->new( cookie_jar => undef, autocheck => 1, show_progress => $progress, timeout => 50, sleep => 0.666 );
if ($verbose) {
$/++;
$mech->add_handler("request_send", sub { print ">" x 80 , "\n", shift->as_string ; return });
$mech->add_handler("response_done", sub { print "<" x 80 , "\n", shift->as_string ; return });
}
#Record Session Id
$mech->get($uri);
my $sessionid = $mech->value('sessionid');
#Hash password with authkey
my $authmd5passwd = unpack( 'H*', md5( $md5passwd . $mech->value('authkey') ) );
#Post Form to Authenticate
$mech->submit_form( with_fields => { authlogin => $user, authmd5passwd => $authmd5passwd } );
#Get the page if requested, otherwise exit
exit unless defined $page;
$mech->get("$uri/index.cgi?page=$page&sessionid=$sessionid");
#Post Form as many times as requested
while ( my $values = shift ) {
my %fields = map { m/^(.*?)=(.*)$/ } split m/,/, $values;
$mech->submit_form( with_fields => \%fields );
}
Pour la cas de la reconnection, on voit donc qu'il faut:
- Acceder a **External links are only visible to Support Staff****External links are only visible to Support Staff** pour recuperer le $sessionid ainsi que le $authkey (qui changent a chaque fois..)
- Se logger : poster un FORM avec les champs:
- AuthLogin="admin"
- Authmd5passwd=HASH_MD5(HASH_MD5("admin" . $authkey))
- Envoyer la commande de reboot:
- POST sur /index.cgi?page=reboot&sessionid=$sessionid avec champ action=submit
- POST sur /index.cgi?page=reboot&sessionid=$sessionid avec champ action=reboot (pour simuler le click à 'etes vous sûr de vouloir rebooter?')
Je ne sais pas si le langage de reconnection interne à Jdownloader permet ca. Ca permettrai d'avoir le meme script pour windows;linux; mac;.. Par contre il n'est plus possible d'avoir une génération automatique de script dès qu'il y a des champs variables..
@+