VpK has asked for the wisdom of the Perl Monks concerning the following question:
use Tk; use Net::FTP; use Tk::BrowseEntry; #use strict; #use warnings; #local $| = 1; use Tk::Button; use Net::Telnet (); #use File::Copy; $window = MainWindow->new; $window->title("Test WAR"); $window->configure(-background=>'gray79'); $window->geometry( "300x700" ); #$window->Label(-text => " Free Space:",-backg +round => 'gray79')->place(-x=>35,-y=>43); $window->Label(-text => " IP :",-background => + 'gray79')->place(-x=>35,-y=>20); $IP = $window->Entry(-width=>20, -background +=> 'light blue')->place(-x => 120,-y =>20); my $chk1 = $window ->Checkbutton(-activebac +kground => "gray79",-background => 'gray79',-text=>"Security Test",-v +ariable=>\$chkautoTRN)->place(-x =>100,-y =>60); my $chk1 = $window ->Checkbutton(-activebackgr +ound => "gray79",-background => 'gray79',-text=>"Connectivity",-varia +ble=>\$connectivity)->place(-x =>100,-y =>80); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Good Write",-variab +le=>\$chkautoGW)->place(-x =>100,-y =>100); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Flash ROM",-variabl +e=>\$chkautoFR)->place(-x =>100,-y =>120); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Ethernet",-variable +=>\$chkautoE)->place(-x =>100,-y =>140); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Audio",-variable=>\ +$chkautoA)->place(-x =>100,-y =>160); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Micro SD",-variable +=>\$chkautoMSD)->place(-x =>100,-y =>180); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Display",-variable= +>\$chkautoD)->place(-x =>100,-y =>200); #my $chk1 = $window ->Checkbutton(-activebackg +round => "gray79",-background => 'gray79',-text=>"Auto Cab",-variable +=>\$chkautoAC)->place(-x =>100,-y =>220); $window ->Button(-text => "Run", -command =>\& +push_button, -width=>10,-relief => 'groove',-activebackground=>blue,- +relief =>'raised')->place(-x => 50,-y =>600); $window ->Button(-text => "End", -command =>\& +close, -width=>10,-relief => 'groove',-activebackground=>red,-relief +=>'raised')->place(-x =>125,-y =>600);#-relief => 'groove','flat'|'gr +oove'|'raised'|'ridge'|'sunken'|'solid' #$window->Label(-text => "Results",-width=>10, +-background => 'gray79')->place(-x=>35,-y=>250); $txt = $window -> Text(-width=>30, -height=>20 +)->place(-x =>40,-y =>280); $count=1; MainLoop; sub push_button { $host = $IP -> get(); $port = "23"; $uid = "admin"; $pwd = "password123"; open $inputLog, ">in1.log"; $box = new Net::Telnet(); $box->open( Host => $host, Port => $port, ); $iLog = $box->input_log($inputLog); $flag = $box->login( Name => $uid, Password => $pwd, ); if ($chkautoTRN==1) { #sleep 4; $txt -> insert('end',"Executing Security Testcases...\n"); open(MYFILE,'security_profiles.txt'); while (<MYFILE>) { chomp; $x=$_; $box->print($x); $box->waitfor(Match=>'/# $/i',Timeout=>25); #Match=>'/# $/i', #sleep 12; } #$box->close; #system ("cat in.log"); close MYFILE; } if($connectivity==1) { while($count<=100) { system('netsh wlan disconnect'); sleep 2; system('netsh wlan connect name=720wlan0vap7'); #print "wifi connected\n"; sleep 15; $box->cmd('get association station'); $result=$box->lastline; system('netsh wlan disconnect'); #print "wifi disconnected\n"; sleep 15; $txt -> insert('end',"The client $result got connected $count time +\n"); $count++; } } $box->cmd('get association station'); $result=$box->lastline; $txt -> insert('end',"$result\n"); $box->close; } sub close { exit(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Related with Perl Tk (readline blocking use fileevent)
by Anonymous Monk on Jun 28, 2015 at 09:15 UTC | |
|
Re: Related with Perl Tk
by 1nickt (Canon) on Jun 28, 2015 at 12:47 UTC | |
|
Re: Related with Perl Tk
by Lotus1 (Vicar) on Jun 28, 2015 at 14:37 UTC | |
|
Re: Related with Perl Tk
by Anonymous Monk on Jun 30, 2015 at 05:01 UTC |