Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use Data::Dumper;
- use LWP::UserAgent;
- #trianing time handle
- $| = 1;
- #========================= Make browser ==================================
- my $browser = LWP::UserAgent->new(
- agent => ' Mozilla/5.0 (Windows NT 6.3; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0',
- max_redirect => 1,
- timeout => 2000,
- );
- # =======================================================================
- sub main # 12.255.4 => 1
- {
- # Maybe use @browser->is_online to make the automatic data injection
- #======================== Setting day before post ============================
- my @months = qw(01 02 03 04 05 06 07 08 09 10 11 12 );
- my @days = qw(06 0 01 02 03 04 05);
- #my $url = 'http://192.168.1.49/admin/configdivers.htm'; # I hope All electronic carte are the same IP ....
- my $url = 'http://192.168.1.49/admin/configdivers.htm';
- my $url1 = 'http://192.168.1.49/admin/configequipments.htm';
- #my $url = 'http://localhost/post';
- #my $url1 = 'http://localhost/post';
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
- my $thisyear = $year +1900-2000;
- my $thishour = '';
- my $thisminut = '';
- my $thisday = '';
- #===============Setting date and time data for send ===============
- if ($hour <= 9)
- {
- $thishour = '0'."$hour";
- }
- else {
- $thishour = "$hour";
- }
- if ($min <= 9){
- $thisminut ='0'."$min";
- }
- else{
- $thisminut ="$min";
- }
- if($mday <= 9) {
- $thisday = '0'."$mday";
- }
- else {
- $thisday = "$mday";
- }
- #======================================================================
- print "Version: StbWeb 1-23 \n";
- print "\n \nDate :: $thisday/$months[$mon]/$thisyear\n";
- print "Time :: $thishour:$thisminut \n";
- print "$days[$wday] \n";
- sleep(2);
- #============================Finished Madafaka !! ========================
- # ================================ Method post =========================
- my %post =(
- '12.255.1'=>'', #i Don't know what to send (in scoucre webpage value type ="hidden" + value="ENREGISTER")
- '12.255.10'=>"$days[$wday]", #weekday 1 byte 0-6
- '12.255.8'=>"$thisday/$months[$mon]/$thisyear", #Dayweek : LUNDI MARDI
- '12.255.9'=>"$thishour:$thisminut", # Day / Months / Years
- );
- my %post_BA =(
- '3.2.0' =>'BADGE ABONNEMENT',
- '3.2.1' => '0',
- '3.2.2' => '1', #Badge Achat
- '3.2.3' => '1',
- '3.2.4' => '1',
- '3.2.5' => '1',
- );
- my %post_sitename = (
- '3.3.0' =>'0',
- '3.3.1' => 'Test le '."$thisday/$months[$mon]/$thisyear \n",
- '3.3.2' => '0',
- '3.3.3' => '',
- '3.3.4' => '0',
- '3.3.5' => '1',
- '3.3.6' => '',
- );
- my %post1 =(
- '3.0.0'=>'0',
- '3.0.0'=>'on',
- '3.0.1' =>'0',
- '3.0.1' =>'on',
- '3.0.10'=>'0',
- '3.0.10'=>'on',
- '3.0.11'=>'0',
- '3.0.12'=>'0',
- '3.0.12'=>'on',
- '3.0.13'=>'0',
- '3.0.13'=>'on',
- '3.0.14'=>'0',
- '3.0.14'=>'on',
- '3.0.15'=>'0',
- '3.0.15'=>'on',
- '3.0.16'=>'0',
- '3.0.17'=>'0',
- '3.0.18'=>'0',
- '3.0.19'=>'0',
- '3.0.2'=>'0',
- '3.0.2'=>'on',
- '3.0.20'=>'0',
- '3.0.21'=>'0',
- '3.0.22'=>'0',
- '3.0.23'=>'0',
- '3.0.24'=>'0',
- '3.0.25'=>'0',
- '3.0.26'=>'0',
- '3.0.27'=>'0',
- '3.0.3'=>'0',
- '3.0.3'=>'on',
- '3.0.4'=>'0',
- '3.0.5'=>'0',
- '3.0.6'=>'0',
- '3.0.7'=>'0',
- '3.0.8'=>'0',
- '3.0.8'=>'on',
- '3.0.9'=>'0',
- '8.0.0.1' => 'on',
- );
- my %save = (
- '3.255.1'=>'',
- );
- my %restart = (
- '12.255.4'=>'',
- );
- #=====================================================================
- print "Mis a jour Date/Heur encours \n";
- print %post;
- my $resp =$browser->post($url,\%post);
- if ($resp->is_success && $resp->status_line =~200 ) {
- print "\n [+] L'heur et date etait mis a jour ! \n";
- #print "\n".$resp->content;
- print "\n ==============================================================";
- my $resp_post_BA =$browser->post($url,\%post_BA);
- my $resp_Sitename =$browser->post($url,\%post_sitename);
- sleep(1);
- print "\n \t \t \t" ."[+]C'est Bon! \n";
- my $resp1 =$browser->post($url1,\%post1);
- my $respsave = $browser->post ($url1, \%save);
- sleep(1);
- if ($resp1->is_success && $resp1->status_line =~200 )
- {
- print "La confiquaration equipement etait mis a jour \n";
- print "\n ============================ C'est bon! =========================\n";
- sleep(1);
- my $restart =$browser->post($url1,\%restart);
- } #end if post equipement
- else {
- print "[!]Erreure : Mis a jour confiquaration equipement\n";
- print $resp1->status_line;
- print "\n";
- sleep(3);
- my $restart =$browser->post($url1,\%restart);
- }
- }
- else
- {
- print "\n ==============================================================";
- print "\n \n [-] Il y a une erreure... Vouyez vous ressayez encore!\n";
- print "\n\n".$resp->status_line."\n";
- }
- }#end sub
- #my $connectionstatus = $browser->is_online;
- #=========================check connection Madafaka !!! ==================
- #if ($connectionstatus == 0)
- # {
- #sleep(1);
- #print "[!] Aucun de connection \r";
- # }# End unless while loop
- #else
- #{
- # print "[+]Connection avec la carte d'electronique \n";
- # main();
- #}#end else
- main();
- sleep(2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement