sql

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ISQL

type ISQL interface {
	// 打开数据库连接
	// !在调用完数据库后一定要使用Close关闭连接。
	//  @param h host
	//  @param u user
	//  @param p password
	//  @param d database name
	//  @return *sql.DB db指针
	//  @return error 错误
	Open(h, u, p, d string) bool

	// 关闭数据库连接
	// !在调用完数据库后一定要关闭连接。
	Close()

	// 通过查询已知文件表(known file table)来判断文件是否已知
	// 如果是已知文件,则会填充对应的数据
	IsKnownFileByName(exfile *common.ExtractedFile) bool

	// 通过查询文件类型表(file type table)来判断文件是否已知
	// 如果是已知文件,则会填充对应的数据
	IsKnownFileByType(exfile *common.ExtractedFile) bool

	// 获取内核表中所有的数据
	// todo 根据内核版本返回符合版本的漏洞信息
	GetAllKernelVuln() []common.Vulnerablity

	// 获取该文件的漏洞列表
	GetProgramVulnerabilities(*common.ExtractedFile) (
		[]common.Vulnerablity, error)

	// 搜索符合条件的程序漏洞
	SearchProgramVulnerabilityTable(common.ExtractedFile) []common.Vulnerablity
}
var Isql ISQL

sql操作对象

type MySQL

type MySQL struct {
	DBPtr *sql.DB
}

func (*MySQL) Close

func (pg *MySQL) Close()

关闭数据库连接 !在调用完数据库后一定要关闭连接。

func (*MySQL) GetAllKernelVuln

func (mysql *MySQL) GetAllKernelVuln() (kvs []common.Vulnerablity)

从内核CVE表中查询

@return 所有关于内核CVE的记录

func (*MySQL) GetProgramVulnerabilities

func (mysql *MySQL) GetProgramVulnerabilities(
	exfile *common.ExtractedFile) (
	vlunerabilities []common.Vulnerablity, err error)

判断是否存在漏洞

func (*MySQL) IsKnownFileByName

func (mysql *MySQL) IsKnownFileByName(exfile *common.ExtractedFile) bool

从known_file表中查询

@param 关键字:文件名
@return known_file_struct文件信息结构体的数组

func (*MySQL) IsKnownFileByType

func (mysql *MySQL) IsKnownFileByType(exfile *common.ExtractedFile) bool

从file_type表中查询

@param 文件结构体
@return 是否查询到对应的记录

func (*MySQL) Open

func (mysql *MySQL) Open(h, u, p, d string) bool

func (*MySQL) SearchProgramVulnerabilityTable

func (mysql *MySQL) SearchProgramVulnerabilityTable(
	exfile common.ExtractedFile) (vlunerabilities []common.Vulnerablity)

type PostgresSQL

type PostgresSQL struct {
	DBPtr *sql.DB
}

func (*PostgresSQL) Close

func (pg *PostgresSQL) Close()

关闭数据库连接 !在调用完数据库后一定要关闭连接。

func (*PostgresSQL) GetAllKernelVuln

func (pg *PostgresSQL) GetAllKernelVuln() (kvs []common.Vulnerablity)

从内核CVE表中查询

@return 所有关于内核CVE的记录

func (*PostgresSQL) GetProgramVulnerabilities

func (pg *PostgresSQL) GetProgramVulnerabilities(
	exfile *common.ExtractedFile) (
	vlunerabilities []common.Vulnerablity, err error)

判断是否存在漏洞

func (*PostgresSQL) IsKnownFileByName

func (pg *PostgresSQL) IsKnownFileByName(exfile *common.ExtractedFile) bool

从known_file表中查询

@param 关键字:文件名
@return known_file_struct文件信息结构体的数组

func (*PostgresSQL) IsKnownFileByType

func (pg *PostgresSQL) IsKnownFileByType(exfile *common.ExtractedFile) bool

从file_type表中查询

@param 文件结构体
@return 是否查询到对应的记录

func (*PostgresSQL) Open

func (pg *PostgresSQL) Open(h, u, p, d string) bool

OpenPostgresDB 打开Postgres数据库

@return bool true:正常打开数据库,false:打开数据库失败

!在调用完数据库后一定要使用ClosePostgresDB关闭连接。

func (*PostgresSQL) SearchProgramVulnerabilityTable

func (pg *PostgresSQL) SearchProgramVulnerabilityTable(
	exfile common.ExtractedFile) (vlunerabilities []common.Vulnerablity)

Jump to

Keyboard shortcuts

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