The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::OpenVAS - Perl extension for OpenVAS Scanner

SYNOPSIS

    use Net::OpenVAS qw( -commands );

    my $openvas = Net::OpenVAS->new(
        host     => 'localhost:9390',
        username => 'admin',
        password => 's3cr3t'
    ) or die "ERROR: $@";

    my $task = $openvas->create_task(
        name   => [ 'Scan created via Net::OpenVAS' ],
        target => { id => 'a800d5c7-3493-4f73-8401-c42e5f2bfc9c' },
        config => { id => 'daba56c8-73ec-11df-a475-002264764cea' }
    );

    if ( $task->is_created ) {

        my $task_id = $task->result->{id};

        say "Created task $task_id";

        my $task_start = $openvas->start_task( task_id => $task_id );

        say "Task $task_id started (" . $task_start->status_text . ')' if ( $task_start->is_accepted );

    }

    if ( $openvas->error ) {
        say "ERROR: " . $openvas->error;
    }

DESCRIPTION

This module provides Perl scripts easy way to interface the OMP (OpenVAS Management Protocol) of OpenVAS.

For more information about the OPM follow the online documentation:

https://docs.greenbone.net/API/OMP/omp.html

CONSTRUCTOR

Net::OpenVAS::OMP->new ( host => $host, username => $username, password => $password [, logger => $logger, timeout => 60, ssl_options => \%ssl_options ] )

Create a new instance of Net::Net::OpenVAS::OMP.

Params:

  • host : OpenVAS host (and port)

  • username, password : OpenVAS Credentials

  • timeout : Request timeout in seconds (default is 60) If a socket open, read or write takes longer than the timeout, an exception is thrown.

  • ssl_options : A hashref of SSL_* options to pass through to IO::Socket::SSL.

  • logger : A logger instance (eg. Log::Log4perl or Log::Any for log the REST request and response messages.

METHODS

$openvas->command ( $command [, \%arguments ] )

Execute a command to OpenVAS via OMP and return Net::OpenVAS::OMP::Response class instance.

    my $task = $openvas->command( 'get_tasks', task_id => '46f15597-b721-403c-96a1-cce439af63a7' );

$openvas->error

Return Net::OpenVAS::Error class instance.

COMMANDS HELPER

Net::OpenVAS::OMP provide a flag (-commands) for import all OpenVAS OMP commands.

    use Net::OpenVAS::OMP;
    [...]
    my $version = $openvas->command('get_version');

    use Net::OpenVAS::OMP qw( -commands );
    [...]
    my $version = $openvas->get_version;

Available commands:

  • authenticate : Authenticate with the manager.

  • commands : Run a list of commands.

  • create_agent : Create an agent.

  • create_config : Create a config.

  • create_escalator : Create an escalator.

  • create_lsc_credential : Create an LSC credential.

  • create_note : Create a note.

  • create_override : Create an override.

  • create_report_format : Create a report format.

  • create_schedule : Create a schedule.

  • create_slave : Create a slave.

  • create_target : Create a target.

  • create_task : Create a task.

  • delete_agent : Delete an agent.

  • delete_config : Delete a config.

  • delete_escalator : Delete an escalator.

  • delete_lsc_credential : Delete an LSC credential.

  • delete_note : Delete a note.

  • delete_override : Delete an override.

  • delete_report : Delete a report.

  • delete_report_format : Delete a report format.

  • delete_schedule : Delete a schedule.

  • delete_slave : Delete a slave.

  • delete_target : Delete a target.

  • delete_task : Delete a task.

  • get_agents : Get all agents.

  • get_configs : Get all configs.

  • get_dependencies : Get dependencies for all available NVTs.

  • get_escalators : Get all escalators.

  • get_lsc_credentials : Get all LSC credentials.

  • get_notes : Get all notes.

  • get_nvts : Get all NVTs.

  • get_nvt_families : Get a list of all NVT families.

  • get_nvt_feed_checksum : Get checksum for entire NVT collection.

  • get_overrides : Get all overrides.

  • get_preferences : Get all preferences.

  • get_reports : Get all reports.

  • get_report_formats : Get all report formats.

  • get_results : Get results.

  • get_schedules : Get all schedules.

  • get_slaves : Get all slaves.

  • get_system_reports : Get all system reports.

  • get_target_locators : Get configured target locators.

  • get_targets : Get all targets.

  • get_tasks : Get all tasks.

  • get_version : Get the OpenVAS Manager Protocol version.

  • help : Get the help text.

  • modify_config : Update an existing config.

  • modify_lsc_credential : Modify an existing LSC credential.

  • modify_note : Modify an existing note.

  • modify_override : Modify an existing override.

  • modify_report : Modify an existing report.

  • modify_report_format : Update an existing report format.

  • modify_task : Modify an existing task.

  • pause_task : Pause a running task.

  • resume_or_start_task : Resume task if stopped, else start task.

  • resume_paused_task : Resume a paused task.

  • resume_stopped_task : Resume a stopped task.

  • start_task : Manually start an existing task.

  • stop_task : Stop a running task.

  • test_escalator : Run an escalator.

  • verify_agent : Verify an agent.

  • verify_report_format : Verify a report format.

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at https://github.com/giterlizzi/perl-Net-OpenVAS/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/giterlizzi/perl-Net-OpenVAS

    git clone https://github.com/giterlizzi/perl-Net-OpenVAS.git

AUTHOR

  • Giuseppe Di Terlizzi <gdt@cpan.org>

LICENSE AND COPYRIGHT

This software is copyright (c) 2020 by Giuseppe Di Terlizzi.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.