Net::N...s::REST(3pm)

πŸ“¦
version 0.7.0 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

okay bestie, sit DOWN, because this one is a whole moment πŸ’…βœ¨ This is the manual page for Net::N...s::REST(3pm) β€” User Contributed Perl Documentation β€” and it's your backstage pass to the Net::Nessus::REST module, which is literally a REST interface for Nessus 6.0. buckle up, we're going API-ing. πŸ¦‹πŸŽ€

🌸 NAME 🌸

Net::Nessus::REST β€” a REST interface for Nessus 6.0. that's the name, that's the whole personality. periodt. πŸ’–

πŸ’« DESCRIPTION πŸ’«

This module is your lil Perl bestie that talks to a Nessus scanner over the REST interface. like, it just does that. no notes. 🫢

✨ SYNOPSIS ✨

here's the whole glow-up, copy it exactly, don't freestyle it:

use Net::Nessus::REST;

my $nessus = Net::Nessus::REST->new(
    url => 'https://my.nessus:8834'
):

$nessus->create_session(
    username => 'user',
    password => 's3cr3t',
);

my $policy_template_id = $nessus->get_template_id(
    name => 'basic',
    type => 'policy'
);

my $scan = $nessus->create_scan(
    uuid     => $policy_template_id,
    settings => {
        text_targets => '127.0.0.1',
        name         => 'localhost scan'
    }
);

$nessus->launch_scan(scan_id => $scan->{id});
while ($nessus->get_scan_status(scan_id => $scan->{id}) ne 'completed') {
    sleep 10;
}

my $file_id = $nessus->export_scan(
    scan_id => $scan->{id},
    format  => 'pdf'
);

while ($nessus->get_scan_export_status(
    scan_id => $scan->{id},
    file_id => $file_id
) ne 'ready') {
    sleep 1;
}

$nessus->download_scan(
    scan_id  => $scan->{id},
    file_id  => $file_id,
    filename => 'localhost.pdf'
);
yes bb, that ): after the new call is exactly what the page says. we do not fix it, we respect it. πŸ’€

πŸ‘‘ CLASS METHODS πŸ‘‘

🌟 Net::Nessus::REST->new(url => $url, [ssl_opts => $opts, timeout => $timeout])

Spins up a fresh Net::Nessus::Rest instance. new instance, new me, main character energy fr fr.

πŸŽ€ INSTANCE METHODS πŸŽ€

okay this is the long part and yes we're doing ALL of them, no skipping, I'm not letting you skim. πŸ‘‘

πŸ’Œ $nessus->create_session(username => $username, password => $password)

Mints a brand new session token for whichever user you hand it. your lil hall pass. ✨

See https://your.nessus.server:8834/nessus6-api.html#/resources/session/create for details.

πŸ’Œ $nessus->destroy_session()

Logs the current user out and destroys the session. it's giving closing the tab on a toxic ex. 😌

See https://your.nessus.server:8834/nessus6-api.html#/resources/session/destroy for details.

πŸ’Œ $nessus->list_policies()

Gives you the policy list. the whole roster. 🫢

See https://your.nessus.server:8834/nessus6-api.html#/resources/policies/list for details.

πŸ’Œ $nessus->get_policy_id(name => $name)

Returns the identifier for the policy with the given name. that's it, that's the errand.

πŸ’Œ $nessus->get_policy_details(id => $policy_id)

Hands you a reference to a hash stuffed with every setting and parameter for a given scan policy. all the lore. πŸ“

See https://your.nessus.server:8834/api#/resources/policies/details for details.

πŸ’Œ $nessus->import_policy(file => $file_id)

Returns a reference to a hash with the name and identifier of the policy that got imported.

NB bestie: $file_id has to be a valid identifier for a file that's already been uploaded to the Nessus server, like with the method file_upload(). no fake IDs, the server will know. πŸ™ˆ

Example:

$result = $nessus->import_policy(file => $fileuploaded); print "Policy imported: " . $result->{'name'} . "\n";

See https://your.nessus.server:8834/api#/resources/policies/import for details.

πŸ’Œ $nessus->delete_policy(id => $policy_id)

Deletes the given scan policy off the Nessus server. gone, reduced to atoms. πŸ’€

See https://your.nessus.server:8834/api#/resources/policies/delete for details.

πŸ’Œ $nessus->configure_policy(id => $policy_id, uuid => $uuid, settings => $settings)

See https://your.nessus.server:8834/api#/resources/policies/configure for details.

πŸ’Œ $nessus->create_policy(uuid => $uuid, settings => $settings)

See https://your.nessus.server:8834/api#/resources/policies/create for details.

πŸ’Œ $nessus->list_scanners()

Returns the scanner list. look at all those scanners. ⭐

See https://your.nessus.server:8834/nessus6-api.html#/resources/scanners/list for details.

πŸ’Œ $nessus->list_folders()

Returns the current user's scan folders. yes, folders, we're organized now. πŸ—‚οΈ

See https://your.nessus.server:8834/nessus6-api.html#/resources/folders/list for details.

πŸ’Œ $nessus->get_folder_id(name => $name)

