api

package
v0.0.0-...-3e1336a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Domain           = "www.cnnvd.org.cn"
	APIVulDetail     = "web/cnnvdVul/getCnnnvdDetailOnDatasource"
	APIVulList       = "web/homePage/cnnvdVulList"
	APIVendor        = "web/homePage/getVendorSelectList"
	APIVulType       = "web/homePage/vulTypeList"
	APIProduct       = "web/homePage/getProductSelectList"
	APIHazardLevel   = "web/dictionaries/type/hazardLevel"
	PageSize         = 100
	Retry            = 5
	FirstYear        = 1988
	DatabaseSource   = "root:1600850141yangli@tcp(localhost:3306)/cnnvd?charset=utf8mb4&parseTime=true&loc=Asia%2FShanghai"
	ProductName      = "cnnvd/api/product.go"
	VendorName       = "cnnvd/api/vendor.go"
	VulDetailName    = "cnnvd/api/vul_detail.go"
	VulListName      = "cnnvd/api/vul_list.go"
	VulTypeName      = "cnnvd/api/vul_type.go"
	HazardLevelName  = "cnnvd/api/hazard_level.go"
	ProductTable     = "product"
	VendorTable      = "vendor"
	VulListTable     = "vul_list"
	VulDetailTable   = "vul_detail"
	VulTypeTable     = "vul_type"
	HazardLevelTable = "hazard_level"
	VendorFile       = "vendor.json"
	ProductFile      = "product.json"
	VulTypeFile      = "vul_type.json"
	VulListFile      = "vul_list"
	VulDetailFile    = "vul_detail"
	HazardLevelFile  = "hazard_level.json"
)

Variables

This section is empty.

Functions

func CreateTable

func CreateTable(db *gorm.DB, name string) (err error)

func FormatKeyword

func FormatKeyword(year int, month string) string

func LatestCNNVD

func LatestCNNVD(str1, str2 string) (string, error)

func SaveCNNVDPerYear

func SaveCNNVDPerYear(dirPath string, cnnvdID string, data interface{}) error

SaveCNNVDPerYear 存储每年的漏洞

Types

type CNNVD

type CNNVD struct {
	Year  string
	Month string
	ID    int
}

func NewCNNVD

func NewCNNVD(str string) (*CNNVD, error)

func (*CNNVD) After

func (c *CNNVD) After(item *CNNVD) (bool, error)

func (*CNNVD) Before

func (c *CNNVD) Before(item *CNNVD) (bool, error)

func (*CNNVD) Equal

func (c *CNNVD) Equal(item *CNNVD) bool

func (*CNNVD) GetDate

func (c *CNNVD) GetDate() (*time.Time, error)

type CNNVDDetail

type CNNVDDetail struct {
	Id                 string `json:"id,omitempty"`
	VulName            string `json:"vulName,omitempty"`
	CnnvdCode          string `json:"cnnvdCode,omitempty"`
	CveCode            string `json:"cveCode,omitempty"`
	PublishTime        string `json:"publishTime,omitempty"`
	IsOfficial         int    `json:"isOfficial,omitempty"`
	Vendor             string `json:"vendor,omitempty"`
	HazardLevel        int    `json:"hazardLevel,omitempty"`
	VulType            string `json:"vulType,omitempty"`
	VulTypeName        string `json:"vulTypeName,omitempty"`
	VulDesc            string `json:"vulDesc"`
	AffectedProduct    string `json:"affectedProduct,omitempty"`
	AffectedVendor     string `json:"affectedVendor,omitempty"`
	ProductDesc        string `json:"productDesc,omitempty"`
	AffectedSystem     string `json:"affectedSystem,omitempty"`
	ReferUrl           string `json:"referUrl,omitempty"`
	PatchId            string `json:"patchId,omitempty"`
	Patch              string `json:"patch,omitempty"`
	Deleted            string `json:"deleted,omitempty"`
	Version            string `json:"version,omitempty"`
	CreateUid          string `json:"createUid,omitempty"`
	CreateUname        string `json:"createUname,omitempty"`
	CreateTime         string `json:"createTime,omitempty"`
	UpdateUid          string `json:"updateUid,omitempty"`
	UpdateUname        string `json:"updateUname,omitempty"`
	UpdateTime         string `json:"updateTime,omitempty"`
	CnnvdFiledShow     string `json:"cnnvdFiledShow,omitempty"`
	CveVulVO           string `json:"cveVulVO,omitempty"`
	CveFiledShow       string `json:"cveFiledShow,omitempty"`
	IbmVulVO           string `json:"ibmVulVO,omitempty"`
	IbmFiledShow       string `json:"ibmFiledShow,omitempty"`
	IcsCertVulVO       string `json:"icsCertVulVO,omitempty"`
	IcsCertFiledShow   string `json:"icsCertFiledShow,omitempty"`
	MicrosoftVulVO     string `json:"microsoftVulVO,omitempty"`
	MicrosoftFiledShow string `json:"microsoftFiledShow,omitempty"`
	HuaweiVulVO        string `json:"huaweiVulVO,omitempty"`
	HuaweiFiledShow    string `json:"huaweiFiledShow,omitempty"`
	NvdVulVO           string `json:"nvdVulVO,omitempty"`
	NvdFiledShow       string `json:"nvdFiledShow,omitempty"`
	Varchar1           string `json:"varchar1,omitempty"`
}

