|
4 | 4 | using Http11Probe.TestCases; |
5 | 5 | using Http11Probe.TestCases.Suites; |
6 | 6 |
|
7 | | -var hostOption = new Option<string>("--host") { Description = "Target host" }; |
| 7 | +var hostOption = new Option<string>("--host") { Description = "Target hostname or IP address" }; |
8 | 8 | hostOption.DefaultValueFactory = _ => "localhost"; |
9 | 9 |
|
10 | | -var portOption = new Option<int>("--port") { Description = "Target port" }; |
| 10 | +var portOption = new Option<int>("--port") { Description = "Target port number" }; |
11 | 11 | portOption.DefaultValueFactory = _ => 8080; |
12 | 12 |
|
13 | | -var categoryOption = new Option<TestCategory?>("--category") { Description = "Run only tests in this category" }; |
| 13 | +var categoryOption = new Option<TestCategory?>("--category") { Description = "Run only tests in this category (skip all others)" }; |
14 | 14 |
|
15 | | -var timeoutOption = new Option<int>("--timeout") { Description = "Read/connect timeout in seconds" }; |
| 15 | +var testOption = new Option<string[]>("--test") { Description = "Run only specific test IDs, case-insensitive (repeatable)", Arity = ArgumentArity.OneOrMore }; |
| 16 | + |
| 17 | +var timeoutOption = new Option<int>("--timeout") { Description = "Connect and read timeout in seconds per test" }; |
16 | 18 | timeoutOption.DefaultValueFactory = _ => 5; |
17 | 19 |
|
18 | | -var outputOption = new Option<string?>("--output") { Description = "Write JSON report to this file path" }; |
| 20 | +var outputOption = new Option<string?>("--output") { Description = "Write JSON results to this file path" }; |
19 | 21 |
|
20 | 22 | var rootCommand = new RootCommand("Http11Probe — HTTP/1.1 server compliance & hardening tester") |
21 | 23 | { |
22 | 24 | hostOption, |
23 | 25 | portOption, |
24 | 26 | categoryOption, |
| 27 | + testOption, |
25 | 28 | timeoutOption, |
26 | 29 | outputOption |
27 | 30 | }; |
|
32 | 35 | var port = parseResult.GetValue(portOption); |
33 | 36 | var category = parseResult.GetValue(categoryOption); |
34 | 37 | var timeout = parseResult.GetValue(timeoutOption); |
| 38 | + var testIds = parseResult.GetValue(testOption); |
35 | 39 | var outputPath = parseResult.GetValue(outputOption); |
36 | 40 |
|
37 | 41 | Console.WriteLine($" Http11Probe targeting {host}:{port}"); |
|
43 | 47 | Port = port, |
44 | 48 | ConnectTimeout = TimeSpan.FromSeconds(timeout), |
45 | 49 | ReadTimeout = TimeSpan.FromSeconds(timeout), |
46 | | - CategoryFilter = category |
| 50 | + CategoryFilter = category, |
| 51 | + TestIdFilter = testIds is { Length: > 0 } |
| 52 | + ? new HashSet<string>(testIds, StringComparer.OrdinalIgnoreCase) |
| 53 | + : null |
47 | 54 | }; |
48 | 55 |
|
49 | 56 | var testCases = ComplianceSuite.GetTestCases() |
|
0 commit comments