use of com.mercedesbenz.sechub.domain.scan.Target in project sechub by mercedes-benz.
the class AbstractInstallSetupProductExecutor method registerInetAdresses.
private void registerInetAdresses(UUIDTraceLogID traceLogId, S setup, TargetRegistry registry, List<InetAddress> inetAdresses) {
if (inetAdresses == null || inetAdresses.isEmpty()) {
return;
}
for (InetAddress inetAdress : inetAdresses) {
Target target = targetResolver.resolveTarget(inetAdress);
if (!setup.isAbleToScan(target.getType())) {
LOG.error("{}: setup not able to scan target {}", getIdentifier(), target);
continue;
}
LOG.debug("{} register scan target:{}", traceLogId, target);
registry.register(target);
}
}
use of com.mercedesbenz.sechub.domain.scan.Target in project sechub by mercedes-benz.
the class NetsparkerProductExecutorTest method before.
@Before
public void before() throws Exception {
context = mock(SecHubExecutionContext.class);
config = mock(SecHubConfiguration.class);
executorContext = mock(ProductExecutorContext.class);
target1 = new Target(URI_1_INTERNET, TargetType.INTERNET);
target2 = new Target(URI_2_INTERNET, TargetType.INTERNET);
target3 = new Target(URI_3_INTERNET, TargetType.INTERNET);
targetResolver = mock(TargetResolver.class);
when(targetResolver.resolveTarget(URI_1_INTERNET)).thenReturn(target1);
when(targetResolver.resolveTarget(URI_2_INTERNET)).thenReturn(target2);
when(targetResolver.resolveTarget(URI_3_INTERNET)).thenReturn(target3);
netsparkerAdapter = mock(NetsparkerAdapter.class);
when(context.getConfiguration()).thenReturn(config);
UUID pseudoJobUUID = UUID.randomUUID();
when(context.getSechubJobUUID()).thenReturn(pseudoJobUUID);
when(executorContext.getCurrentProductResult()).thenReturn(new ProductResult(pseudoJobUUID, "project1", new WithoutProductExecutorConfigInfo(ProductIdentifier.NETSPARKER), "resullt1"));
executorToTest = new TestNetsparkerProductExecutor();
executorToTest.netsparkerAdapter = netsparkerAdapter;
installSetup = mock(NetsparkerInstallSetup.class);
when(installSetup.getBaseURL()).thenReturn("http://www.example.com/netsparker");
when(installSetup.getUserId()).thenReturn("user");
when(installSetup.getPassword()).thenReturn("apitoken1");
when(installSetup.getNetsparkerLicenseId()).thenReturn("license1");
executorToTest.installSetup = installSetup;
}
use of com.mercedesbenz.sechub.domain.scan.Target in project sechub by mercedes-benz.
the class TargetResolverServiceSpringBootTest method path_example_slash_src_is_CODE_UPLOAD.
@Test
public void path_example_slash_src_is_CODE_UPLOAD() throws Exception {
/* prepare */
String path = "example/src";
/* execute */
Target found = serviceToTest.resolveTargetForPath(path);
/* test */
assertEquals(new Target(path, TargetType.CODE_UPLOAD), found);
}
use of com.mercedesbenz.sechub.domain.scan.Target in project sechub by mercedes-benz.
the class NessusProductExecutorTest method when_three_root_urls_are_configured_and_apter_can_handle_3_targets_with_two_different_types_the_adapter_is_called_1_time.
@Test
public void when_three_root_urls_are_configured_and_apter_can_handle_3_targets_with_two_different_types_the_adapter_is_called_1_time() throws Exception {
/* prepare */
when(executorConfig.getProductIdentifier()).thenReturn(ProductIdentifier.NETSPARKER);
Target target2ButIntranet = new Target(URI_2, TargetType.INTRANET);
when(targetResolver.resolveTarget(URI_2)).thenReturn(target2ButIntranet);
when(installSetup.isAbleToScan(TargetType.INTERNET)).thenReturn(true);
when(installSetup.isAbleToScan(TargetType.INTRANET)).thenReturn(true);
prepareInfraScanWithThreeURIs();
/* execute */
executorToTest.execute(context, executorContext);
/* test */
verify(nessusAdapter, times(2)).start(any(), any());
}
use of com.mercedesbenz.sechub.domain.scan.Target in project sechub by mercedes-benz.
the class AbstractInstallSetupProductExecutor method registerURIs.
private void registerURIs(UUIDTraceLogID traceLogId, S setup, TargetRegistry registry, List<URI> uris) {
if (uris == null || uris.isEmpty()) {
return;
}
for (URI uri : uris) {
Target target = targetResolver.resolveTarget(uri);
if (!setup.isAbleToScan(target.getType())) {
LOG.error("{}: setup not able to scan target {}", getIdentifier(), target);
continue;
}
LOG.debug("{} register scan target:{}", traceLogId, target);
registry.register(target);
}
}
Aggregations