Hello,
I have written a pretty crude port scanner in perl, the problem I am having is when I run it it hangs on port 135 on my machine, telneting didnt help as it just hung aswell. I know it works because it detects my web server on port 80, the code is here:
#!c:\perl\bin\perl.exe -w
use Socket;
use strict;
my ($host, $scan, $proto, $paddr);
my @ports=(1 .. 65000);
print "Enter host you want to scan: ";
chomp($host=<STDIN>);
open(RESULTS, ">>results.txt"
print RESULTS "\n$host: ";
close(RESULTS);
foreach my $port (@ports){
print "scanning $host, $port\n";
$scan=(gethostbyname($host))[4];
$paddr=sockaddr_in($port, $scan);
$proto=getprotobyname('tcp');
open(RESULTS, ">>results.txt"
socket(SCAN, AF_INET, SOCK_STREAM, $proto);
connect(SCAN, $paddr);
select(SCAN);
$|=1;
select(STDOUT);
print SCAN "GET index.html HTTP/1.0\n\n";
if (<SCAN>){
print "\nPORT $port on HOST $host is running";
print RESULTS "PORT $port on HOST $host is running, ";
}
close(SCAN);
close(RESULTS);
}
Does anyone know what service may be running on port 135?? It is a win2000 pro machine.. skottieb
I have written a pretty crude port scanner in perl, the problem I am having is when I run it it hangs on port 135 on my machine, telneting didnt help as it just hung aswell. I know it works because it detects my web server on port 80, the code is here:
#!c:\perl\bin\perl.exe -w
use Socket;
use strict;
my ($host, $scan, $proto, $paddr);
my @ports=(1 .. 65000);
print "Enter host you want to scan: ";
chomp($host=<STDIN>);
open(RESULTS, ">>results.txt"
print RESULTS "\n$host: ";
close(RESULTS);
foreach my $port (@ports){
print "scanning $host, $port\n";
$scan=(gethostbyname($host))[4];
$paddr=sockaddr_in($port, $scan);
$proto=getprotobyname('tcp');
open(RESULTS, ">>results.txt"
socket(SCAN, AF_INET, SOCK_STREAM, $proto);
connect(SCAN, $paddr);
select(SCAN);
$|=1;
select(STDOUT);
print SCAN "GET index.html HTTP/1.0\n\n";
if (<SCAN>){
print "\nPORT $port on HOST $host is running";
print RESULTS "PORT $port on HOST $host is running, ";
}
close(SCAN);
close(RESULTS);
}
Does anyone know what service may be running on port 135?? It is a win2000 pro machine.. skottieb