probe/scan/ipv4/host_test.go

52 lines
1004 B
Go
Raw Normal View History

2018-08-12 11:08:31 +00:00
package ipv4
2018-08-13 04:20:22 +00:00
import (
"testing"
omm "git.loafle.net/overflow/model/meta"
oms "git.loafle.net/overflow/model/scan"
omu "git.loafle.net/overflow/model/util"
)
2018-08-12 11:08:31 +00:00
func TestHostScan(t *testing.T) {
2018-08-13 04:20:22 +00:00
z := &oms.Zone{
Network: "192.168.1.0/24",
Iface: "{1924FA2B-6927-4BA5-AF43-876C3F8853CE}",
Mac: "30:9C:23:15:A3:09",
Address: "192.168.1.201",
DiscoveredDate: omu.NowPtr(),
}
dp := &oms.DiscoverPort{
FirstScanRange: 1,
LastScanRange: 20000,
ExcludePorts: []int{
631,
},
IncludeTCP: true,
IncludeUDP: true,
DiscoverService: nil,
}
dh := &oms.DiscoverHost{
MetaIPType: omm.ToMetaIPType(omm.MetaIPTypeEnumV4),
FirstScanRange: "192.168.1.1",
LastScanRange: "192.168.1.255",
DiscoverPort: dp,
}
resCh := make(chan interface{})
errCh := make(chan error)
stopCh := make(chan struct{})
ScanHost(z, dh, resCh, errCh, stopCh)
for res := range resCh {
t.Log(res)
}
for err := range errCh {
t.Log(err)
}
2018-08-12 11:08:31 +00:00
}