Skip to content

Commit 033d3d2

Browse files
committed
Merge branch 'bf-icmp-disabling-override'
2 parents 54a1def + 6c5cf7a commit 033d3d2

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

scan/scan.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,24 @@ func (s *Scanner) Start(c *config.Conf) error {
101101
// | "x" | "" | true | x |
102102
// | "x" | "0" | false | - |
103103
// | "x" | "y" | true | y |
104-
if target.icmpPeriod != "" && target.icmpPeriod != "0" {
105-
target.doPing = true
104+
switch c.IcmpPeriod {
105+
case "", "0":
106+
if target.icmpPeriod != "" && target.icmpPeriod != "0" {
107+
target.doPing = true
108+
}
109+
default:
110+
if target.icmpPeriod != "0" {
111+
target.doPing = true
112+
if target.icmpPeriod == "" {
113+
target.icmpPeriod = c.IcmpPeriod
114+
}
115+
}
116+
}
117+
// Inform that ping is disabled
118+
if !target.doPing {
119+
s.Logger.Warn().Msgf("ping explicitly disabled for %s (%s) in configuration",
120+
target.name,
121+
target.ip)
106122
}
107123

108124
// Read target's expected port range
@@ -122,10 +138,6 @@ func (s *Scanner) Start(c *config.Conf) error {
122138
continue
123139
}
124140

125-
if target.icmpPeriod != "" {
126-
target.doPing = true
127-
}
128-
129141
// If TCP period or ports range has been provided, it means that we want
130142
// to do TCP scan on the target
131143
if target.tcpPeriod != "" || target.ports != "" || len(target.expected) != 0 {

0 commit comments

Comments
 (0)