Skip to content

Commit

Permalink
Merge pull request #9 from devops-works/develop
Browse files Browse the repository at this point in the history
add ICMP disabling feature
  • Loading branch information
eze-kiel authored Aug 3, 2021
2 parents 9d34366 + d0d2661 commit 54a1def
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ expected: <string>
#### `icmp_config`

```yaml
# Ping frequency. Supported values are the same than for TCP's period.
# Ping frequency. Supported values are the same than for TCP's period. To
# disable ICMP requests for a specific target, use 0.
period: <string>
```

Expand Down
17 changes: 17 additions & 0 deletions scan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ func (s *Scanner) Start(c *config.Conf) error {
target.icmpPeriod = c.IcmpPeriod
}

// Truth table for icmpPeriod value
//
// | global | target | doPing | period |
// | ------ | ------ | ------ | :----: |
// | "" | "" | false | - |
// | "" | "0" | false | - |
// | "" | "y" | true | y |
// | "0" | "" | false | - |
// | "0" | "0" | false | - |
// | "0" | "y" | true | y |
// | "x" | "" | true | x |
// | "x" | "0" | false | - |
// | "x" | "y" | true | y |
if target.icmpPeriod != "" && target.icmpPeriod != "0" {
target.doPing = true
}

// Read target's expected port range
exp, err := readPortsRange(t.TCP.Expected)
if err != nil {
Expand Down

0 comments on commit 54a1def

Please sign in to comment.