types.go 6.14 KB
Newer Older
qiuqunfeng's avatar
qiuqunfeng committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
package service

import "encoding/json"

type Intelligence struct {
	Source     string      `json:"source"`
	Confidence int         `json:"confidence"`
	Expired    bool        `json:"expired"`
	IntelTags  []TagsClass `json:"intel_tags"`
	FindTime   string      `json:"find_time"`
	IntelTypes []string    `json:"intel_types"`
	UpdateTime string      `json:"update_time"`
}

type OpenSource struct {
	Source     string      `json:"source"`
	Confidence int         `json:"confidence"`
	Expired    bool        `json:"expired"`
	IntelTags  []TagsClass `json:"intel_tags"`
	FindTime   string      `json:"find_time"`
	IntelTypes []string    `json:"intel_types"`
	UpdateTime string      `json:"update_time"`
}

type Location struct {
	Country     string `json:"country"`
	Province    string `json:"province"`
	City        string `json:"city"`
	Longitude   string `json:"lng"`
	Latitude    string `json:"lat"`
	CountryCode string `json:"country_code"`
}

type Basic struct {
	Carrier  string   `json:"carrier"`
	Location Location `json:"location"`
}

type ASN struct {
	Rank   int    `json:"rank"`
	Info   string `json:"info"`
	Number int    `json:"number"`
}

type Port struct {
	Port    int    `json:"port"`
	Module  string `json:"module"`
	Product string `json:"product"`
	Version string `json:"version"`
	Detail  string `json:"detail"`
}

type RDNS struct {
	RDNS    string `json:"rdns"`
	GetTime string `json:"get_time"`
}

type Intelligences struct {
	ThreatbookLab []Intelligence `json:"threatbook_lab"`
	XReward       []interface{}  `json:"x_reward"`
	OpenSource    []OpenSource   `json:"open_source"`
}

type Sample struct {
	Hash          string `json:"sha256"`
	ScanTime      string `json:"scan_time"`
	Ratio         string `json:"ratio"`
	MalwareType   string `json:"malware_type"`
	MalwareFamily string `json:"malware_family"`
}

type TagsClass struct {
	TagsType string   `json:"tags_type"` //标签类别,如"industry(行业)"、"gangs(团伙)"、"virus_family(家族)"等
	Tags     []string `json:"tags"`      //具体的攻击团伙或安全事件标签,例如:APT、海莲花等。
}

type CAS struct {
	Protocol           string      `json:"protocol"`
	Port               int16       `json:"port"`
	Period             int         `json:"period"`
	DigitalCertificate Certificate `json:"digital_certificate"`
}

type Certificate struct {
	Subject      string `json:"subject"`
	Issuer       string `json:"issuer"`
	Fingerprint  string `json:"fingerprint"`
	Purpose      string `json:"purpose"`
	Verify       string `json:"verify"`
	Status       string `json:"status"`
	Revoked      bool   `json:"revoked"`
	Begin        string `json:"begin"`
	End          string `json:"end"`
	StatusDesc   string `json:"status_desc"`
	SerialNumber string `json:"serial_number"`
	RevokedTime  string `json:"revoked_time"`
}

type IpInfo struct {
	Samples       []Sample      `json:"samples"`
	TagsClasses   []TagsClass   `json:"tags_classes"`
	Judgments     []string      `json:"judgments"`
	Intelligences Intelligences `json:"intelligences"`
	Scene         string        `json:"scene"`
	Basic         Basic         `json:"basic"`
	ASN           ASN           `json:"asn"`
	Ports         []Port        `json:"ports"`
	CAS           []CAS         `json:"cas"`
	UpdateTime    string        `json:"update_time"`
	RDNSList      []RDNS        `json:"rdns_list"`
	SumCurDomains string        `json:"sum_cur_domains"`
}

type RespData struct {
	Data         map[string]json.RawMessage `json:"data"`
	ResponseCode int                        `json:"response_code"`
	VerboseMsg   string                     `json:"verbose_msg"`
}

type Reputation struct {
	IsMalicious bool `json:"is_malicious"`
}

type ASNPrivate struct {
	Rank   int    `json:"rank"`
	Info   string `json:"info"`
	Number string `json:"number"`
}

type LocationPrivate struct {
	Country     string  `json:"country"`
	Province    string  `json:"province"`
	City        string  `json:"city"`
	Longitude   float64 `json:"lng"`
	Latitude    float64 `json:"lat"`
	CountryCode string  `json:"country_code"`
}

type BasicPrivate struct {
	Carrier  string          `json:"carrier"`
	Location LocationPrivate `json:"location"`
}

type TagsClassPrivate map[string][]string

type IPInfoPrivate struct {
	Judgments   []string         `json:"judgments"`
	Basic       BasicPrivate     `json:"basic"`
	ASN         ASNPrivate       `json:"asn"`
	Scene       string           `json:"scene"`
	IsMalicious bool             `json:"is_malicious"`
	TagsClasses TagsClassPrivate `json:"tags_classes"`
}

type IPInfoPrivateRespData struct {
	IOC          string          `json:"ioc"`
	Intelligence []IPInfoPrivate `json:"intelligence"`
}

type IPInfoPrivateResp struct {
	Data         []IPInfoPrivateRespData `json:"data"`
	ResponseCode int                     `json:"response_code"`
	VerboseMsg   string                  `json:"verbose_msg"`
}

type Waf struct {
	GatewayName string `json:"gateway_name"`
	Mode        string `json:"mode"`
	RuleNum     int    `json:"rule_num"`
	AttackNum   int    `json:"attack_num"`
} // WAF configuration details

type CreateWafReq struct {
	RegionCode  string   `json:"region_code"`
	Namespace   string   `json:"namespace"`
	GatewayName string   `json:"gateway_name"`
	Port        uint32   `json:"port"`
	Host        []string `json:"host"`
}

type RuleRequest struct {
	CategoryID []string `json:"category_id"`
	Status     int      `json:"status"`
}
qiuqunfeng's avatar
commit  
qiuqunfeng committed
185 186 187 188 189 190 191

type UpdateModeReq struct {
	Mode        string `json:"mode"`
	GatewayName string `json:"gateway_name"`
	Namespace   string `json:"namespace"`
	RegionCode  string `json:"region_code"`
}
qiuqunfeng's avatar
commit  
qiuqunfeng committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219

type WafRule struct {
	ID          int    `json:"id"`
	Level       int    `json:"level"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Expr        string `json:"expr"`
	Mode        string `json:"mode"`
}

type Catagory struct {
	EN string `json:"en"`
	Zh string `json:"zh"`
}

type Description struct {
	EN string `json:"en"`
	Zh string `json:"zh"`
}

type WafRuleCategory struct {
	CategoryID  string      `json:"category_id"`
	Status      int         `json:"status,omitempty"`
	Catagory    Catagory    `json:"catagory"`
	Description Description `json:"description"`
	Rules       []WafRule   `json:"rules"`
}