This commit is contained in:
crusader 2018-06-12 22:13:22 +09:00
parent c68381575d
commit ab936be303
50 changed files with 274 additions and 329 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

4
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,4 @@
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
}

View File

@ -1,15 +1,16 @@
package discovery
type DiscoverHost struct {
FirstScanRangeV4 string `json:"firstScanRangev4,omitempty"`
LastScanRangeV4 string `json:"lastScanRangev4,omitempty"`
ExcludeHostsV4 []string `json:"excludeHostsv4,omitempty"`
IncludeHostsV4 []string `json:"includeHostsv4,omitempty"`
import (
"git.loafle.net/overflow/commons-go/model/meta"
)
FirstScanRangeV6 string `json:"firstScanRangev6,omitempty"`
LastScanRangeV6 string `json:"lastScanRangev6,omitempty"`
ExcludeHostsV6 []string `json:"excludeHostsv6,omitempty"`
IncludeHostsV6 []string `json:"includeHostsv6,omitempty"`
type DiscoverHost struct {
MetaIPType *meta.MetaIPType `json:"metaIpType,omitempty"`
FirstScanRange string `json:"firstScanRange,omitempty"`
LastScanRange string `json:"lastScanRange,omitempty"`
ExcludeHosts []string `json:"excludeHosts,omitempty"`
IncludeHosts []string `json:"includeHosts,omitempty"`
DiscoverPort *DiscoverPort `json:"discoverPort,omitempty"`
}

View File

@ -1,24 +1,17 @@
package discovery
import "git.loafle.net/overflow/commons-go/core/util"
import (
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type Host struct {
//Zone *Zone `json:"zone"`
//
//ID json.Number `json:"id,Number,omitempty"`
//IPV4 string `json:"ipv4,omitempty"`
//IPV6 string `json:"ipv6,omitempty"`
//Mac string `json:"mac,omitempty"`
//OS string `json:"os,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
MetaIPTypeKey string `json:"metaIpTypeKey, omitempty"`
MetaIPType *meta.MetaIPType `json:"metaIpType,omitempty"`
Address string `json:"address,omitempty"`
Mac string `json:"mac,omitempty"`
Zone *Zone `json:"zone,omitempty"`
PortList []Port `json:"portList, omitempty"`
PortList []*Port `json:"portList,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
}

View File

@ -4,27 +4,17 @@ import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
"github.com/google/gopacket"
)
type Port struct {
MetaPortTypeKey string `json:"metaPortTypeKey,omitempty"`
MetaPortType *meta.MetaPortType `json:"metaPortType,omitempty"`
PortNumber json.Number `json:"portNumber,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
Host *Host `json:"host,omitempty"`
ServiceList []Service `json:"serviceList, omitempty"`
ServiceList []*Service `json:"serviceList,omitempty"`
UDPLayer gopacket.Layer `json:"-"`
//Host *Host `json:"host,omitempty"`
//
//ID json.Number `json:"id,Number,omitempty"`
//PortType constants.PortType `json:"portType,omitempty"`
//PortNumber json.Number `json:"portNumber,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
//
//UDPLayer gopacket.Layer `json:"-"`
}

View File

@ -1,21 +1,15 @@
package discovery
import "git.loafle.net/overflow/commons-go/core/util"
import (
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type Service struct {
MetaCryptoTypeKey string `json:"metaCryptoTypeKey, omitempty"`
MetaCryptoTypeKey *meta.MetaCryptoType `json:"metaCryptoType,omitempty"`
Name string `json:"name,omitempty"`
Port *Port `json:"port,omitempty"`
DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
//Port *Port `json:"port,omitempty"`
//
//ID json.Number `json:"id,Number,omitempty"`
//CryptoType constants.CryptoType `json:"cryptoType,omitempty"`
//ServiceName string `json:"serviceName,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
}

View File

@ -1,25 +1,16 @@
package discovery
import (
"git.loafle.net/overflow/commons-go/core/util"
"sync"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type Zone struct {
//ID json.Number `json:"id,Number,omitempty"`
//Network string `json:"network,omitempty"`
//IPV4 string `json:"ipv4,omitempty"`
//IPV6 string `json:"ipv6,omitempty"`
//Iface string `json:"iface,omitempty"`
//Mac string `json:"mac,omitempty"`
//
//DiscoveredDate *util.Timestamp `json:"discoveredDate,omitempty"`
//
//mtx sync.RWMutex `json:"-"`
Network string `json:"network,omitempty"`
Iface string `json:"iface,omitempty"`
MetaIPTypeKey string `json:"metaIPTypeKey, omitempty"`
MetaIPType *meta.MetaIPType `json:"metaIPType,omitempty"`
Address string `json:"address,omitempty"`
Mac string `json:"mac,omitempty"`

View File

@ -11,7 +11,6 @@ import (
type Infra struct {
ID json.Number `json:"id,Number,omitempty"`
MetaInfraType *meta.MetaInfraType `json:"metaInfraType,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Probe *probe.Probe `json:"probe,omitempty"`
//Target *target.Target `json:"target,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -10,8 +10,8 @@ type InfraHost struct {
MetaTargetHostType *meta.MetaTargetHostType `json:"metaTargetHostType,omitempty"`
InfraHostMachine *InfraHostMachine `json:"infraHostMachine,omitempty"`
InfraHostOS *InfraHostOS `json:"infraHostOS,omitempty"`
InfraHostIPs []InfraHostIP `json:"infraHostIPs,omitempty"`
InfraHostPorts []InfraHostPort `json:"infraHostPorts,omitempty"`
InfraHostApplications []InfraHostApplication `json:"infraHostApplications, omitempty"`
InfraHostDaemons []InfraHostDaemon `json:"infraHostDaemons, omitempty"`
InfraHostIPs []*InfraHostIP `json:"infraHostIPs,omitempty"`
InfraHostPorts []*InfraHostPort `json:"infraHostPorts,omitempty"`
InfraHostApplications []*InfraHostApplication `json:"infraHostApplications,omitempty"`
InfraHostDaemons []*InfraHostDaemon `json:"infraHostDaemons,omitempty"`
}

View File

@ -1,14 +1,14 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type InfraHostApplication struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
InfraHost *InfraHost `json:"infraHost,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,14 +1,14 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type InfraHostDaemon struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
InfraHost *InfraHost `json:"infraHost,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -2,6 +2,7 @@ package infra
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)

View File

@ -1,8 +1,9 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type InfraHostMachine struct {

View File

@ -1,12 +1,12 @@
package infra
import (
"git.loafle.net/overflow/commons-go/core/util"
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type InfraHostOS struct {
ID json.Number `json:"id,Number,omitempty"`
InfraHost *InfraHost `json:"infraHost,omitempty"`
Name string `json:"name,omitempty"`

View File

@ -2,6 +2,7 @@ package infra
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)

View File

@ -10,7 +10,7 @@ import (
type Member struct {
ID json.Number `json:"id,Number,omitempty"`
Email string `json:"email,omitempty"`
Pw string `json:"pw,omitempty"`
Password string `json:"password,omitempty"`
Name string `json:"name,omitempty"`
Phone string `json:"phone,omitempty"`
CompanyName string `json:"companyName,omitempty"`

View File

@ -12,5 +12,4 @@ type MetaCrawler struct {
Key string `json:"key,omitempty"`
IsDefault bool `json:"isDefault,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
@ -9,7 +10,6 @@ type MetaIPType struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,14 +0,0 @@
package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type MetaInfraVendor struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
MetaInfraType *MetaInfraType `json:"metaInfraType,omitempty"`
}

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
@ -11,3 +12,32 @@ type MetaPortType struct {
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}
type MetaPortTypeEnum int
const (
MetaPortTypeEnumTCP MetaPortTypeEnum = 1
MetaPortTypeEnumUDP MetaPortTypeEnum = 2
)
var (
metaPortTypeEnumID = map[MetaPortTypeEnum]string{
MetaPortTypeEnumTCP: "TCP",
MetaPortTypeEnumUDP: "UDP",
}
metaPortTypeEnumKey = map[string]MetaPortTypeEnum{
"TCP": MetaPortTypeEnumTCP,
"UDP": MetaPortTypeEnumUDP,
}
)
func ToMetaPortTypeEnum(v *MetaPortType) MetaPortTypeEnum {
return metaPortTypeEnumKey[v.Key]
}
func ToMetaPortType(v MetaPortTypeEnum) *MetaPortType {
return &MetaPortType{
Key: metaPortTypeEnumID[v],
}
}

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
@ -9,7 +10,6 @@ type MetaProbeStatus struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Key string `json:"key,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -1,14 +0,0 @@
package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)
type MetaProbeTaskType struct {
ID json.Number `json:"id,Number,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -2,6 +2,7 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
)

View File

@ -25,8 +25,7 @@ func ToMetaTargetHostTypeEnum(v *MetaTargetHostType) MetaTargetHostTypeEnum {
}
func ToMetaTargetHostType(v MetaTargetHostTypeEnum) *MetaTargetHostType {
m := &MetaTargetHostType {
}
m := &MetaTargetHostType{}
m.Key = metaTargetHostTypeEnumID[v]
return m

View File

@ -25,8 +25,7 @@ func ToMetaTargetServiceTypeEnum(v *MetaTargetServiceType) MetaTargetServiceType
}
func ToMetaTargetServiceType(v MetaTargetServiceTypeEnum) *MetaTargetServiceType {
m := &MetaTargetServiceType {
}
m := &MetaTargetServiceType{}
m.Key = metaTargetServiceTypeEnumID[v]
return m

View File

@ -2,16 +2,15 @@ package meta
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow_backup_2018_0455/overflow_service/proxy/meta"
)
type MetaTargetType struct {
ID json.Number `json:"id,Number,omitempty"`
MetaInfraType *meta.MetaInfraType `json:"metaInfraType, omitempty"`
MetaInfraType *MetaInfraType `json:"metaInfraType,omitempty"`
Key string `json:"key,omitempty"`
Name string `json:"name,omitempty"`
IsSupported bool `json:"isSupported,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
}

View File

@ -5,6 +5,7 @@ type MetaTargetZoneType struct {
}
type MetaTargetZoneTypeEnum int
const (
MetaTargetZoneTypeEnumUNKNOWN MetaTargetZoneTypeEnum = 1
MetaTargetZoneTypeEnumZONE MetaTargetZoneTypeEnum = 2
@ -27,8 +28,7 @@ func ToMetaTargetZoneTypeEnum(v *MetaTargetZoneType) MetaTargetZoneTypeEnum {
}
func ToMetaTargetZoneType(v MetaTargetZoneTypeEnum) *MetaTargetZoneType {
m := &MetaTargetZoneType {
}
m := &MetaTargetZoneType{}
m.Key = metaTargetZoneTypeEnumID[v]
return m

View File

@ -4,14 +4,14 @@ import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/domain"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/probe"
)
type NoAuthProbe struct {
ID json.Number `json:"id,Number,omitempty"`
Domain *domain.DomainMember `json:"domain,omitempty"`
Domain *domain.Domain `json:"domain,omitempty"`
Probe *probe.Probe `json:"probe,omitempty"`
MetaNoAuthProbeStatus *meta.MetaNoAuthProbeStatus `json:"metaNoAuthProbeStatus,omitempty"`
InfraHostMeta string `json:"infraHostMeta,omitempty"`

View File

@ -1,6 +0,0 @@
package noauthprobe
type NoAuthProbeDescription struct {
Host *NoAuthProbeDescriptionHost `json:"host,omitempty"`
Network *NoAuthProbeDescriptionNetwork `json:"network,omitempty"`
}

View File

@ -1,11 +0,0 @@
package noauthprobe
type NoAuthProbeDescriptionHost struct {
Name string `json:"name,omitempty"`
OS string `json:"os,omitempty"`
Platform string `json:"paltform,omitempty"`
PlatformFamily string `json:"platformFamily,omitempty"`
PlatformVersion string `json:"platformVersion,omitempty"`
KernelVersion string `json:"kernelVersion,omitempty"`
HostID string `json:"hostID,omitempty"`
}

View File

@ -1,8 +0,0 @@
package noauthprobe
type NoAuthProbeDescriptionNetwork struct {
Name string `json:"name,omitempty"`
Address string `json:"address,omitempty"`
Gateway string `json:"gateway,omitempty"`
MacAddress string `json:"macAddress,omitempty"`
}

View File

@ -9,10 +9,10 @@ import (
type Notification struct {
ID json.Number `json:"id,Number,omitempty"`
CreateDate *util.Timestamp `json:"date,omitempty"`
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
Member *member.Member `json:"member,omitempty"`
URL string `json:"url,omitempty"`
ConfirmDate *util.Timestamp `json:"confirmDate,omitempty"`
Url string `json:"url,omitempty"`
CreateDate *util.Timestamp `json:"date,omitempty"`
}

View File

@ -4,9 +4,9 @@ import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
"git.loafle.net/overflow/commons-go/model/domain"
"git.loafle.net/overflow/commons-go/model/member"
"git.loafle.net/overflow/commons-go/model/meta"
)
type Probe struct {
@ -21,7 +21,7 @@ type Probe struct {
AuthorizeDate *util.Timestamp `json:"authorizeDate,omitempty"`
AuthorizeMember *member.Member `json:"authorizeMember,omitempty"`
TargetCount int `json:"targetCount,omitempty"`
ConnectDate *util.Timestamp `json:"connectDate,omitempty"`
ConnectAddress string `json:"connectAddress,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
ConnectDate *util.Timestamp `json:"connectDate,omitempty"`
}

View File

@ -1,20 +0,0 @@
package probe
import (
"encoding/json"
"git.loafle.net/overflow/commons-go/core/util"
"git.loafle.net/overflow/commons-go/model/meta"
)
type ProbeTask struct {
ID json.Number `json:"id,Number,omitempty"`
MetaProbeTaskType *meta.MetaProbeTaskType `json:"metaProbeTaskType,omitempty"`
Probe *Probe `json:"probe,omitempty"`
Data string `json:"data,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
SendDate *util.Timestamp `json:"sendDate,omitempty"`
StartDate *util.Timestamp `json:"startDate,omitempty"`
EndDate *util.Timestamp `json:"endDate,omitempty"`
Succeed bool `json:"succeed,omitempty"`
}

View File

@ -10,5 +10,5 @@ type Connection struct {
IP string `json:"ip,omitempty"`
Port json.Number `json:"port,Number,omitempty"`
MetaPortType *meta.MetaPortType `json:"metaPortType,omitempty"`
SSL bool `json:"ssl,omitempty"`
MetaCryptoType *meta.MetaCryptoType `json:"metaCryptoType,omitempty"`
}

View File

@ -1,7 +1,7 @@
package sensorconfig
type Item struct {
Keys []Keys `json:"keys,omitempty"`
Keys []*Keys `json:"keys,omitempty"`
QueryInfo *QueryInfo `json:"queryInfo,omitempty"`
MappingInfo *MappingInfo `json:"mappingInfo,omitempty"`
}

View File

@ -8,5 +8,5 @@ type SensorConfig struct {
Target *Target `json:"target,omitempty"`
Schedule *Schedule `json:"schedule,omitempty"`
Crawler *Crawler `json:"crawler,omitempty"`
Items []Item `json:"items,omitempty"`
Items []*Item `json:"items,omitempty"`
}

View File

@ -17,5 +17,5 @@ type Target struct {
Description string `json:"description,omitempty"`
SensorCount json.Number `json:"sensorCount,omitempty"`
CreateDate *util.Timestamp `json:"createDate,omitempty"`
Sensors []sensor.Sensor `json:"sensors,omitempty"`
Sensors []*sensor.Sensor `json:"sensors,omitempty"`
}