Net-Nessus
view release on metacpan or search on metacpan
lib/Net/Nessus/Message.pm view on Meta::CPAN
$lines->[$i] = { 'id' => $line->[0],
'name' => $line->[1],
'category' => $line->[2],
'copyright' => $line->[3],
'description' => $line->[4],
'summary' => $line->[5],
'family' => $line->[6],
};
}
}
$self;
}
sub print {
my $self = shift;
$self->SUPER::print(@_, [map {join(" <|> ",
$_->{'id'},
$_->{'name'},
$_->{'category'},
$_->{'copyright'},
$_->{'description'},
$_->{'summary'},
$_->{'family'}
) } @{$self->{'lines'}}])
}
sub Plugins { shift->{'lines'} }
=pod
=head3 PREFERENCES, PREFERENCES_ERRORS
my $msg = Net::Nessus::Message::PREFERENCES->new(\%attr);
my $msg = Net::Nessus::Message::PREFERENCES_ERRORS->new(\%attr);
Similar to the PLUGIN_LIST, the PREFERENCES are sent to the client if he
has connected. The client may reply with another list of own preferences.
Its method
$msg->Prefs();
returns the preferences hash ref. The PREFERENCES message is available
beginning with protocol version 1.1 and obsoletes the old NEW_ATTACK
message in favour of the shorter version.
If the client has sent a PREFERENCES message, the server will respond
a PREFERENCES_ERROR message. This is almost the same, except that only
those values appear that had illegal values in the PREFERENCES message.
The values in the reply will be the servers default values.
=cut
package Net::Nessus::Message::PREFERENCES;
@Net::Nessus::Message::PREFERENCES::ISA = qw(Net::Nessus::Message::MultiLine);
sub new {
my $proto = shift;
my $self = $proto->SUPER::new(@_);
if (@_ == 1) {
$self->{'prefs'} = delete $self->{'lines'};
} else {
my %prefs;
my $lines = $self->{'lines'};
for (my $i = 0; $i < @$lines; $i++) {
my $line = $lines->[$i];
$prefs{$line->[0]} = $line->[1];
}
$self->{'prefs'} = \%prefs;
}
$self
}
sub print {
my $self = shift;
my $lines = [];
while (my($var, $val) = each %{$self->{'prefs'}}) {
push(@$lines, "$var <|> $val");
}
$self->SUPER::print(@_, $lines);
}
sub Prefs { shift->{'prefs'} }
package Net::Nessus::Message::PREFERENCES_ERRORS;
@Net::Nessus::Message::PREFERENCES_ERRORS::ISA =
qw(Net::Nessus::Message::PREFERENCES);
=pod
=head3 RULES
$msg = Net::Nessus::Message::RULES(\@rules);
This is the third message sent to the client upon connect. Its only
method is
$msg->Rules();
returning an array ref of rules, each rule consisting of a single
string.
=cut
package Net::Nessus::Message::RULES;
@Net::Nessus::Message::RULES::ISA = qw(Net::Nessus::Message::MultiLine);
sub new {
my $class = shift; my $self = $class->SUPER::new(@_);
my $lines = $self->{'lines'};
for (my $i = 0; $i < @$lines; $i++) {
if (ref($lines->[$i]) eq 'ARRAY') {
$lines->[$i] = $lines->[$i]->[0];
}
}
$self;
}
sub Rules { shift->{'lines'} }
=pod
=head3 INFO, HOLE
$msg = Net::Nessus::Message::HOLE->new
([$host, $port, $description, $service, $proto]);
The HOLE and INFO messages are used by the server for reporting security
problems. INFO messages are considered warnings, HOLE messages are expected
to be more serious. You may use the following methods for retrieving more
info:
$msg->Host();
$msg->Port();
$msg->Description();
$msg->Service();
$msg->Proto();
$msg->ScanID();
( run in 0.534 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )