Skip to content

Commit 83ae132

Browse files
authored
Support version detection on all ports (--allports) (#144)
1 parent 70ac6af commit 83ae132

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

optionsServiceVersion.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ func WithServiceInfo() Option {
1010
}
1111
}
1212

13+
// WithVersionDetectionOnAllPorts enables version detection on all specified ports,
14+
// including port 9100 which is excluded by default.
15+
// In other words, version detection is performed on all ports regardles of any Exclude directive.
16+
func WithVersionDetectionOnAllPorts() Option {
17+
return func(s *Scanner) {
18+
s.args = append(s.args, "--allports")
19+
}
20+
}
21+
1322
// WithVersionIntensity sets the level of intensity with which nmap should
1423
// probe the open ports to get version information.
1524
// Intensity should be a value between 0 (light) and 9 (try all probes). The

optionsServiceVersion_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ func TestServiceDetection(t *testing.T) {
2626
"-sV",
2727
},
2828
},
29+
{
30+
description: "service detection on all ports",
31+
32+
options: []Option{
33+
WithVersionDetectionOnAllPorts(),
34+
},
35+
36+
expectedArgs: []string{
37+
"--allports",
38+
},
39+
},
2940
{
3041
description: "service detection custom intensity",
3142

0 commit comments

Comments
 (0)