
| [MENU] | |||||||||
| [THOUGHTS] | [TECH RESOURCES] | [TRASH TALK] | |||||||
| [DANK MEMES] | [FEATURED ARTISTS] | [W] | |||||||
Lets say you have a connection and can run commands on the victim.
But the machine has no nmap or something to scan its network and it has perl installed, you can use this script
- #!/usr/bin/perl 
 - use IO::Socket; 
 - $| = 1;
 - # change the target IP
 - $target = "172.18.0.2";
 - 
 - # least port to scan
 - $start_port = "1";
 - $end_port = "10000"; 
 - foreach ($port = $start_port ; $port <= $end_port ; $port++) 
 - {
 -     #\r will refresh the line
 -     print "\rScanning port $port";
 -      
 -     #Connect to port number
 -     $socket = IO::Socket::INET->new(PeerAddr => $target , PeerPort => $port , Proto => 'tcp' , Timeout => 1);
 -      
 -     #Check connection
 -     if( $socket )
 -     {
 -         print "\r = Port $port is open.\n" ;
 -     }
 -     else
 -     {
 -         #Port is closed, nothing to print
 -     }
 - }
 -  
 - print "\n\nFinished Scanning $target\n";
 -  
 - exit (0);