сканер портов для диапазона ip Code: #!/usr/bin/perl -w # PortMap by nerezus # The Artistic License # ICQ 547097 # # A tool for scan ip range use strict; use Socket; if (@ARGV<2) {print "Usage: portmap.pl from_host(ip) to_host(ip) [portfile.txt(ports via [space])]\n";exit(0);} my $fremote=shift||'127.0.0.1'; my $tremote=shift||'127.0.0.1'; my $portfile=shift; my $ports; if ($portfile) {open (PF, $portfile); $ports=<PF>; close(PF);} else {$ports="21 80";} my @ports=split(/ /, $ports); my @flist=split(/\./, $fremote); my @tlist=split(/\./, $tremote); my $fip=$flist[0]*256*256*256+$flist[1]*256*256+$flist[2]*256+$flist[3]; my $tip=$tlist[0]*256*256*256+$tlist[1]*256*256+$tlist[2]*256+$tlist[3]; for (my $i=$fip; $i<=$tip; $i++) { my $tmp=$i; my $d1=int($tmp / (256*256*256)); $tmp=$tmp-$d1*(256*256*256); my $d2=int($tmp / (256*256)); $tmp=$tmp-$d2*(256*256); my $d3=int($tmp / 256); $tmp=$tmp-$d3*256; my $d4=$tmp; my $ip="$d1.$d2.$d3.$d4"; my $host=gethostbyname($ip); foreach my $port (@ports){ my $dest=sockaddr_in($port, $host); socket (S, PF_INET, SOCK_STREAM, getprotobyname('tcp')); if (connect(S, $dest)) {print "[".scalar(localtime)."] $ip:$port OK\n";} # else {print "[".scalar(localtime)."] $ip:$port ERR\n";} close S; } }
ja v etom dele noob tak6to nesmejtes. ego nado zakinut v php ili na delphi ili c++ pisat? v kakom on farmate dolzen bit?