Skip to content

Commit a6f059d

Browse files
committed
Merge branch 'main' into json_updatze
2 parents e926c9b + f459380 commit a6f059d

File tree

5 files changed

+30
-40
lines changed

5 files changed

+30
-40
lines changed

pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</parent>
99

1010
<artifactId>scanner-core</artifactId>
11-
<version>6.1.3-json</version>
11+
<version>6.1.3-SNAPSHOT</version>
1212

1313
<name>Scanner Core</name>
1414
<description>A generic scanner framework which can execute a set of probes and combine the results into a report.</description>
@@ -60,7 +60,7 @@
6060
<scm>
6161
<connection>scm:git:https://github.com/tls-attacker/scanner-core.git</connection>
6262
<developerConnection>scm:git:ssh://[email protected]/tls-attacker/scanner-core.git</developerConnection>
63-
<tag>v5.5.0</tag>
63+
<tag>v6.1.2</tag>
6464
<url>https://github.com/tls-attacker/Scanner-Core</url>
6565
</scm>
6666

@@ -93,6 +93,11 @@
9393
<groupId>com.fasterxml.jackson.datatype</groupId>
9494
<artifactId>jackson-datatype-joda</artifactId>
9595
</dependency>
96+
<dependency>
97+
<groupId>de.rub.nds</groupId>
98+
<artifactId>protocol-attacker</artifactId>
99+
<version>2.1.0</version>
100+
</dependency>
96101
<dependency>
97102
<groupId>jakarta.xml.bind</groupId>
98103
<artifactId>jakarta.xml.bind-api</artifactId>

src/main/java/de/rub/nds/scanner/core/execution/ThreadedScanJobExecutor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
*/
99
package de.rub.nds.scanner.core.execution;
1010

11-
import de.rub.nds.scanner.core.afterprobe.AfterProbe;
12-
import de.rub.nds.scanner.core.config.ExecutorConfig;
13-
import de.rub.nds.scanner.core.passive.ExtractedValueContainer;
14-
import de.rub.nds.scanner.core.passive.TrackableValue;
15-
import de.rub.nds.scanner.core.probe.ScannerProbe;
16-
import de.rub.nds.scanner.core.report.ScanReport;
1711
import java.beans.PropertyChangeEvent;
1812
import java.beans.PropertyChangeListener;
1913
import java.util.ArrayList;
@@ -24,8 +18,14 @@
2418
import java.util.concurrent.Future;
2519
import java.util.concurrent.Semaphore;
2620
import java.util.concurrent.ThreadPoolExecutor;
27-
import org.apache.logging.log4j.LogManager;
28-
import org.apache.logging.log4j.Logger;
21+
import java.util.logging.LogManager;
22+
23+
import de.rub.nds.scanner.core.afterprobe.AfterProbe;
24+
import de.rub.nds.scanner.core.config.ExecutorConfig;
25+
import de.rub.nds.scanner.core.passive.ExtractedValueContainer;
26+
import de.rub.nds.scanner.core.passive.TrackableValue;
27+
import de.rub.nds.scanner.core.probe.ScannerProbe;
28+
import de.rub.nds.scanner.core.report.ScanReport;
2929

3030
public class ThreadedScanJobExecutor<
3131
ReportT extends ScanReport,

src/main/java/de/rub/nds/scanner/core/probe/ScannerProbe.java

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -110,32 +110,17 @@ public final <T> void putIfEqual(
110110
}
111111

112112
private TestResult convertToResult(AnalyzedProperty property, Object result) {
113-
// TODO: Use pattern matching with java 17(+)
114-
if (result instanceof TestResult) {
115-
return (TestResult) result;
116-
}
117-
if (result instanceof String) {
118-
return new StringResult(property, (String) result);
119-
}
120-
if (result instanceof Long) {
121-
return new LongResult(property, (Long) result);
122-
}
123-
if (result instanceof Integer) {
124-
return new IntegerResult(property, (Integer) result);
125-
}
126-
if (result instanceof BigInteger) {
127-
return new BigIntegerResult(property, (BigInteger) result);
128-
}
129-
if (result instanceof Set) {
130-
return new SetResult<>(property, (Set<?>) result);
131-
}
132-
if (result instanceof Map) {
133-
return new MapResult<>(property, (Map<?, ?>) result);
134-
}
135-
if (result instanceof List) {
136-
return new ListResult<>(property, (List<?>) result);
137-
}
138-
return new ObjectResult<>(property, result);
113+
return switch (result) {
114+
case TestResult testResult -> testResult;
115+
case String stringValue -> new StringResult(property, stringValue);
116+
case Long longValue -> new LongResult(property, longValue);
117+
case Integer intValue -> new IntegerResult(property, intValue);
118+
case BigInteger bigIntValue -> new BigIntegerResult(property, bigIntValue);
119+
case Set<?> setValue -> new SetResult<>(property, setValue);
120+
case Map<?, ?> mapValue -> new MapResult<>(property, mapValue);
121+
case List<?> listValue -> new ListResult<>(property, listValue);
122+
default -> new ObjectResult<>(property, result);
123+
};
139124
}
140125

141126
public final <T> void put(AnalyzedProperty property, T result) {

src/main/java/de/rub/nds/scanner/core/report/container/KeyValueContainer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ private String pad(String text, int size) {
4747
return text + " ".repeat(size - text.length());
4848
} else if (text.length() > size) {
4949
LOGGER.warn(
50-
"KeyValue 'Key' size is bigger than PADDED_KEY_LENGTH:"
51-
+ PADDED_KEY_LENGTH
52-
+ " - which breaks the layout. Consider choosing a shorter name or raising PADDED_KEY_LEGNTH");
50+
"KeyValue 'Key' size is bigger than PADDED_KEY_LENGTH:{} - which breaks the layout. Consider choosing a shorter name or raising PADDED_KEY_LEGNTH",
51+
PADDED_KEY_LENGTH);
5352
return text;
5453
} else {
5554
return text;

src/main/java/de/rub/nds/scanner/core/util/JaxbSerializer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
package de.rub.nds.scanner.core.util;
1010

11+
import de.rub.nds.protocol.util.SilentByteArrayOutputStream;
1112
import jakarta.xml.bind.*;
1213
import jakarta.xml.bind.util.JAXBSource;
1314
import java.io.*;
@@ -59,7 +60,7 @@ public void write(File file, T obj) throws IOException, JAXBException {
5960
public void write(OutputStream outputStream, T obj) throws JAXBException, IOException {
6061
Marshaller m = context.createMarshaller();
6162
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
62-
try (ByteArrayOutputStream tempStream = new ByteArrayOutputStream()) {
63+
try (SilentByteArrayOutputStream tempStream = new SilentByteArrayOutputStream()) {
6364
Transformer transformer = TransformerFactory.newInstance().newTransformer();
6465
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
6566
transformer.setOutputProperty(OutputKeys.INDENT, "yes");

0 commit comments

Comments
 (0)