Advertisement
Quantumzblue

Mis a jour TB3

Mar 29th, 2015
530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 4.98 KB | None | 0 0
  1. use strict;
  2. use warnings;
  3. use Data::Dumper;
  4. use LWP::UserAgent;
  5. #trianing time handle
  6. $| = 1;
  7. #========================= Make browser ==================================
  8. my $browser = LWP::UserAgent->new(
  9. agent => '  Mozilla/5.0 (Windows NT 6.3; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0',
  10. max_redirect => 1,
  11. timeout => 2000,
  12.                             );
  13.  # =======================================================================
  14.  
  15. sub main # 12.255.4 => 1
  16. {
  17.  # Maybe use @browser->is_online  to make the automatic data injection
  18.  
  19.  #======================== Setting day before post ============================
  20. my @months = qw(01 02 03 04 05 06 07 08 09 10 11 12 );
  21. my @days =   qw(06 0 01 02 03 04 05);
  22. #my $url = 'http://192.168.1.49/admin/configdivers.htm';  # I hope All electronic carte are the same IP ....
  23. my $url = 'http://192.168.1.49/admin/configdivers.htm';
  24. my $url1 = 'http://192.168.1.49/admin/configequipments.htm';
  25. #my $url = 'http://localhost/post';
  26. #my $url1 = 'http://localhost/post';
  27. my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
  28. my $thisyear = $year +1900-2000;
  29. my $thishour = '';
  30. my $thisminut = '';
  31. my $thisday = '';
  32.  #===============Setting date and time data for send   ===============
  33.  
  34. if ($hour <= 9)
  35. {
  36. $thishour = '0'."$hour";
  37. }
  38. else {
  39.  
  40.     $thishour = "$hour";
  41. }
  42. if ($min <= 9){
  43.     $thisminut ='0'."$min";
  44. }
  45. else{
  46.     $thisminut ="$min";
  47. }
  48. if($mday <= 9)  {
  49. $thisday = '0'."$mday";
  50.                 }
  51. else            {
  52. $thisday = "$mday";
  53.                 }
  54.  
  55.  #======================================================================
  56.   print "Version: StbWeb 1-23 \n";
  57. print "\n \nDate :: $thisday/$months[$mon]/$thisyear\n";
  58. print "Time :: $thishour:$thisminut \n";
  59. print "$days[$wday] \n";
  60. sleep(2);
  61.  
  62.  
  63.    #============================Finished Madafaka !! ========================
  64.  
  65. # ================================ Method post =========================
  66. my %post =(
  67.      '12.255.1'=>'', #i Don't know what to send (in scoucre webpage value type ="hidden" + value="ENREGISTER")
  68.      '12.255.10'=>"$days[$wday]", #weekday 1 byte 0-6
  69.      '12.255.8'=>"$thisday/$months[$mon]/$thisyear", #Dayweek : LUNDI MARDI
  70.      '12.255.9'=>"$thishour:$thisminut", # Day / Months / Years  
  71.             );
  72. my %post_BA =(
  73.         '3.2.0' =>'BADGE ABONNEMENT',
  74.         '3.2.1' => '0',
  75.         '3.2.2' => '1', #Badge Achat
  76.         '3.2.3' => '1',
  77.         '3.2.4' => '1',
  78.         '3.2.5' => '1',
  79.  
  80.     );
  81. my %post_sitename = (
  82.         '3.3.0' =>'0',
  83.         '3.3.1' => 'Test le '."$thisday/$months[$mon]/$thisyear \n",
  84.         '3.3.2' => '0',
  85.         '3.3.3' => '',
  86.         '3.3.4' => '0',
  87.         '3.3.5' => '1',
  88.         '3.3.6' => '',
  89.  
  90.  
  91.     );
  92.  
  93.    
  94. my %post1 =(
  95. '3.0.0'=>'0',
  96. '3.0.0'=>'on',
  97. '3.0.1' =>'0',
  98. '3.0.1' =>'on',
  99. '3.0.10'=>'0',
  100. '3.0.10'=>'on',
  101. '3.0.11'=>'0',
  102. '3.0.12'=>'0',
  103. '3.0.12'=>'on',
  104. '3.0.13'=>'0',
  105. '3.0.13'=>'on',
  106. '3.0.14'=>'0',
  107. '3.0.14'=>'on',
  108. '3.0.15'=>'0',
  109. '3.0.15'=>'on',
  110. '3.0.16'=>'0',
  111. '3.0.17'=>'0',
  112. '3.0.18'=>'0',
  113. '3.0.19'=>'0',
  114. '3.0.2'=>'0',
  115. '3.0.2'=>'on',
  116. '3.0.20'=>'0',
  117. '3.0.21'=>'0',
  118. '3.0.22'=>'0',
  119. '3.0.23'=>'0',
  120. '3.0.24'=>'0',
  121. '3.0.25'=>'0',
  122. '3.0.26'=>'0',
  123. '3.0.27'=>'0',
  124. '3.0.3'=>'0',
  125. '3.0.3'=>'on',
  126. '3.0.4'=>'0',
  127. '3.0.5'=>'0',
  128. '3.0.6'=>'0',
  129. '3.0.7'=>'0',
  130. '3.0.8'=>'0',
  131. '3.0.8'=>'on',
  132. '3.0.9'=>'0',
  133. '8.0.0.1' => 'on',
  134.     );
  135. my %save = (
  136. '3.255.1'=>'',
  137. );
  138. my %restart = (
  139. '12.255.4'=>'',
  140.     );
  141. #=====================================================================
  142. print "Mis a jour Date/Heur encours \n";
  143. print %post;
  144. my $resp =$browser->post($url,\%post);
  145. if ($resp->is_success && $resp->status_line =~200 ) {
  146.     print "\n [+] L'heur et date etait mis a jour ! \n";
  147.     #print "\n".$resp->content;
  148.     print "\n ==============================================================";
  149.     my $resp_post_BA =$browser->post($url,\%post_BA);
  150.     my $resp_Sitename =$browser->post($url,\%post_sitename);
  151.     sleep(1);
  152.  
  153.  
  154.                 print "\n \t \t \t" ."[+]C'est Bon! \n";
  155.     my $resp1 =$browser->post($url1,\%post1);
  156.     my $respsave = $browser->post ($url1, \%save);
  157.     sleep(1);
  158.     if ($resp1->is_success && $resp1->status_line =~200 )
  159.     {
  160.         print "La confiquaration equipement etait mis a jour \n";
  161.            
  162. print "\n ============================ C'est bon! =========================\n";
  163.     sleep(1);
  164.     my $restart =$browser->post($url1,\%restart);
  165.         } #end if post equipement
  166.  
  167.    
  168.     else         {
  169.         print "[!]Erreure : Mis a jour confiquaration equipement\n";
  170.         print $resp1->status_line;
  171.         print "\n";
  172.         sleep(3);
  173.         my $restart =$browser->post($url1,\%restart);
  174.                 }
  175.                                                     }
  176. else       
  177.                     {
  178. print "\n ==============================================================";
  179. print "\n \n [-] Il y a une erreure...  Vouyez vous ressayez encore!\n";
  180. print "\n\n".$resp->status_line."\n";
  181.  
  182.  
  183.                     }
  184.  
  185.                                     }#end sub
  186. #my $connectionstatus = $browser->is_online;
  187. #=========================check connection Madafaka !!! ==================
  188. #if ($connectionstatus == 0)
  189. #                       {
  190. #sleep(1);
  191. #print "[!] Aucun de connection \r";
  192.  
  193. #       }# End unless while loop
  194. #else
  195. #{
  196. #   print "[+]Connection avec la carte d'electronique \n";
  197. # main();
  198. #}#end else
  199.  
  200. main();
  201. sleep(2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement