File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments