I do not remember the original poster asking about scanning only Windows machines on a heterogeneous network but...below is some code I quickly cobbled together from 2 CPAN modules. NMAP::Scanner and Net::Nessus::ScanLite.

#!/usr/bin/env perl
use strict;
use Nmap::Scanner;
use Net::Nessus::ScanLite;

my $nessus = eval {
   Net::Nessus::ScanLite->new(
       host     => "localhost",
       port     => 1241,
       user     => 'nessususer',
       password => 'password',
       ssl      => 1,
   );
} or die($!);

$nessus->preferences(
   {
       host_expansion      => 'none',
       safe_checks         => 'yes',
       checks_read_timeout => 1
   }
);

my $scan = eval { Nmap::Scanner->new(); } or die($!);
$scan->add_target('192.168.1.*');
$scan->add_scan_port('1-1024');
$scan->tcp_syn_scan();
$scan->guess_os();

my $results = $scan->scan();
my $hosts   = $results->get_host_list();

while ( my $host = $hosts->get_next() ) {

   my $ports = $host->get_port_list();
   my $oses  = $host->os_guess() or next;
   my @oses  = $oses->os_matches();
   my @addresses = $host->addresses();
   my $ip;

   while ( my $address = shift @addresses ) {
       printf( "Address: %s\n", $address->address() );
       $ip = $address->address();
   }

while ( my $os = shift @oses ) {

next if ( $os->name() !~ /Windows/ );

       if ( $nessus->login() ) {
           printf( "OS: %s\n",      $os->name() );
           printf( "Accuracy:%s\n", $os->accuracy() );
           $nessus->attack($ip);
           printf( "Total info's = %d\n", $nessus->total_info );
           foreach ( $nessus->info_list ) {
               my $info = $_;
               printf( "Info:\nID: %s\nPort: %s\nDessc: %s\n",
                   $info->ScanID, $info->Port, $info->Description );
           }
           printf( "Total hole's = %d\n", $nessus->total_holes );
           foreach ( $nessus->hole_list ) {
               my $info = $_;
               printf( "Info:\nID: %s\nPort: %s\nDessc: %s\n",
                   $info->ScanID, $info->Port, $info->Description );
           }

       }
       else {
           die( "Nessus login failed %d: %s\n", $nessus->code,
               $nessus->error );
       }
   }
}


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Nessus mailing list
[EMAIL PROTECTED]
http://mail.nessus.org/mailman/listinfo/nessus

Reply via email to