File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -31,37 +31,3 @@ func ExampleScanner_simple() {
31
31
)
32
32
// Output: Scan successful: 3 hosts up
33
33
}
34
-
35
- // A scanner can be given custom idiomatic filters for both hosts
36
- // and ports.
37
- func ExampleScanner_filters () {
38
- s , err := NewScanner (
39
- context .Background (),
40
- WithTargets ("google.com" , "facebook.com" ),
41
- WithPorts ("843" ),
42
- WithFilterHost (func (h Host ) bool {
43
- // Filter out hosts with no open ports.
44
- for idx := range h .Ports {
45
- if h .Ports [idx ].Status () == "closed" {
46
- return true
47
- }
48
- }
49
- return false
50
- }),
51
- )
52
- if err != nil {
53
- log .Fatalf ("unable to create nmap scanner: %v" , err )
54
- }
55
-
56
- scanResult , _ , err := s .Run ()
57
- if err != nil {
58
- log .Fatalf ("nmap encountered an error: %v" , err )
59
- }
60
-
61
- fmt .Printf (
62
- "Filtered out hosts %d / Original number of hosts: %d\n " ,
63
- len (scanResult .Hosts ),
64
- scanResult .Stats .Hosts .Total ,
65
- )
66
- // Output: Filtered out hosts 1 / Original number of hosts: 2
67
- }
You can’t perform that action at this time.
0 commit comments