hi folks

i want to scan a host's snmp port to see if snmp
service is availble, i use following perl script, but
it seem not work well, it always say that a host's 161
is open, but actually it's not, could you guys give
any hint, thanks in advance

#!/usr/bin/perl
use Socket;
$host=$ARGV[0];
$port=161;
    $adresse=sockaddr_in ($port, inet_aton($host));
    socket MYSOCK, PF_INET, SOCK_DGRAM, 0;
    if (connect MYSOCK, $adresse)
    {
        print `grep '\t$port/' /etc/services | grep
tcp`;
       close MYSOCK;
    }


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to