Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/scanners does not return a hashref #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/Net/Nessus/REST.pm
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,16 @@ sub get_scan_details {
return $result;
}

sub stop_scan {
my ($self, %params) = @_;

croak "missing scan_id parameter" unless $params{scan_id};

my $scan_id = delete $params{scan_id};
my $result = $self->_get("/scans/$scan_id/stop", %params);
return $result;
}

sub set_scan_read_status {
my ($self, %params) = @_;

Expand Down Expand Up @@ -296,7 +306,11 @@ sub list_scanners {
my ($self) = @_;

my $result = $self->_get("/scanners");
return $result->{scanner} ? @{$result->{scanner}} : ();
# I think that this may have changed in the Nessus API, because an array ref is returned
# the elements of that array being hash refs
# return $result->{scanner} ? @{$result->{scanner}} : ();
$result = [] unless ($result);
return wantarray ? @{$result} : $result;
}

sub list_folders {
Expand Down Expand Up @@ -654,6 +668,12 @@ returns the details about a plugin family

See L<https://your.nessus.server:8834/nessus6-api.html#/resources/plugins/family-details> for details.

=head2 $nessus->stop_scan(scan_id => $scan_id )

Returns details for the given scan.

See L<https://your.nessus.server:8834/nessus6-api.html#/resources/scans/stop> for details.

=head1 LICENSE

This program is free software: you can redistribute it and/or modify
Expand Down