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:",-background => '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(-activebackground => "gray79",-background => 'gray79',-text=>"Security Test",-variable=>\$chkautoTRN)->place(-x =>100,-y =>60); my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Connectivity",-variable=>\$connectivity)->place(-x =>100,-y =>80); #my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Good Write",-variable=>\$chkautoGW)->place(-x =>100,-y =>100); #my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Flash ROM",-variable=>\$chkautoFR)->place(-x =>100,-y =>120); #my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Ethernet",-variable=>\$chkautoE)->place(-x =>100,-y =>140); #my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Audio",-variable=>\$chkautoA)->place(-x =>100,-y =>160); #my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Micro SD",-variable=>\$chkautoMSD)->place(-x =>100,-y =>180); #my $chk1 = $window ->Checkbutton(-activebackground => "gray79",-background => 'gray79',-text=>"Display",-variable=>\$chkautoD)->place(-x =>100,-y =>200); #my $chk1 = $window ->Checkbutton(-activebackground => "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'|'groove'|'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 () { 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(); }