CNNVDDetail CNNVD详情

type HazardLevel

type HazardLevel struct {
	DictLabel string `json:"dictLabel,omitempty" gorm:"uniqueIndex size:256"`
	DictValue string `json:"dictValue,omitempty"`
}

HazardLevel 产品列表

type Product

type Product struct {
	Label string `json:"label,omitempty" gorm:"uniqueIndex size:256"`
	Value string `json:"value,omitempty"`
}

Product 产品列表

type Record

type Record struct {
	Id          string `json:"id,omitempty"`
	VulName     string `json:"vulName,omitempty"`
	CnnvdCode   string `json:"cnnvdCode,omitempty"`
	CveCode     string `json:"cveCode,omitempty"`
	HazardLevel int64  `json:"hazardLevel,omitempty"`
	CreateTime  string `json:"createTime,omitempty"`
	PublishTime string `json:"publishTime,omitempty"`
	UpdateTime  string `json:"updateTime,omitempty"`
	TypeName    string `json:"typeName,omitempty"`
	VulType     string `json:"vulType,omitempty"`
}

Record 漏洞列表记录

type ReqHazardLevel

type ReqHazardLevel struct {
}

ReqHazardLevel 威胁等级请求参数

func (*ReqHazardLevel) Fetch

func (r *ReqHazardLevel) Fetch() (*[]HazardLevel, error)

func (*ReqHazardLevel) Name

func (r *ReqHazardLevel) Name() string

func (*ReqHazardLevel) Save

func (r *ReqHazardLevel) Save(data *[]HazardLevel, dir string) error

func (*ReqHazardLevel) StoreByFile

func (r *ReqHazardLevel) StoreByFile(db *gorm.DB, dir string) error

func (*ReqHazardLevel) StoreByRequest

func (r *ReqHazardLevel) StoreByRequest(db *gorm.DB) error

type ReqProduct

type ReqProduct struct {
	ProductKeyword string `json:"productKeyword"` // 产品关键词
}

ReqProduct 产品选择列表请求参数

func (*ReqProduct) Fetch

func (r *ReqProduct) Fetch() (*[]Product, error)

func (*ReqProduct) Name

func (r *ReqProduct) Name() string

func (*ReqProduct) Save

func (r *ReqProduct) Save(data *[]Product, dir string) error

func (*ReqProduct) StoreByFile

func (r *ReqProduct) StoreByFile(db *gorm.DB, dir string) error

func (*ReqProduct) StoreByRequest

func (r *ReqProduct) StoreByRequest(db *gorm.DB) error

type ReqVendor

type ReqVendor struct {
	VendorKeyword string `json:"vendorKeyword"` // 供应商关键词
}

ReqVendor 供应商选择列表请求参数

func (*ReqVendor) Fetch

func (r *ReqVendor) Fetch() (*[]Vendor, error)

func (*ReqVendor) Name

func (r *ReqVendor) Name() string

func (*ReqVendor) Save

func (r *ReqVendor) Save(data *[]Vendor, dir string) error

func (*ReqVendor) StoreByFile

func (r *ReqVendor) StoreByFile(db *gorm.DB, dir string) error

func (*ReqVendor) StoreByRequest

func (r *ReqVendor) StoreByRequest(db *gorm.DB) error

type ReqVulDetail

type ReqVulDetail struct {
	Id        string `json:"id"`        // 漏洞id
	VulType   string `json:"vulType"`   // 漏洞类型
	CnnvdCode string `json:"cnnvdCode"` // cnnvd编号
}

ReqVulDetail cnnvd漏洞详情请求参数

func (*ReqVulDetail) Fetch

func (r *ReqVulDetail) Fetch() (*VulDetail, error)

func (*ReqVulDetail) Name

func (r *ReqVulDetail) Name() string

func (*ReqVulDetail) Save

func (r *ReqVulDetail) Save(data *VulDetail, dir string) error

func (*ReqVulDetail) StoreByFile

func (r *ReqVulDetail) StoreByFile(db *gorm.DB, dir string) error

func (*ReqVulDetail) StoreByRequest

func (r *ReqVulDetail) StoreByRequest(db *gorm.DB) error

type ReqVulList

type ReqVulList struct {
	PageIndex   int    `json:"pageIndex"`   // 分页索引
	PageSize    int    `json:"pageSize"`    // 分页大小
	Keyword     string `json:"keyword"`     // 关键字
	HazardLevel string `json:"hazardLevel"` // 漏洞等级
	VulType     string `json:"vulType"`     // 漏洞类型
	Vendor      string `json:"vendor"`      // 供应商
	Product     string `json:"product"`     // 产品
	DateType    string `json:"dateType"`    // 数据类型
}

ReqVulList cnnvd漏洞列表请求参数

func NewReqVulList

func NewReqVulList(keyword string) *ReqVulList

func (*ReqVulList) Fetch

