Hello Sylvain,

Until that PR is reviewed and merged, you could fix it like this:

vim lib/pf/scan/openvas.pm

sub createTarget {
    my ( $self ) = @_;
    my $logger = get_logger();

    my $name = $self->_get_scan_id();
    my $target_host = $self->{_scanIp};
    my $command = 
"<create_target><name>$name</name><hosts>$target_host</hosts><port_list 
id=\”XXXX-XXXXXXXX-XXXXXXXX\"/></create_target>";

    $logger->info("Creating a new scan target named $name for host 
$target_host");

    my $cmd = "omp -h $self->{_ip} -p $self->{_port} -u $self->{_username} -w 
$self->{_password} -X '$command'";
    $logger->debug("Scan target creation command: $cmd");
    my $output = pf_run($cmd);
    chomp($output);
    $logger->debug("Scan target creation output: $output");

    # Fetch response status and target id
    my ($target_id, $response) = ($output =~ 
/<create_target_response.*id="([a-zA-Z0-9\-]+)".*status="([0-9]+)"/x);

    # Scan target successfully created
    if ( defined($response) && $response eq $RESPONSE_RESOURCE_CREATED ) {
        $logger->info("Scan target named $name successfully created with id: 
$target_id");
        $self->{_targetId} = $target_id;
        return $TRUE;
    }

    $logger->warn("There was an error creating scan target named $name, here's 
the output: $output");
    return;
}

/usr/local/pf/bin/pfcmd service pf restart

Where XXXX-XXXXXXXX-XXXXXXXX = the ID of your port list in the GVM.

Thanks,

Ludovic Zammit
[email protected] <mailto:[email protected]> ::  +1.514.447.4918 (x145) ::  
www.inverse.ca <https://www.inverse.ca/>
Inverse inc. :: Leaders behind SOGo (http://www.sogo.nu <http://www.sogo.nu/>) 
and PacketFence (http://packetfence.org <http://packetfence.org/>)







> On Mar 31, 2021, at 10:59 AM, Sylvain Irakarama via PacketFence-users 
> <[email protected]> wrote:
> 
> Hello everyone,
> 
> I need some help, I m stuck configuring OpenVas. 
> 
> https://github.com/inverse-inc/packetfence/pull/6082/commits 
> <https://github.com/inverse-inc/packetfence/pull/6082/commits>
> I followed this fix to have the port list id option in scan engine but I 
> cannot find the /doc/api directory to modify the files
> 
> docs/api/spec/components/schemas/configscan.yaml
> docs/api/spec/openapi.json
> 
> I can't figure out what these files are for?
>  Is it because of the files that the option is not displayed in scan engine?
> 
> Thank you for your help 
> 
> Best regards, 
> _______________________________________________
> PacketFence-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/packetfence-users

_______________________________________________
PacketFence-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to