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);
}
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);
}
Aggregations