func (r *ReqVulList) Fetch() (*[]Record, error)

func (*ReqVulList) GetLatestCNNVD

func (r *ReqVulList) GetLatestCNNVD(pageSize int) (string, error)

GetLatestCNNVD 获取最新的漏洞编号

func (*ReqVulList) Name

func (r *ReqVulList) Name() string

func (*ReqVulList) Save

func (r *ReqVulList) Save(data *[]Record, dir string) error

func (*ReqVulList) StoreByFile

func (r *ReqVulList) StoreByFile(db *gorm.DB, dir string) error

func (*ReqVulList) StoreByRequest

func (r *ReqVulList) StoreByRequest(db *gorm.DB) error

type ReqVulType

type ReqVulType struct {
}

ReqVulType 漏洞类型列表请求参数

func (*ReqVulType) Fetch

func (r *ReqVulType) Fetch() (*[]VulType, error)

func (*ReqVulType) Name

func (r *ReqVulType) Name() string

func (*ReqVulType) Save

func (r *ReqVulType) Save(data *[]VulType, dir string) error

func (*ReqVulType) StoreByFile

func (r *ReqVulType) StoreByFile(db *gorm.DB, dir string) error

func (*ReqVulType) StoreByRequest

func (r *ReqVulType) StoreByRequest(db *gorm.DB) error

type ResCode

type ResCode struct {
	Code    int    `json:"code,omitempty"`    // 代码
	Success bool   `json:"success,omitempty"` // 是否成功
	Message string `json:"message,omitempty"` // 消息
	Time    string `json:"time,omitempty"`    // 时间
}

ResCode 响应码

type ResHazardLevel

type ResHazardLevel struct {
	ResCode               // 响应码
	Data    []HazardLevel `json:"data,omitempty"` // 威胁等级列表
}

ResHazardLevel 威胁等级响应参数

type ResProduct

type ResProduct struct {
	ResCode           // 响应码
	Data    []Product `json:"data,omitempty"` // 产品列表
}

ResProduct 产品选择列表响应参数

type ResVendor

type ResVendor struct {
	ResCode          // 响应码
	Data    []Vendor `json:"data,omitempty"` // 供应商选择列表
}

ResVendor 供应商选择列表响应参数

type ResVulDetail

type ResVulDetail struct {
	ResCode           // 响应码
	Data    VulDetail `json:"data,omitempty"` // 漏洞详情数据
}

ResVulDetail cnnvd漏洞详情响应参数

type ResVulList

type ResVulList struct {
	ResCode         // 响应码
	Data    VulList `json:"data,omitempty"` // cnnvd漏洞列表
}

ResVulList 供应商选择列表响应参数

type ResVulType

type ResVulType struct {
	ResCode           // 响应码
	Data    []VulType `json:"data,omitempty"` // 漏洞类型列表
}

ResVulType 漏洞类型列表响应参数

type TableHazardLevel

type TableHazardLevel struct {
	gorm.Model
	HazardLevel
}

func (*TableHazardLevel) TableName

func (t *TableHazardLevel) TableName() string

type TableProduct

type TableProduct struct {
	gorm.Model
	Product
}

func (*TableProduct) TableName

func (t *TableProduct) TableName() string

type TableVendor

type TableVendor struct {
	gorm.Model
	Vendor
}

func (*TableVendor) TableName

func (v *TableVendor) TableName() string

type TableVulDetail

type TableVulDetail struct {
	gorm.Model
	VulDetail
}

func (*TableVulDetail) TableName

func (t *TableVulDetail) TableName() string

TableName 为Record绑定表名

type TableVulList

type TableVulList struct {
	gorm.Model
	Record
}

func (*TableVulList) TableName

func (l *TableVulList) TableName() string

type TableVulType

type TableVulType struct {
	gorm.Model
	Id    string `json:"id,omitempty"`
	Pid   string `json:"pid,omitempty"`
	Label string `json:"label,omitempty"`
}

func (*TableVulType) TableName

func (t *TableVulType) TableName() string

type Vendor

type Vendor struct {
	Label string `json:"label,omitempty" gorm:"uniqueIndex size:256"`
	Value string `json:"value,omitempty"`
}

Vendor 供应商选择列表

type VulDetail

type VulDetail struct {
	CNNVDDetail       `json:"cnnvdDetail,omitempty"` // CNNVD详情
	ReceviceVulDetail string                         `json:"receviceVulDetail,omitempty"` // 接收到的漏洞详情
}

VulDetail 漏洞详情数据

type VulList

type VulList struct {
	Total     int      `json:"total,omitempty"`
	Records   []Record `json:"records,omitempty"`
	PageIndex int      `json:"pageIndex,omitempty"`
	PageSize  int      `json:"pageSize,omitempty"`
}

VulList cnnvd漏洞列表

type VulType

type VulType struct {
	Id      string    `json:"id,omitempty"`
	Pid     string    `json:"pid,omitempty"`
	Label   string    `json:"label,omitempty"`
	Value   string    `json:"value,omitempty"`
	VulType []VulType `json:"children,omitempty"`
}

VulType 漏洞类型列表

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL