Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use warnings;
- use Data::Dumper;
- use HTTP::Request::Common;
- 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";
- }
- #======================================================================
- my $ua=LWP::UserAgent->new();
- $file = 'Stb3Web-1-27.bin';
- print "Version: StbWeb 1-3.1 \n";
- my $request = HTTP::Request->new(POST 'http://192.168.1.49/mpfsupload', Content_Type => 'application/octet-stream', Content => [file_0 => ['Stb3Web-1-27.bin']]);
- my $response = $browser->request($request);
- print $response->error_as_HTML . "\n" if $response->is_error;
- print "$request \n "
- my $res = $ua->post(
- 'http://192.168.1.49/mpfsupload',
- Content_Type => 'application/octet-stream',
- Content =>[
- fn => ["$file" => $file],
- ],
- );
- print "Upload complete!\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