[Netpass-devel] NetPass/lib/NetPass API.pm,1.19,1.20
Brought to you by:
jeffmurphy
From: Matt <mt...@us...> - 2005-06-03 19:07:17
|
Update of /cvsroot/netpass/NetPass/lib/NetPass In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15783 Modified Files: API.pm Log Message: Index: API.pm =================================================================== RCS file: /cvsroot/netpass/NetPass/lib/NetPass/API.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- API.pm 3 Jun 2005 15:32:11 -0000 1.19 +++ API.pm 3 Jun 2005 19:06:59 -0000 1.20 @@ -114,6 +114,37 @@ return $np->cfg->snortEnabled($nw); } +=head2 my $networks = snortEnabledNetworks($secret) + +Get all the networks snort is enabled on. Returns an ARRAY ref of +all the snort enabled networks on success, C<undef> on failure. + +=cut + +sub snortEnabledNetworks { + my $self = shift; + my $secret = shift; + my $np = $::np; + + my $nws = (); + my @snortnws; + + return undef unless ($self->$check_soap_auth($secret)); + $nws = $np->cfg->getNetworks(); + + if (!defined($nws) || ref($nws) ne 'ARRAY') { + _log("ERROR", "Unable to retrieve list of networks"); + return undef; + } + + foreach my $net (@$nws) { + push(@snortnws, $net) if ($np->cfg->snortEnabled($net) =~ /^(enabled|not_really)$/); + } + + return \@snortnws; +} + + =head2 my $results = quarantineByIP(-secret => $secret, -ip => $ip, -id => $id, -type => $type) Arguments to this function include a secret key, ip address to be |