cored has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, i dont know anything about sockets so i try another quick solution for an scanner but dosent work, check the script and tell me why its a endless loop ?
#!/usr/bin/perl -w for (1..7000){ system("nc -vv $ARG[1] -z ${_}"); }
Thank for your help...

Replies are listed 'Best First'.
Re: Port Scan
by grep (Monsignor) on Oct 25, 2002 at 04:23 UTC

    You've got 2 of things to tweak

    1. It's @ARGV so you want $ARGV[1]
    2. I assume you want the first item from @ARGV which is $ARGV[0]

    You also can just say $_ you don't need ${_}

    But the best advice I can give you is, not to reinvent the wheel. Use nmap. Nmap does portscans and a heck of lot more. It can give a rough security profile of your system including a fingerprint if possible



    grep
    Mynd you, mønk bites Kan be pretti nasti...