2017-11-15 10:38:42 +00:00
|
|
|
package model
|
|
|
|
|
|
|
|
type DiscoveryZone struct {
|
|
|
|
ExcludePatterns []string `json:"excludePatterns"`
|
|
|
|
|
|
|
|
DiscoveryHost *DiscoveryHost `json:"discoveryHost"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DiscoveryHost struct {
|
|
|
|
FirstScanRange string `json:"firstScanRange"`
|
|
|
|
LastScanRange string `json:"lastScanRange"`
|
|
|
|
ExcludeHosts []string `json:"excludeHosts"`
|
2017-11-22 05:55:40 +00:00
|
|
|
IncludeHosts []string `json:"includeHosts"`
|
2017-11-15 10:38:42 +00:00
|
|
|
|
|
|
|
DiscoveryPort *DiscoveryPort `json:"discoveryPort"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type DiscoveryPort struct {
|
|
|
|
FirstScanRange int `json:"firstScanRange"`
|
|
|
|
LastScanRange int `json:"lastScanRange"`
|
|
|
|
ExcludePorts []int `json:"excludePorts"`
|
|
|
|
|
2017-11-21 05:31:17 +00:00
|
|
|
IncludeTCP bool `json:"includeTCP"`
|
|
|
|
IncludeUDP bool `json:"includeUDP"`
|
|
|
|
|
2017-11-15 10:38:42 +00:00
|
|
|
DiscoveryService *DiscoveryService `json:"discoveryService"`
|
|
|
|
}
|
|
|
|
|
2017-11-22 06:33:41 +00:00
|
|
|
func (dp *DiscoveryPort) Contains(port int) bool {
|
|
|
|
if dp.FirstScanRange < port {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if dp.LastScanRange > port {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
for _, p := range dp.ExcludePorts {
|
|
|
|
if p == port {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2017-11-15 10:38:42 +00:00
|
|
|
type DiscoveryService struct {
|
|
|
|
IncludeServices []string `json:"includeServices"`
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
Dzone --> zone --> Dhost --> host --> Dport --> port --> Dservice --> service
|
|
|
|
|
|
|
|
zone --> Dhost --> host --> Dport --> port --> Dservice --> service
|
|
|
|
|
|
|
|
host --> Dport --> port --> Dservice --> service
|
|
|
|
|
|
|
|
port --> Dservice --> service
|
|
|
|
*/
|