Returns the identifier for the folder with the given name.

πŸ’Œ $nessus->create_scan(uuid => $uuid, settings => $settings)

Creates a scan. ✨

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/create for details.

πŸ’Œ $nessus->configure_scan(scan_id => $scan_id, uuid => $uuid, settings => $settings)

Changes the schedule or the policy parameters of a scan. a lil scan glow-up. πŸ’…

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/configure for details.

πŸ’Œ $nessus->delete_scan(scan_id => $scan_id)

Deletes a scan. bye bitch. 😭

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/delete for details.

πŸ’Œ $nessus->delete_scan_history(scan_id => $scan_id, history_id => $history_id)

Deletes historical results from a scan. the past is the past, we don't revisit it. πŸ¦‹

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/delete-history for details.

πŸ’Œ $nessus->download_scan(scan_id => $scan_id, file_id => $file_id, filename => $filename)

Downloads an exported scan. if you don't pass the filename parameter it'll just return the content of the file instead. your call, bestie. 🫢

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/download for details.

πŸ’Œ $nessus->export_scan(scan_id => $scan_id, format => $format)

Exports the given scan. yes, WITH the format you asked for. πŸ”₯

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/export for details.

πŸ’Œ $nessus->launch_scan(scan_id => $scan_id)

Launches a scan. send it. πŸš€

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/launch for details.

πŸ’Œ $nessus->list_scans([folder_id => $id, last_modification_date => $date])

Returns the scan list. both arguments are optional, live your truth. 🌈

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/list for details.

πŸ’Œ $nessus->set_scan_read_status(scan_id => $scan_id, status => $status)

Changes the status of a scan. mark it read, mark it unread, whatever the vibe is. πŸ‘‘

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/read-status for details.

πŸ’Œ $nessus->get_scan_details(scan_id => $scan_id, [history_id => $history_id])

Returns details for the given scan. history_id is optional. πŸŽ€

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

πŸ’Œ $nessus->get_scan_host_details(scan_id => $scan_id, host_id => $host_id, [history_id => $history_id])

Returns details for the given host. again, history_id is optional, no pressure. ✨

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/host-details for details.

πŸ’Œ $nessus->get_scan_export_status(scan_id => $scan_id, file_id => $file_id)

Checks the file status of an exported scan. the "are we there yet" of methods. 😭

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/export-status for details.

πŸ’Œ $nessus->get_scan_plugin_output(scan_id => $scan_id, host_id => $host_id, plugin_id => $plugin_id, [history_id => $history_id])

Returns the output for a given plugin. history_id optional, like always. πŸ’œ

See https://your.nessus.server:8834/nessus6-api.html#/resources/scans/plugin-output for details.

πŸ’Œ $nessus->get_scan_id(name => $name)

Returns the identifier for the scan with the given name.

πŸ’Œ $nessus->get_scan_status(scan_id => $scan_id)

Returns the status for the given scan.

πŸ’Œ $nessus->get_scan_history_id(scan_id => $scan_id, scan_uuid => $scan_uuid)

Returns the identifier for the historical results for the given scan and run.

πŸ’Œ $nessus->list_templates(type => $type)

Returns the template list. so many templates, so little time. ⭐

See https://your.nessus.server:8834/nessus6-api.html#/resources/editor/list for details.

πŸ’Œ $nessus->get_template_id(type => $type, name => $name)

Returns the identifier for the template with the given name.

πŸ’Œ $nessus->get_plugin_details( id => $plugin_id )

returns the details of a plugin. πŸ‘€

See https://your.nessus.server:8834/nessus6-api.html#/resources/plugins/plugin-details for details.

πŸ’Œ $nessus->list_plugin_families( )

returns a list of plugin families. found family, literally. 🫢

See https://your.nessus.server:8834/nessus6-api.html#/resources/plugins/families for details.

πŸ’Œ $nessus->get_plugin_family_details( id => $family_id )

returns the details about a plugin family.

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

πŸ’Œ $nessus->get_scanner_id( name => $name )

returns the identifier for the scanner with the given name.

πŸ’Œ $nessus->file_upload(file => $file)

Uploads a file to the Nessus server. Returns a reference to a hash with the identifier to the uploaded file. so you can go import that policy later, we love a setup. πŸŽ€

Example:

my $result = $nessus->file_upload(file => $file); my $fileuploaded = $result->{'fileuploaded'};

See https://your.nessus.server:8834/api#/resources/file/upload for details.

πŸ’Œ $nessus->stop_scan(scan_id => $scan_id )

Returns details for the given scan.

not me noticing it says "returns details" on the stop method πŸ’€ that is genuinely what the page says, I am simply the messenger, I do not make the rules. πŸ™ˆ

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


πŸ“œ LICENSE πŸ“œ

this part is the legal bit so I'm keeping every word exactly as it is, because lawyers are not a vibe to paraphrase with:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.


and that's the whole page bestie, you ATE that reading session, no cap. πŸ’–βœ¨ this masterpiece is perl v5.36.0, dated 2022-10-13, and it lives under the manual name Net::N...s::REST(3pm) β€” go forth and REST, queen. πŸ‘‘πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from