Search in sources :

Example 1 with NessusAdapterConfig

use of com.mercedesbenz.sechub.adapter.nessus.NessusAdapterConfig in project sechub by mercedes-benz.

the class NessusProductExecutor method executeByAdapter.

@Override
protected List<ProductResult> executeByAdapter(ProductExecutorData data) throws Exception {
    NetworkTargetInfo info = data.getCurrentNetworkTargetInfo();
    if (info.getURIs().isEmpty() && info.getIPs().isEmpty()) {
        LOG.debug("{} Nessus scan not possible, because no uri or ip defined", data.getTraceLogId());
        return Collections.emptyList();
    }
    NetworkTargetType targetType = info.getTargetType();
    LOG.debug("Trigger Nessus adapter execution for target type {}", targetType);
    /* @formatter:off */
    NessusAdapterConfig nessusConfig = NessusConfig.builder().configure(new SecHubAdapterOptionsBuilderStrategy(data, getScanType())).configure(new NetworkTargetProductServerDataAdapterConfigurationStrategy(installSetup, targetType)).setTimeToWaitForNextCheckOperationInMinutes(scanResultCheckPeriodInMinutes).setTimeOutInMinutes(scanResultCheckTimeOutInMinutes).setProxyHostname(proxyHostname).setProxyPort(proxyPort).setTraceID(data.getTraceLogIdAsString()).setPolicyID(installSetup.getDefaultPolicyId()).setTargetIPs(info.getIPs()).setTargetURIs(info.getURIs()).build();
    /* @formatter:on */
    /* execute NESSUS by adapter and return product result */
    ProductExecutorContext productExecutorContext = data.getProductExecutorContext();
    String xml = nessusAdapter.start(nessusConfig, productExecutorContext.getCallback());
    // product result is set by callback
    ProductResult productResult = productExecutorContext.getCurrentProductResult();
    productResult.setResult(xml);
    return Collections.singletonList(productResult);
}
Also used : NessusAdapterConfig(com.mercedesbenz.sechub.adapter.nessus.NessusAdapterConfig) NetworkTargetType(com.mercedesbenz.sechub.domain.scan.NetworkTargetType) SecHubAdapterOptionsBuilderStrategy(com.mercedesbenz.sechub.domain.scan.SecHubAdapterOptionsBuilderStrategy) ProductResult(com.mercedesbenz.sechub.domain.scan.product.ProductResult) NetworkTargetProductServerDataAdapterConfigurationStrategy(com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataAdapterConfigurationStrategy) ProductExecutorContext(com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext) NetworkTargetInfo(com.mercedesbenz.sechub.domain.scan.NetworkTargetRegistry.NetworkTargetInfo)

Example 2 with NessusAdapterConfig

use of com.mercedesbenz.sechub.adapter.nessus.NessusAdapterConfig in project sechub by mercedes-benz.

the class NessusProductExecutor method executeWithAdapter.

@Override
protected List<ProductResult> executeWithAdapter(SecHubExecutionContext context, ProductExecutorContext executorContext, NessusInstallSetup setup, TargetRegistryInfo data) throws Exception {
    if (data.getURIs().isEmpty() && data.getIPs().isEmpty()) {
        return Collections.emptyList();
    }
    TargetType targetType = data.getTargetType();
    LOG.debug("Trigger nessus adapter execution for target type {} and setup {} ", targetType, setup);
    /* @formatter:off */
    NessusAdapterConfig nessusConfig = NessusConfig.builder().configure(createAdapterOptionsStrategy(context)).configure(new TargetIdentifyingMultiInstallSetupConfigBuilderStrategy(setup, targetType)).setTimeToWaitForNextCheckOperationInMinutes(scanResultCheckPeriodInMinutes).setTimeOutInMinutes(scanResultCheckTimeOutInMinutes).setProxyHostname(proxyHostname).setProxyPort(proxyPort).setTraceID(context.getTraceLogIdAsString()).setPolicyID(setup.getDefaultPolicyId()).setTargetIPs(data.getIPs()).setTargetURIs(data.getURIs()).build();
    /* @formatter:on */
    /* execute NESSUS by adapter and return product result */
    String xml = nessusAdapter.start(nessusConfig, executorContext.getCallback());
    // product result is set by callback
    ProductResult productResult = executorContext.getCurrentProductResult();
    productResult.setResult(xml);
    return Collections.singletonList(productResult);
}
Also used : NessusAdapterConfig(com.mercedesbenz.sechub.adapter.nessus.NessusAdapterConfig) ProductResult(com.mercedesbenz.sechub.domain.scan.product.ProductResult) TargetType(com.mercedesbenz.sechub.domain.scan.TargetType) TargetIdentifyingMultiInstallSetupConfigBuilderStrategy(com.mercedesbenz.sechub.domain.scan.TargetIdentifyingMultiInstallSetupConfigBuilderStrategy)

Aggregations

NessusAdapterConfig (com.mercedesbenz.sechub.adapter.nessus.NessusAdapterConfig)2 ProductResult (com.mercedesbenz.sechub.domain.scan.product.ProductResult)2 NetworkTargetProductServerDataAdapterConfigurationStrategy (com.mercedesbenz.sechub.domain.scan.NetworkTargetProductServerDataAdapterConfigurationStrategy)1 NetworkTargetInfo (com.mercedesbenz.sechub.domain.scan.NetworkTargetRegistry.NetworkTargetInfo)1 NetworkTargetType (com.mercedesbenz.sechub.domain.scan.NetworkTargetType)1 SecHubAdapterOptionsBuilderStrategy (com.mercedesbenz.sechub.domain.scan.SecHubAdapterOptionsBuilderStrategy)1 TargetIdentifyingMultiInstallSetupConfigBuilderStrategy (com.mercedesbenz.sechub.domain.scan.TargetIdentifyingMultiInstallSetupConfigBuilderStrategy)1 TargetType (com.mercedesbenz.sechub.domain.scan.TargetType)1 ProductExecutorContext (com.mercedesbenz.sechub.domain.scan.product.ProductExecutorContext)1