Skip to content

Commit 16d8b7c

Browse files
authored
Merge pull request #196 from tls-attacker/TestResultS_new
new testresults
2 parents 2f70845 + 4896aa8 commit 16d8b7c

File tree

138 files changed

+2299
-1724
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+2299
-1724
lines changed

Scanner-Core/src/main/java/de/rub/nds/scanner/core/constants/TestResult.java

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,6 @@
99

1010
package de.rub.nds.scanner.core.constants;
1111

12-
public enum TestResult {
13-
TRUE,
14-
FALSE,
15-
PARTIALLY,
16-
CANNOT_BE_TESTED,
17-
COULD_NOT_TEST,
18-
ERROR_DURING_TEST,
19-
UNCERTAIN,
20-
UNSUPPORTED,
21-
NOT_TESTED_YET,
22-
TIMEOUT;
23-
24-
public static TestResult of(boolean value) {
25-
return value ? TRUE : FALSE;
26-
}
27-
28-
}
12+
public interface TestResult {
13+
public abstract String name();
14+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Scanner-Core - A TLS configuration and analysis tool based on TLS-Attacker
3+
*
4+
* Copyright 2017-2022 Ruhr University Bochum, Paderborn University, Hackmanit GmbH
5+
*
6+
* Licensed under Apache License, Version 2.0
7+
* http://www.apache.org/licenses/LICENSE-2.0.txt
8+
*/
9+
10+
package de.rub.nds.scanner.core.constants;
11+
12+
import javax.xml.bind.annotation.XmlAccessType;
13+
import javax.xml.bind.annotation.XmlAccessorType;
14+
import javax.xml.bind.annotation.XmlRootElement;
15+
16+
@XmlRootElement(name = "result")
17+
@XmlAccessorType(XmlAccessType.FIELD)
18+
public enum TestResults implements TestResult {
19+
TRUE,
20+
FALSE,
21+
PARTIALLY,
22+
CANNOT_BE_TESTED,
23+
COULD_NOT_TEST,
24+
ERROR_DURING_TEST,
25+
UNCERTAIN,
26+
UNSUPPORTED,
27+
NOT_TESTED_YET,
28+
TIMEOUT;
29+
30+
private TestResults() {
31+
}
32+
33+
public static TestResults of(boolean value) {
34+
return value ? TRUE : FALSE;
35+
}
36+
}

Scanner-Core/src/main/java/de/rub/nds/scanner/core/report/ScanReport.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import de.rub.nds.scanner.core.constants.ProbeType;
1414
import de.rub.nds.scanner.core.constants.ScannerDetail;
1515
import de.rub.nds.scanner.core.constants.TestResult;
16+
import de.rub.nds.scanner.core.constants.TestResults;
1617
import de.rub.nds.scanner.core.passive.ExtractedValueContainer;
1718
import de.rub.nds.scanner.core.passive.TrackableValue;
1819
import java.io.Serializable;
@@ -71,7 +72,7 @@ public synchronized TestResult getResult(AnalyzedProperty property) {
7172

7273
public synchronized TestResult getResult(String property) {
7374
TestResult result = resultMap.get(property);
74-
return (result == null) ? TestResult.NOT_TESTED_YET : result;
75+
return (result == null) ? TestResults.NOT_TESTED_YET : result;
7576
}
7677

7778
public synchronized void removeResult(AnalyzedProperty property) {
@@ -83,8 +84,8 @@ public synchronized void putResult(AnalyzedProperty property, TestResult result)
8384
}
8485

8586
public synchronized void putResult(AnalyzedProperty property, Boolean result) {
86-
this.putResult(property, Objects.equals(result, Boolean.TRUE) ? TestResult.TRUE
87-
: Objects.equals(result, Boolean.FALSE) ? TestResult.FALSE : TestResult.UNCERTAIN);
87+
this.putResult(property, Objects.equals(result, Boolean.TRUE) ? TestResults.TRUE
88+
: Objects.equals(result, Boolean.FALSE) ? TestResults.FALSE : TestResults.UNCERTAIN);
8889
}
8990

9091
public synchronized void markAsChangedAndNotify() {

Scanner-Core/src/main/java/de/rub/nds/scanner/core/report/rating/PropertyResultRatingInfluencer.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111

1212
import de.rub.nds.scanner.core.constants.AnalyzedProperty;
1313
import de.rub.nds.scanner.core.constants.TestResult;
14+
import de.rub.nds.scanner.core.constants.TestResults;
1415
import javax.xml.bind.annotation.XmlAccessType;
1516
import javax.xml.bind.annotation.XmlAccessorType;
1617
import javax.xml.bind.annotation.XmlAnyElement;
18+
import javax.xml.bind.annotation.XmlElement;
1719
import javax.xml.bind.annotation.XmlRootElement;
1820
import javax.xml.bind.annotation.XmlType;
1921

@@ -22,6 +24,7 @@
2224
@XmlType(propOrder = { "result", "influence", "scoreCap", "referencedProperty", "referencedPropertyResult" })
2325
public class PropertyResultRatingInfluencer implements Comparable<PropertyResultRatingInfluencer> {
2426

27+
@XmlElement(type = TestResults.class, name = "result")
2528
private TestResult result;
2629

2730
private Integer influence;
@@ -31,6 +34,7 @@ public class PropertyResultRatingInfluencer implements Comparable<PropertyResult
3134
@XmlAnyElement(lax = true)
3235
private AnalyzedProperty referencedProperty;
3336

37+
@XmlElement(type = TestResults.class, name = "referencedPropertyResult")
3438
private TestResult referencedPropertyResult;
3539

3640
public PropertyResultRatingInfluencer() {

Scanner-Core/src/main/java/de/rub/nds/scanner/core/report/rating/PropertyResultRecommendation.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
package de.rub.nds.scanner.core.report.rating;
1111

1212
import de.rub.nds.scanner.core.constants.TestResult;
13+
import de.rub.nds.scanner.core.constants.TestResults;
1314
import javax.xml.bind.annotation.XmlAccessType;
1415
import javax.xml.bind.annotation.XmlAccessorType;
15-
import javax.xml.bind.annotation.XmlType;
16+
import javax.xml.bind.annotation.XmlAnyElement;
17+
import javax.xml.bind.annotation.XmlRootElement;
18+
import javax.xml.bind.annotation.XmlSeeAlso;
1619

17-
@XmlType(propOrder = { "result", "shortDescription", "handlingRecommendation", "detailedDescription" })
20+
@XmlRootElement
21+
@XmlSeeAlso({ TestResults.class })
1822
@XmlAccessorType(XmlAccessType.FIELD)
1923
public class PropertyResultRecommendation {
2024

25+
@XmlAnyElement(lax = true)
2126
private TestResult result;
2227

2328
private String shortDescription;

Scanner-Core/src/main/java/de/rub/nds/scanner/core/report/rating/RatingInfluencers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import javax.xml.bind.annotation.XmlElement;
1919
import javax.xml.bind.annotation.XmlRootElement;
2020

21-
@XmlRootElement
21+
@XmlRootElement(name = "ratingInfluencers")
2222
@XmlAccessorType(XmlAccessType.FIELD)
2323
public class RatingInfluencers implements Serializable {
2424

Scanner-Core/src/main/java/de/rub/nds/scanner/core/report/rating/Recommendation.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import javax.xml.bind.annotation.XmlAccessType;
1818
import javax.xml.bind.annotation.XmlAccessorType;
1919
import javax.xml.bind.annotation.XmlAnyElement;
20+
import javax.xml.bind.annotation.XmlRootElement;
2021
import javax.xml.bind.annotation.XmlType;
2122

23+
@XmlRootElement
2224
@XmlType(propOrder = { "analyzedProperty", "shortName", "shortDescription", "detailedDescription", "testDocumentation",
2325
"links", "propertyRecommendations" })
2426
@XmlAccessorType(XmlAccessType.FIELD)

TLS-Client-Scanner/src/main/java/de/rub/nds/tlsscanner/clientscanner/probe/ClientRecordFragmentationProbe.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
package de.rub.nds.tlsscanner.clientscanner.probe;
1111

1212
import de.rub.nds.scanner.core.constants.TestResult;
13-
import de.rub.nds.tlsscanner.core.probe.TlsProbe;
13+
import de.rub.nds.scanner.core.constants.TestResults;
1414
import de.rub.nds.tlsattacker.core.config.Config;
1515
import de.rub.nds.tlsattacker.core.constants.RunningModeType;
1616
import de.rub.nds.tlsattacker.core.protocol.message.FinishedMessage;
@@ -20,11 +20,11 @@
2020
import de.rub.nds.tlsattacker.core.workflow.action.ReceiveTillAction;
2121
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowConfigurationFactory;
2222
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowTraceType;
23-
import de.rub.nds.tlsscanner.core.constants.TlsProbeType;
24-
import de.rub.nds.tlsscanner.clientscanner.report.ClientReport;
2523
import de.rub.nds.tlsscanner.clientscanner.config.ClientScannerConfig;
26-
2724
import de.rub.nds.tlsscanner.clientscanner.probe.result.ClientRecordFragmentationResult;
25+
import de.rub.nds.tlsscanner.clientscanner.report.ClientReport;
26+
import de.rub.nds.tlsscanner.core.constants.TlsProbeType;
27+
import de.rub.nds.tlsscanner.core.probe.TlsProbe;
2828

2929
public class ClientRecordFragmentationProbe
3030
extends TlsProbe<ClientScannerConfig, ClientReport, ClientRecordFragmentationResult> {
@@ -47,9 +47,9 @@ public ClientRecordFragmentationResult executeTest() {
4747

4848
TestResult result;
4949
if (state.getWorkflowTrace().executedAsPlanned()) {
50-
result = TestResult.TRUE;
50+
result = TestResults.TRUE;
5151
} else {
52-
result = TestResult.FALSE;
52+
result = TestResults.FALSE;
5353
}
5454

5555
return new ClientRecordFragmentationResult(result);
@@ -62,7 +62,7 @@ public boolean canBeExecuted(ClientReport report) {
6262

6363
@Override
6464
public ClientRecordFragmentationResult getCouldNotExecuteResult() {
65-
return new ClientRecordFragmentationResult(TestResult.COULD_NOT_TEST);
65+
return new ClientRecordFragmentationResult(TestResults.COULD_NOT_TEST);
6666
}
6767

6868
@Override

TLS-Client-Scanner/src/main/java/de/rub/nds/tlsscanner/clientscanner/probe/DheParameterProbe.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
package de.rub.nds.tlsscanner.clientscanner.probe;
1111

12-
import de.rub.nds.scanner.core.constants.TestResult;
12+
import de.rub.nds.scanner.core.constants.TestResults;
1313
import de.rub.nds.tlsattacker.core.config.Config;
1414
import de.rub.nds.tlsattacker.core.constants.AlgorithmResolver;
1515
import de.rub.nds.tlsattacker.core.constants.CipherSuite;
@@ -21,8 +21,6 @@
2121
import de.rub.nds.tlsattacker.core.workflow.factory.WorkflowTraceType;
2222
import de.rub.nds.tlsscanner.clientscanner.config.ClientScannerConfig;
2323
import de.rub.nds.tlsscanner.clientscanner.constants.CompositeModulusType;
24-
import static de.rub.nds.tlsscanner.clientscanner.constants.CompositeModulusType.EVEN;
25-
import static de.rub.nds.tlsscanner.clientscanner.constants.CompositeModulusType.MOD3;
2624
import de.rub.nds.tlsscanner.clientscanner.constants.SmallSubgroupType;
2725
import de.rub.nds.tlsscanner.clientscanner.probe.result.DheParameterResult;
2826
import de.rub.nds.tlsscanner.clientscanner.probe.result.dhe.CompositeModulusResult;
@@ -121,9 +119,9 @@ private List<CompositeModulusResult> createCompositeModulusResultList() {
121119
State state = new State(config, trace);
122120
executeState(state);
123121
if (trace.executedAsPlanned()) {
124-
compositeModulusResultList.add(new CompositeModulusResult(TestResult.TRUE, compositeType));
122+
compositeModulusResultList.add(new CompositeModulusResult(TestResults.TRUE, compositeType));
125123
} else {
126-
compositeModulusResultList.add(new CompositeModulusResult(TestResult.FALSE, compositeType));
124+
compositeModulusResultList.add(new CompositeModulusResult(TestResults.FALSE, compositeType));
127125
// TODO add different results based on partial failure
128126
}
129127
}
@@ -177,9 +175,9 @@ private List<SmallSubgroupResult> createSmallSubgroupResultList() {
177175
State state = new State(config, trace);
178176
executeState(state);
179177
if (trace.executedAsPlanned()) {
180-
smallSubgroupResultList.add(new SmallSubgroupResult(TestResult.TRUE, smallSubgroupType));
178+
smallSubgroupResultList.add(new SmallSubgroupResult(TestResults.TRUE, smallSubgroupType));
181179
} else {
182-
smallSubgroupResultList.add(new SmallSubgroupResult(TestResult.FALSE, smallSubgroupType));
180+
smallSubgroupResultList.add(new SmallSubgroupResult(TestResults.FALSE, smallSubgroupType));
183181
// TODO add different results based on partial failure
184182
}
185183
}
@@ -188,18 +186,18 @@ private List<SmallSubgroupResult> createSmallSubgroupResultList() {
188186

189187
@Override
190188
public boolean canBeExecuted(ClientReport report) {
191-
return report.getResult(TlsAnalyzedProperty.SUPPORTS_DHE) == TestResult.TRUE;
189+
return report.getResult(TlsAnalyzedProperty.SUPPORTS_DHE) == TestResults.TRUE;
192190
}
193191

194192
@Override
195193
public DheParameterResult getCouldNotExecuteResult() {
196194
List<SmallSubgroupResult> subgroupResultList = new LinkedList<>();
197195
for (SmallSubgroupType type : SmallSubgroupType.values()) {
198-
subgroupResultList.add(new SmallSubgroupResult(TestResult.CANNOT_BE_TESTED, type));
196+
subgroupResultList.add(new SmallSubgroupResult(TestResults.CANNOT_BE_TESTED, type));
199197
}
200198
List<CompositeModulusResult> compositeResultList = new LinkedList<>();
201199
for (CompositeModulusType type : CompositeModulusType.values()) {
202-
compositeResultList.add(new CompositeModulusResult(TestResult.CANNOT_BE_TESTED, type));
200+
compositeResultList.add(new CompositeModulusResult(TestResults.CANNOT_BE_TESTED, type));
203201
}
204202
return new DheParameterResult(null, subgroupResultList, compositeResultList);
205203
}

TLS-Client-Scanner/src/main/java/de/rub/nds/tlsscanner/clientscanner/probe/ForcedCompressionProbe.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package de.rub.nds.tlsscanner.clientscanner.probe;
1111

1212
import de.rub.nds.scanner.core.constants.TestResult;
13+
import de.rub.nds.scanner.core.constants.TestResults;
1314
import de.rub.nds.tlsattacker.core.config.Config;
1415
import de.rub.nds.tlsattacker.core.constants.CompressionMethod;
1516
import de.rub.nds.tlsattacker.core.constants.RunningModeType;
@@ -45,9 +46,9 @@ public ForcedCompressionResult executeTest() {
4546
executeState(state);
4647
TestResult result;
4748
if (state.getWorkflowTrace().executedAsPlanned()) {
48-
result = TestResult.TRUE;
49+
result = TestResults.TRUE;
4950
} else {
50-
result = TestResult.FALSE;
51+
result = TestResults.FALSE;
5152
}
5253
return new ForcedCompressionResult(result);
5354
}
@@ -59,7 +60,7 @@ public boolean canBeExecuted(ClientReport report) {
5960

6061
@Override
6162
public ForcedCompressionResult getCouldNotExecuteResult() {
62-
return new ForcedCompressionResult(TestResult.COULD_NOT_TEST);
63+
return new ForcedCompressionResult(TestResults.COULD_NOT_TEST);
6364
}
6465

6566
@Override

0 commit comments

Comments
 (0)