ing
This commit is contained in:
parent
467b1e0e59
commit
a0c0fefa8d
10
modules/discovery/model/DiscoveryHost.go
Normal file
10
modules/discovery/model/DiscoveryHost.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
package model
|
||||
|
||||
type DiscoveryHost struct {
|
||||
FirstScanRange string `json:"firstScanRange,omitempty"`
|
||||
LastScanRange string `json:"lastScanRange,omitempty"`
|
||||
ExcludeHosts []string `json:"excludeHosts,omitempty"`
|
||||
IncludeHosts []string `json:"includeHosts,omitempty"`
|
||||
|
||||
DiscoveryPort *DiscoveryPort `json:"discoveryPort,omitempty"`
|
||||
}
|
28
modules/discovery/model/DiscoveryPort.go
Normal file
28
modules/discovery/model/DiscoveryPort.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package model
|
||||
|
||||
type DiscoveryPort struct {
|
||||
FirstScanRange int `json:"firstScanRange,omitempty"`
|
||||
LastScanRange int `json:"lastScanRange,omitempty"`
|
||||
ExcludePorts []int `json:"excludePorts,omitempty"`
|
||||
|
||||
IncludeTCP bool `json:"includeTCP,omitempty"`
|
||||
IncludeUDP bool `json:"includeUDP,omitempty"`
|
||||
|
||||
DiscoveryService *DiscoveryService `json:"discoveryService,omitempty"`
|
||||
}
|
||||
|
||||
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
|
||||
}
|
6
modules/discovery/model/DiscoveryService.go
Normal file
6
modules/discovery/model/DiscoveryService.go
Normal file
|
@ -0,0 +1,6 @@
|
|||
package model
|
||||
|
||||
|
||||
type DiscoveryService struct {
|
||||
IncludeServices []string `json:"includeServices,omitempty"`
|
||||
}
|
7
modules/discovery/model/DiscoveryZone.go
Normal file
7
modules/discovery/model/DiscoveryZone.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package model
|
||||
|
||||
type DiscoveryZone struct {
|
||||
ExcludePatterns []string `json:"excludePatterns,omitempty"`
|
||||
|
||||
DiscoveryHost *DiscoveryHost `json:"discoveryHost,omitempty"`
|
||||
}
|
18
modules/discovery/model/Host.go
Normal file
18
modules/discovery/model/Host.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.loafle.net/overflow/overflow_commons_go/util"
|
||||
)
|
||||
|
||||
type Host struct {
|
||||
Zone *Zone `json:"zone"`
|
||||
|
||||
ID json.Number `json:"id,Number,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Mac string `json:"mac,omitempty"`
|
||||
OS string `json:"os,omitempty"`
|
||||
|
||||
DiscoveredDate util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
}
|
21
modules/discovery/model/Port.go
Normal file
21
modules/discovery/model/Port.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/google/gopacket"
|
||||
|
||||
util "git.loafle.net/overflow/overflow_commons_go/util"
|
||||
)
|
||||
|
||||
type Port struct {
|
||||
Host *Host `json:"host,omitempty"`
|
||||
|
||||
ID json.Number `json:"id,Number,omitempty"`
|
||||
PortType string `json:"portType,omitempty"`
|
||||
PortNumber json.Number `json:"portNumber,omitempty"`
|
||||
|
||||
DiscoveredDate util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
|
||||
UDPLayer gopacket.Layer `json:"-"`
|
||||
}
|
17
modules/discovery/model/Service.go
Normal file
17
modules/discovery/model/Service.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
util "git.loafle.net/overflow/overflow_commons_go/util"
|
||||
)
|
||||
|
||||
type Service struct {
|
||||
Port *Port `json:"port,omitempty"`
|
||||
|
||||
ID json.Number `json:"id,Number,omitempty"`
|
||||
CryptoType string `json:"cryptoType,omitempty"`
|
||||
ServiceName string `json:"serviceName,omitempty"`
|
||||
|
||||
DiscoveredDate util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
}
|
20
modules/discovery/model/Zone.go
Normal file
20
modules/discovery/model/Zone.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"sync"
|
||||
|
||||
"git.loafle.net/overflow/overflow_commons_go/util"
|
||||
)
|
||||
|
||||
type Zone struct {
|
||||
ID json.Number `json:"id,Number,omitempty"`
|
||||
Network string `json:"network,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
Iface string `json:"iface,omitempty"`
|
||||
Mac string `json:"mac,omitempty"`
|
||||
|
||||
DiscoveredDate util.Timestamp `json:"discoveredDate,omitempty"`
|
||||
|
||||
mtx sync.RWMutex `json:"-"`
|
||||
}
|
13
modules/discovery/service/discovery/DiscoveryService.go
Normal file
13
modules/discovery/service/discovery/DiscoveryService.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package discovery
|
||||
|
||||
import (
|
||||
discoveryM "git.loafle.net/overflow/overflow_commons_go/modules/discovery/model"
|
||||
)
|
||||
|
||||
type DiscoveryService interface {
|
||||
// use by probe
|
||||
DiscoverZone(dz *discoveryM.DiscoveryZone) error
|
||||
DiscoverHost(zone *discoveryM.Zone, dz *discoveryM.DiscoveryHost) error
|
||||
DiscoverPort(host *discoveryM.Host, dz *discoveryM.DiscoveryPort) error
|
||||
DiscoverService(port *discoveryM.Port, dz *discoveryM.DiscoveryService) error
|
||||
}
|
19
modules/discovery/service/probe/DiscoveryService.go
Normal file
19
modules/discovery/service/probe/DiscoveryService.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package probe
|
||||
|
||||
import (
|
||||
discoveryM "git.loafle.net/overflow/overflow_commons_go/modules/discovery/model"
|
||||
)
|
||||
|
||||
type DiscoveryService interface {
|
||||
// use by central
|
||||
DiscoverZone(dz *discoveryM.DiscoveryZone) error
|
||||
DiscoverHost(zone *discoveryM.Zone, dz *discoveryM.DiscoveryHost) error
|
||||
DiscoverPort(host *discoveryM.Host, dz *discoveryM.DiscoveryPort) error
|
||||
DiscoverService(port *discoveryM.Port, dz *discoveryM.DiscoveryService) error
|
||||
|
||||
// use by discovery
|
||||
DiscoveredZone(zone *discoveryM.Zone)
|
||||
DiscoveredHost(host *discoveryM.Host)
|
||||
DiscoveredPort(port *discoveryM.Port)
|
||||
DiscoveredService(service *discoveryM.Service)
|
||||
}
|
Loading…
Reference in New Issue
Block a user