yakit

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: AGPL-3.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPFLOW_TAG        = "HTTPFLOW_TAG"
	HTTPFLOW_STATUSCODE = "HTTPFLOW_STATUSCODE"
)
View Source
const (
	HYBRIDSCAN_EXECUTING = "executing"
	HYBRIDSCAN_PAUSED    = "paused"
	HYBRIDSCAN_DONE      = "done"
	HYBRIDSCAN_ERROR     = "error"
)
View Source
const (
	BARE_REQUEST_GROUP  = "FLOW_ID_TO_BARE_REQUEST"
	BARE_RESPONSE_GROUP = "FLOW_ID_TO_BARE_RESPONSE"
)
View Source
const (
	INIT_DATABASE_RECORD_NAME = "[default]"
	FolderID                  = 0
	ChildFolderID             = 0
	TypeProject               = "project"
	TypeFile                  = "file"
	TEMPORARY_PROJECT_NAME    = "[temporary]"
	MIGRATE_DATABASE_KEY      = "__migrate_database__"
)
View Source
const (
	REPORT_ITEM_TYPE_MARKDOWN             = "markdown"
	REPORT_ITEM_TYPE_DIVIDER              = "divider"
	REPORT_ITEM_TYPE_TABLE                = "json-table"
	REPORT_ITEM_SEARCH_TYPE_TABLE         = "search-json-table"
	REPORT_ITEM_TYPE_PIE_GRAPH            = "pie-graph"
	REPORT_ITEM_TYPE_VERTICAL_BAR_GRAPH   = "vertical-bar-graph"
	REPORT_ITEM_TYPE_HORIZONTAL_BAR_GRAPH = "horizontal-bar-graph"
	REPORT_ITEM_TYPE_RAW                  = "raw"
	REPORT_ITEM_TYPE_CODE                 = "code"
	REPORT_ITEM_TYPE_WORDCLOUD            = "wordcloud"
)
View Source
const COLORPREFIX = "YAKIT_COLOR_"
View Source
const MaxSize = 2 << 20 // 2MB

Variables

View Source
var (
	WebFuzzerTaskTTLCache     = utils.NewTTLCache[*ypb.HistoryHTTPFuzzerTask](30 * time.Minute)
	WebFuzzerResponseTTLCache = utils.NewTTLCache[*ypb.FuzzerResponse](30 * time.Minute)
)
View Source
var GlobalPluginScanFilter = new(PluginScanFilter)
View Source
var ProfileTables = []interface{}{
	&YakScript{}, &Payload{}, &MenuItem{},
	&GeneralStorage{}, &MarkdownDoc{},
	&Project{},
	&NavigationBar{}, &NaslScript{},
	&WebFuzzerLabel{},
	&PluginGroup{},
}

ProfileTables 这些表是独立与项目之外的,每一个用户的数据都不一样

ProjectTables 这些表是和项目关联的,导出项目可以直接复制给用户

View Source
var ReportExports = map[string]interface{}{
	"New": NewReport,
}
View Source
var (
	RiskTypes = make([]string, 0)
)

Functions

func BatchExtractedData added in v1.2.2

func BatchExtractedData(db *gorm.DB, ctx context.Context) chan *ExtractedData

func BatchScreenRecorder added in v1.2.2

func BatchScreenRecorder(db *gorm.DB, ctx context.Context) chan *ScreenRecorder

func BatchWebsocketFlows added in v1.2.2

func BatchWebsocketFlows(db *gorm.DB, ctx context.Context) chan *WebsocketFlow

func BroadcastData added in v1.3.2

func BroadcastData(typeString string, data any)

func BuildHTTPFlowQuery added in v1.2.9

func BuildHTTPFlowQuery(db *gorm.DB, params *ypb.QueryHTTPFlowRequest) *gorm.DB

BuildHTTPFlowQuery 构建带有过滤条件的查询

func CallPostInitDatabase

func CallPostInitDatabase() error

func CheckDNSLogByToken

func CheckDNSLogByToken(token string, timeout ...float64) ([]*tpb.DNSLogEvent, error)

func CheckExistGroup added in v1.3.0

func CheckExistGroup(db *gorm.DB, group string) (bool, error)

func CheckICMPTriggerByLength

func CheckICMPTriggerByLength(i int) (*tpb.ICMPTriggerNotification, error)

func CheckRandomTriggerByToken

func CheckRandomTriggerByToken(t string) (*tpb.RandomPortTriggerEvent, error)

func ConfigureNetWork added in v1.3.2

func ConfigureNetWork(c *ypb.GlobalNetworkConfig)

func CopyPayloads added in v1.2.9

func CopyPayloads(db *gorm.DB, payloads []*Payload, group, folder string) error

func CountRiskByRuntimeId added in v1.3.1

func CountRiskByRuntimeId(db *gorm.DB, runtimeId string) (uint32, error)

func CountYakScriptByWhere added in v1.3.1

func CountYakScriptByWhere(db *gorm.DB, isGroup bool) (total int64, err error)

func CreateOrUpdateAliveHost added in v1.2.7

func CreateOrUpdateAliveHost(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateDomain

func CreateOrUpdateDomain(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateExecHistory

func CreateOrUpdateExecHistory(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateExecResult

func CreateOrUpdateExecResult(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateExtractedData

func CreateOrUpdateExtractedData(db *gorm.DB, mainId int64, i interface{}) error

func CreateOrUpdateHTTPFlow

func CreateOrUpdateHTTPFlow(db *gorm.DB, hash string, i *HTTPFlow) (fErr error)

func CreateOrUpdateHost

func CreateOrUpdateHost(db *gorm.DB, ip string, i interface{}) error

func CreateOrUpdateMarkdownDoc

func CreateOrUpdateMarkdownDoc(db *gorm.DB, sid int64, name string, i interface{}) error

func CreateOrUpdateMenuItem

func CreateOrUpdateMenuItem(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateNavigation added in v1.2.3

func CreateOrUpdateNavigation(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdatePayload

func CreateOrUpdatePayload(db *gorm.DB, content, group, folder string, hitCount int64, isFile bool) error

func CreateOrUpdatePluginGroup added in v1.3.1

func CreateOrUpdatePluginGroup(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdatePort

func CreateOrUpdatePort(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateProject

func CreateOrUpdateProject(db *gorm.DB, name string, folderID, childFolderID int64, Type string, i interface{}) error

func CreateOrUpdateReportRecord

func CreateOrUpdateReportRecord(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateRisk

func CreateOrUpdateRisk(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateScreenRecorder

func CreateOrUpdateScreenRecorder(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateWebFuzzerLabel added in v1.2.3

func CreateOrUpdateWebFuzzerLabel(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateWebsocketFlow

func CreateOrUpdateWebsocketFlow(db *gorm.DB, hash string, i interface{}) error

func CreateOrUpdateYakScript

func CreateOrUpdateYakScript(db *gorm.DB, id int64, i interface{}) error

func CreateOrUpdateYakScriptByName

func CreateOrUpdateYakScriptByName(db *gorm.DB, scriptName string, i interface{}) error

func CreateOrUpdateYakScriptByOnlineId

func CreateOrUpdateYakScriptByOnlineId(db *gorm.DB, onlineId int64, i interface{}) error

func CreateTemporaryYakScript added in v1.2.2

func CreateTemporaryYakScript(t string, code string, suffix ...string) (string, error)

func DelKey

func DelKey(db *gorm.DB, key interface{})

func DeleteDomainByID

func DeleteDomainByID(db *gorm.DB, ids ...int64) error

func DeleteExecHistoryAll

func DeleteExecHistoryAll(db *gorm.DB) error

func DeleteExecHistoryByID

func DeleteExecHistoryByID(db *gorm.DB, id int64) error

func DeleteExecResult

func DeleteExecResult(db *gorm.DB) error

func DeleteExecResultByID

func DeleteExecResultByID(db *gorm.DB, id int64) error

func DeleteExecResultByYakScriptName

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

func DeleteExtractedDataByID

func DeleteExtractedDataByID(db *gorm.DB, id int64) error

func DeleteHTTPFlow

func DeleteHTTPFlow(db *gorm.DB, req *ypb.DeleteHTTPFlowRequest) error

func DeleteHTTPFlowByID

func DeleteHTTPFlowByID(db *gorm.DB, id int64) error

func DeleteHostByID

func DeleteHostByID(db *gorm.DB, id int64) error

func DeleteMarkdownDocByID

func DeleteMarkdownDocByID(db *gorm.DB, id int64) error

func DeleteMenuItem

func DeleteMenuItem(db *gorm.DB, group string, name string, mode string) error

func DeleteMenuItemAll

func DeleteMenuItemAll(db *gorm.DB) error

func DeleteMenuItemByID

func DeleteMenuItemByID(db *gorm.DB, id int64) error

func DeleteNavigationByWhere added in v1.2.3

func DeleteNavigationByWhere(db *gorm.DB, req *ypb.GetAllNavigationRequest) error

func DeletePayloadByFolder added in v1.2.9

func DeletePayloadByFolder(db *gorm.DB, folder string) error

func DeletePayloadByGroup

func DeletePayloadByGroup(db *gorm.DB, group string) error

func DeletePayloadByID

func DeletePayloadByID(db *gorm.DB, id int64) error

func DeletePayloadByIDs added in v1.2.9

func DeletePayloadByIDs(db *gorm.DB, ids []int64) error

func DeletePluginGroup added in v1.3.1

func DeletePluginGroup(db *gorm.DB, group string) error

func DeletePluginGroupByHash added in v1.3.1

func DeletePluginGroupByHash(db *gorm.DB, hash string) error

func DeletePluginGroupByScriptName added in v1.3.1

func DeletePluginGroupByScriptName(db *gorm.DB, scriptName []string) error

func DeletePluginGroupsWithNonEmptyTemporaryId added in v1.3.2

func DeletePluginGroupsWithNonEmptyTemporaryId(db *gorm.DB) error

func DeletePortByID

func DeletePortByID(db *gorm.DB, id int64) error

func DeletePortsByID

func DeletePortsByID(db *gorm.DB, id int64) error

func DeleteProjectById

func DeleteProjectById(db *gorm.DB, id int64) error

func DeleteProjectByProjectName

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

func DeleteProjectByUid

func DeleteProjectByUid(db *gorm.DB, id string) error

func DeleteProjectKeyBareRequestAndResponse added in v1.2.9

func DeleteProjectKeyBareRequestAndResponse(db *gorm.DB) error

func DeleteReportRecordByHash

func DeleteReportRecordByHash(db *gorm.DB, id string) error

func DeleteReportRecordByID

func DeleteReportRecordByID(db *gorm.DB, id int64) error

func DeleteReportRecordByIDs

func DeleteReportRecordByIDs(db *gorm.DB, ids ...int64) error

func DeleteRiskByID

func DeleteRiskByID(db *gorm.DB, ids ...int64) error

func DeleteRiskByTarget added in v1.2.3

func DeleteRiskByTarget(db *gorm.DB, target string)

func DeleteScreenRecorder added in v1.2.2

func DeleteScreenRecorder(db *gorm.DB, id int64) error

func DeleteScreenRecorderByID

func DeleteScreenRecorderByID(db *gorm.DB, id int64) error

func DeleteWebFuzzerLabel added in v1.2.3

func DeleteWebFuzzerLabel(db *gorm.DB, hash string) error

func DeleteWebFuzzerResponseByTaskID

func DeleteWebFuzzerResponseByTaskID(db *gorm.DB, id int64) error

func DeleteWebFuzzerTask

func DeleteWebFuzzerTask(db *gorm.DB, id int64) error

func DeleteWebFuzzerTaskAll

func DeleteWebFuzzerTaskAll(db *gorm.DB) error

func DeleteWebFuzzerTaskByWebFuzzerIndex added in v1.2.7

func DeleteWebFuzzerTaskByWebFuzzerIndex(db *gorm.DB, index string) error

func DeleteWebShellByID added in v1.3.0

func DeleteWebShellByID(db *gorm.DB, ids ...int64) error

func DeleteWebsocketFlowAll

func DeleteWebsocketFlowAll(db *gorm.DB) error

func DeleteWebsocketFlowByID

func DeleteWebsocketFlowByID(db *gorm.DB, id int64) error

func DeleteWebsocketFlowByWebsocketHash

func DeleteWebsocketFlowByWebsocketHash(db *gorm.DB, hash string) error

func DeleteWebsocketFlowsByHTTPFlowHash

func DeleteWebsocketFlowsByHTTPFlowHash(db *gorm.DB, hash []string) error

func DeleteYakScript added in v1.3.1

func DeleteYakScript(db *gorm.DB, params *ypb.DeleteLocalPluginsByWhereRequest) *gorm.DB

func DeleteYakScriptAll

func DeleteYakScriptAll(db *gorm.DB) error

func DeleteYakScriptByID

func DeleteYakScriptByID(db *gorm.DB, id int64) error

func DeleteYakScriptByName

func DeleteYakScriptByName(db *gorm.DB, s string) error

func DeleteYakScriptByOnlineId

func DeleteYakScriptByOnlineId(db *gorm.DB, onlineId int64) error

func DeleteYakScriptByUserID

func DeleteYakScriptByUserID(db *gorm.DB, s int64, onlineBaseUrl string) error

func DeleteYakScriptByWhere

func DeleteYakScriptByWhere(db *gorm.DB) error

func ExportYakScript

func ExportYakScript(db *gorm.DB, fileName string) error

func ExtractTokenFromUrl

func ExtractTokenFromUrl(tokenUrl string) string

func FilterByQueryRisks

func FilterByQueryRisks(db *gorm.DB, params *ypb.QueryRisksRequest) (_ *gorm.DB, _ error)

func FilterDomain

func FilterDomain(db *gorm.DB, params *ypb.QueryDomainsRequest) *gorm.DB

func FilterHTTPFlow

func FilterHTTPFlow(db *gorm.DB, params *ypb.QueryHTTPFlowRequest) *gorm.DB

func FilterHTTPFlowByDomain added in v1.2.9

func FilterHTTPFlowByDomain(db *gorm.DB, domain string) *gorm.DB

func FilterHTTPFlowByRuntimeID added in v1.3.0

func FilterHTTPFlowByRuntimeID(db *gorm.DB, runtimeID string) *gorm.DB

func FilterHTTPFlowBySchema added in v1.2.9

func FilterHTTPFlowBySchema(db *gorm.DB, schema string) *gorm.DB

func FilterHTTPFlowPathPrefix added in v1.2.9

func FilterHTTPFlowPathPrefix(db *gorm.DB, pathPrefix string) *gorm.DB

func FilterNaslScript added in v1.2.2

func FilterNaslScript(db *gorm.DB, params *ypb.QueryYakScriptRequest) *gorm.DB

FilterNaslScript 过滤nasl脚本,支持关键词搜索,family过滤,排除和指定脚本名

func FilterPort

func FilterPort(db *gorm.DB, params *ypb.QueryPortsRequest) *gorm.DB

func FilterReportRecord

func FilterReportRecord(db *gorm.DB, params *ypb.QueryReportsRequest) *gorm.DB

func FilterYakScript

func FilterYakScript(db *gorm.DB, params *ypb.QueryYakScriptRequest) *gorm.DB

func FixRiskType

func FixRiskType(db *gorm.DB)

func FuzzParamsToGRPCFuzzableParam

func FuzzParamsToGRPCFuzzableParam(r *mutate.FuzzHTTPRequestParam, isHttps bool) *ypb.FuzzableParam

func Get

func Get(key interface{}) string

func GetDefaultNetworkConfig added in v1.3.2

func GetDefaultNetworkConfig() *ypb.GlobalNetworkConfig

func GetDefaultScriptFileNameByType

func GetDefaultScriptFileNameByType(t string) (string, error)

func GetKey

func GetKey(db *gorm.DB, key interface{}) string

func GetNetworkConfig added in v1.3.2

func GetNetworkConfig() *ypb.GlobalNetworkConfig

func GetPayloadCountInGroup added in v1.2.9

func GetPayloadCountInGroup(db *gorm.DB, group string) int64

func GetPayloadGroupFileName added in v1.2.9

func GetPayloadGroupFileName(db *gorm.DB, group string) (string, error)

func GetProjectKey added in v1.2.2

func GetProjectKey(db *gorm.DB, key interface{}) string

func GetProjectKeyWithError added in v1.2.6

func GetProjectKeyWithError(db *gorm.DB, key interface{}) (string, error)

func GetWebFuzzerRetryRootID added in v1.2.8

func GetWebFuzzerRetryRootID(db *gorm.DB, id uint) (uint, error)

func GetWebFuzzerTasksIDByRetryRootID added in v1.2.8

func GetWebFuzzerTasksIDByRetryRootID(db *gorm.DB, root_id uint) ([]uint, error)

func GetWebShell added in v1.3.0

func GetWebShell(db *gorm.DB, id int64) (*ypb.WebShell, error)

func HaveReverseRisk

func HaveReverseRisk(token string) bool

func IgnoreYakScriptByID

func IgnoreYakScriptByID(db *gorm.DB, id int64, ignored bool) error

func ImportResource

func ImportResource(db *gorm.DB, fileName string) error

func InitKey

func InitKey(db *gorm.DB, key interface{}, verbose interface{}, env bool) error

func InitialDatabase added in v1.2.3

func InitialDatabase()

func InitializeDefaultDatabaseSchema added in v1.2.4

func InitializeDefaultDatabaseSchema()

func InitializingProjectDatabase

func InitializingProjectDatabase() error

func InsertHTTPFlow added in v1.2.3

func InsertHTTPFlow(db *gorm.DB, i *HTTPFlow) (fErr error)

func LoadGlobalNetworkConfig added in v1.3.2

func LoadGlobalNetworkConfig()

LoadGlobalNetworkConfig load config from yakit config in db

func LoadPackage

func LoadPackage(typeStr string, basePath string) (*YakScript, *MarkdownDoc, error)

func LoadYakitFromLocalDir

func LoadYakitFromLocalDir(f string) error

func LoadYakitResources

func LoadYakitResources(dirName string) ([]*YakScript, []*MarkdownDoc, error)

func LoadYakitThirdpartySourceScripts

func LoadYakitThirdpartySourceScripts(
	ctx context.Context, ghUrl string,
	proxy ...string,
) error

func MigrateLegacyDatabase

func MigrateLegacyDatabase() error

func MovePayloads added in v1.2.9

func MovePayloads(db *gorm.DB, payloads []*Payload, group, folder string) error

func NewDNSLogDomain

func NewDNSLogDomain() (domain string, token string, _ error)

func NewDNSLogDomainWithContext

func NewDNSLogDomainWithContext(ctx context.Context) (domain string, token string, _ error)

func NewLocalReverseProtoUrl

func NewLocalReverseProtoUrl(proto string) func(opts ...RiskParamsOpt) string

func NewPublicReverseProtoUrl

func NewPublicReverseProtoUrl(proto string) func(opts ...RiskParamsOpt) string

func NewRandomPortTrigger

func NewRandomPortTrigger(opt ...RiskParamsOpt) (token string, addr string, _ error)

func NewRiskReadRequest

func NewRiskReadRequest(db *gorm.DB, req *ypb.NewRiskReadRequest, Ids []int64) error

func PayloadGroups

func PayloadGroups(db *gorm.DB, search ...string) []string

func QueryExportYakScript added in v1.3.0

func QueryExportYakScript(db *gorm.DB, params *ypb.ExportLocalYakScriptRequest) *gorm.DB

func QueryFirst50WebFuzzerTask

func QueryFirst50WebFuzzerTask(db *gorm.DB) []*ypb.HistoryHTTPFuzzerTask

Deprecated

func QueryPayloadWithCallBack added in v1.3.0

func QueryPayloadWithCallBack(db *gorm.DB, p *Payload, notExistCallback, existCallback func(*gorm.DB, *Payload) error) error

func QueryProjectTotal

func QueryProjectTotal(db *gorm.DB, req *ypb.GetProjectsRequest) (*bizhelper.Paginator, error)

func QueryWebFuzzerLabelCount added in v1.2.3

func QueryWebFuzzerLabelCount(db *gorm.DB) int64

func QueryWebsocketFlowsByHTTPFlowHash

func QueryWebsocketFlowsByHTTPFlowHash(db *gorm.DB, req *ypb.DeleteHTTPFlowRequest) *gorm.DB

func QuickSearchHTTPFlowCount added in v1.2.3

func QuickSearchHTTPFlowCount(token string) int

func QuickSearchMITMHTTPFlowCount added in v1.2.3

func QuickSearchMITMHTTPFlowCount(token string) int

func ReadPayloadFileLineWithCallBack added in v1.3.0

func ReadPayloadFileLineWithCallBack(fileName string, handler func(string, int64) error) error

func ReadQuotedLinesWithCallBack added in v1.3.0

func ReadQuotedLinesWithCallBack(data string, handler func(string) error) error

func RefreshProcessEnv

func RefreshProcessEnv(db *gorm.DB)

RefreshProcessEnv 在数据库初始化的时候执行这个,可以快速更新本进程的环境变量

func RegisterBeforeRiskSave added in v1.2.6

func RegisterBeforeRiskSave(f func(*Risk))

func RegisterPostInitDatabaseFunction

func RegisterPostInitDatabaseFunction(f func() error)

func RegisterServerPushCallback added in v1.3.2

func RegisterServerPushCallback(id string, stream ypb.Yak_DuplexConnectionServer)

func RemoveTemporaryYakScriptAll added in v1.3.2

func RemoveTemporaryYakScriptAll(db *gorm.DB, suffix string)

func RenamePayloadFolder added in v1.2.9

func RenamePayloadFolder(db *gorm.DB, folder, newFolder string) error

func RenamePayloadGroup added in v1.2.9

func RenamePayloadGroup(db *gorm.DB, oldGroup, newGroup string) error

func RiskTypeToVerbose

func RiskTypeToVerbose(i string) string

func SaveDomain

func SaveDomain(db *gorm.DB, domain string, ip string) error

func SaveExecResult

func SaveExecResult(db *gorm.DB, yakScriptName string, r *ypb.ExecResult) error

func SaveFromServerWebsocketFlow

func SaveFromServerWebsocketFlow(db *gorm.DB, owner string, index int, data []byte) error

func SaveHybridScanTask added in v1.2.9

func SaveHybridScanTask(db *gorm.DB, task *HybridScanTask) error

func SavePayloadByFilename

func SavePayloadByFilename(db *gorm.DB, group string, fileName string) error

save payload from file

func SavePayloadGroup

func SavePayloadGroup(db *gorm.DB, group string, lists []string) error

save payload from data

func SavePayloadGroupByRaw added in v1.2.9

func SavePayloadGroupByRaw(db *gorm.DB, group string, data string) error

save payload from raw-data

func SaveRisk

func SaveRisk(r *Risk) error

func SaveToServerWebsocketFlow

func SaveToServerWebsocketFlow(db *gorm.DB, owner string, index int, data []byte) error

func SaveTrafficPacket added in v1.2.8

func SaveTrafficPacket(db *gorm.DB, packet *TrafficPacket) error

func SaveTrafficSession added in v1.2.8

func SaveTrafficSession(db *gorm.DB, session *TrafficSession) error

func SaveWebFuzzerResponse

func SaveWebFuzzerResponse(db *gorm.DB, taskId int, rsp *ypb.FuzzerResponse)

func SearchWebsocketFlow added in v1.3.1

func SearchWebsocketFlow(keyword string) int

func Set

func Set(key interface{}, value interface{})

func SetCurrentProject

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

func SetCurrentProjectById

func SetCurrentProjectById(db *gorm.DB, id int64) error

func SetGlobalPluginScanLists added in v1.3.2

func SetGlobalPluginScanLists(whitelist, blacklist []string)

func SetGroupInEnd added in v1.2.9

func SetGroupInEnd(db *gorm.DB, group string) error

func SetIndexToFolder added in v1.2.9

func SetIndexToFolder(db *gorm.DB, folder, group string, group_index int64) error

func SetKey

func SetKey(db *gorm.DB, key interface{}, value interface{}) error

func SetKeyProcessEnv

func SetKeyProcessEnv(db *gorm.DB, key interface{}, processEnv bool)

func SetKeyWithTTL

func SetKeyWithTTL(db *gorm.DB, key interface{}, value interface{}, seconds int) error

func SetProjectKey added in v1.2.2

func SetProjectKey(db *gorm.DB, key interface{}, value interface{}) error

func SetProjectKeyWithGroup added in v1.2.6

func SetProjectKeyWithGroup(db *gorm.DB, key interface{}, value interface{}, group string) error

func SetProjectKeyWithTTL added in v1.2.2

func SetProjectKeyWithTTL(db *gorm.DB, key interface{}, value interface{}, seconds int) error

func SolutionAndDescriptionByCWE added in v1.2.6

func SolutionAndDescriptionByCWE(FromYakScript, RiskTypeVerbose, TitleVerbose string) (description, solution string)

func TidyGeneralStorage

func TidyGeneralStorage(db *gorm.DB)

func TrimWhitespaceExceptSpace added in v1.2.9

func TrimWhitespaceExceptSpace(r rune) bool

trim payload content

func UnRegisterServerPushCallback added in v1.3.2

func UnRegisterServerPushCallback(id string)

func UpdateGeneralModuleFromByYakScriptName

func UpdateGeneralModuleFromByYakScriptName(db *gorm.DB, scriptName string, i bool) error

func UpdateHTTPFlowTags added in v1.2.3

func UpdateHTTPFlowTags(db *gorm.DB, i *HTTPFlow) error

func UpdatePayload

func UpdatePayload(db *gorm.DB, id int, payload *Payload) error

func UpdatePayloadColumns added in v1.3.0

func UpdatePayloadColumns(db *gorm.DB, id int, m map[string]any) error

func UpdatePayloadGroup added in v1.2.9

func UpdatePayloadGroup(db *gorm.DB, group, folder string, group_index int64) error

func UpdateProject

func UpdateProject(db *gorm.DB, id int64, i Project) error

func UpdateProjectDatabasePath added in v1.3.1

func UpdateProjectDatabasePath(db *gorm.DB, id int64, databasePath string) error

func UpdateYakitStore

func UpdateYakitStore(db *gorm.DB, baseUrl string) error

func UploadRiskToOnline

func UploadRiskToOnline(db *gorm.DB, hash []string) error

func UserDataAndPluginDatabaseScope

func UserDataAndPluginDatabaseScope(db *gorm.DB) *gorm.DB

func YakScriptLocalTotal added in v1.3.0

func YakScriptLocalTotal(dir []string) int

func YakScriptLocalType added in v1.3.0

func YakScriptLocalType(dirName string) string

func YieldAliveHostRuntimeId added in v1.2.7

func YieldAliveHostRuntimeId(db *gorm.DB, ctx context.Context, runtimeId string) chan *AliveHost

func YieldDomains

func YieldDomains(db *gorm.DB, ctx context.Context) chan *Domain

func YieldGeneralStorages

func YieldGeneralStorages(db *gorm.DB, ctx context.Context) chan *GeneralStorage

func YieldHTTPFlows

func YieldHTTPFlows(db *gorm.DB, ctx context.Context) chan *HTTPFlow

func YieldHTTPUrl

func YieldHTTPUrl(db *gorm.DB, ctx context.Context) chan *HTTPFlowUrl

func YieldHosts

func YieldHosts(db *gorm.DB, ctx context.Context) chan *Host

func YieldPayloads

func YieldPayloads(db *gorm.DB, ctx context.Context) chan *Payload

func YieldPorts

func YieldPorts(db *gorm.DB, ctx context.Context) chan *Port

func YieldProject

func YieldProject(db *gorm.DB, ctx context.Context) chan *Project

func YieldRisks

func YieldRisks(db *gorm.DB, ctx context.Context) chan *Risk

func YieldRisksByCreateAt

func YieldRisksByCreateAt(db *gorm.DB, ctx context.Context, timestamp int64) chan *Risk

func YieldRisksByRuntimeId

func YieldRisksByRuntimeId(db *gorm.DB, ctx context.Context, runtimeId string) chan *Risk

func YieldRisksByTarget

func YieldRisksByTarget(db *gorm.DB, ctx context.Context, target string) chan *Risk

func YieldSimplePorts

func YieldSimplePorts(db *gorm.DB, ctx context.Context) chan *SimplePort

func YieldWebFuzzerResponseByTaskIDs added in v1.2.8

func YieldWebFuzzerResponseByTaskIDs(db *gorm.DB, ctx context.Context, taskIDs []uint, oks ...bool) chan *WebFuzzerResponse

func YieldWebFuzzerResponses

func YieldWebFuzzerResponses(db *gorm.DB, ctx context.Context, id int) chan *WebFuzzerResponse

func YieldYakScripts

func YieldYakScripts(db *gorm.DB, ctx context.Context) chan *YakScript

YieldYakScripts no use spec, checking

calling

Types

type AliveHost added in v1.2.7

type AliveHost struct {
	gorm.Model

	Hash string `json:"hash"`

	IP        string `json:"ip"`
	IPInteger int64  `json:"ip_integer"`

	// 设置运行时 ID 为了关联具体漏洞
	RuntimeId string `json:"runtime_id"`
}

func NewAliveHost added in v1.2.7

func NewAliveHost(u string, opts ...AliveHostParamsOpt) (*AliveHost, error)

type AliveHostParamsOpt added in v1.2.7

type AliveHostParamsOpt func(r *AliveHost)

type BackProject

type BackProject struct {
	Project
	FolderName      string
	ChildFolderName string
}

func GetProjectDetail

func GetProjectDetail(db *gorm.DB, id int64) (*BackProject, error)

func (*BackProject) BackGRPCModel

func (p *BackProject) BackGRPCModel() *ypb.ProjectDescription

type Briefing

type Briefing struct {
	gorm.Model

	SourceXmlUrl    string
	RssFeedHash     string
	Hash            string     `gorm:"columns:hash;unique_index"`
	Title           string     `json:"title,omitempty"`
	Description     string     `json:"description,omitempty"`
	Content         string     `json:"content,omitempty"`
	Link            string     `json:"link,omitempty"`
	Updated         string     `json:"updated,omitempty"`
	UpdatedParsed   *time.Time `json:"updatedParsed,omitempty"`
	Published       string     `json:"published,omitempty"`
	PublishedParsed *time.Time `json:"publishedParsed,omitempty"`
	Author          string     `json:"author,omitempty"`
	AuthorEmail     string     `json:"author_email,omitempty"`
	GUID            string     `json:"guid,omitempty"`
	ImageUrl        string     `json:"image_url,omitempty"`
	ImageName       string     `json:"image_name,omitempty"`
	Categories      string     `json:"categories,omitempty"`
	Tags            string     `json:"tags"`
	IsRead          bool       `json:"is_read"`
}

func (*Briefing) BeforeSave

func (b *Briefing) BeforeSave() error

func (*Briefing) CalcHash

func (b *Briefing) CalcHash() string

type CreateHTTPFlowConfig added in v1.3.2

type CreateHTTPFlowConfig struct {
	// contains filtered or unexported fields
}

type CreateHTTPFlowOptions added in v1.3.2

type CreateHTTPFlowOptions func(c *CreateHTTPFlowConfig)

func CreateHTTPFlowWithFixResponseRaw added in v1.3.2

func CreateHTTPFlowWithFixResponseRaw(fixRspRaw []byte) CreateHTTPFlowOptions

如果传入了fixRspRaw,则不会再修复

func CreateHTTPFlowWithHTTPS added in v1.3.2

func CreateHTTPFlowWithHTTPS(isHttps bool) CreateHTTPFlowOptions

func CreateHTTPFlowWithRemoteAddr added in v1.3.2

func CreateHTTPFlowWithRemoteAddr(remoteAddr string) CreateHTTPFlowOptions

func CreateHTTPFlowWithRequestIns added in v1.3.2

func CreateHTTPFlowWithRequestIns(reqIns *http.Request) CreateHTTPFlowOptions

如果传入了RequestIns,则优先使用这个作为NewFuzzRequest的参数

func CreateHTTPFlowWithRequestRaw added in v1.3.2

func CreateHTTPFlowWithRequestRaw(reqRaw []byte) CreateHTTPFlowOptions

func CreateHTTPFlowWithResponseRaw added in v1.3.2

func CreateHTTPFlowWithResponseRaw(rspRaw []byte) CreateHTTPFlowOptions

func CreateHTTPFlowWithSource added in v1.3.2

func CreateHTTPFlowWithSource(source string) CreateHTTPFlowOptions

func CreateHTTPFlowWithURL added in v1.3.2

func CreateHTTPFlowWithURL(url string) CreateHTTPFlowOptions

type Domain

type Domain struct {
	gorm.Model

	Domain    string `json:"domain" gorm:"index"`
	IPAddr    string `json:"ip_addr"`
	IPInteger int64  `json:"ip_integer"`

	HTTPTitle string

	Hash string `json:"hash" gorm:"unique_index"`

	Tags string `json:"tags"`
}

func GetDomain

func GetDomain(db *gorm.DB, id int64) (*Domain, error)

func QueryDomain

func QueryDomain(db *gorm.DB, params *ypb.QueryDomainsRequest) (*bizhelper.Paginator, []*Domain, error)

func (*Domain) BeforeSave

func (d *Domain) BeforeSave() error

func (*Domain) CalcHash

func (d *Domain) CalcHash() string

func (*Domain) FillDomainHTTPInfo

func (d *Domain) FillDomainHTTPInfo()

type EnterpriseDetails

type EnterpriseDetails struct {
	gorm.Model

	// 社会信用识别码
	SocialCreditCode string `json:"social_credit_code" gorm:"unique_index"`
	TaxCode          string `json:"tax_code"` // 纳税人识别码
	OrgCode          string `json:"org_code"` // 企业机构代码
	BizCode          string `json:"biz_code"` // 工商注册码

	ControllerSocialCreditCode string `json:"controller_social_credit_code"`
	ControllerHoldingPercent   string `json:"controller_holding_percent"`

	//
	SearchKeyword string `json:"keyword"`
	DomainKeyword string `json:"domain_keyword"`

	ExtraJSON string `json:"extra_json"`
}

type ExecHistory

type ExecHistory struct {
	gorm.Model

	Hash string `gorm:"unique_index"`

	RuntimeId     string `json:"runtime_id" gorm:"unique_index"`
	Script        string `json:"script"`
	ScriptId      string `json:"script_id" gorm:"index"`
	TimestampNano int64  `json:"timestamp"`
	FromYakModule string `json:"from_yak_module" gorm:"index"`
	DurationMs    int64  `json:"duration_ms"`
	Params        string `json:"params"`
	Stdout        string `json:"stdout"`
	Stderr        string `json:"stderr"`
	Ok            bool   `json:"ok"`
	Reason        string `json:"reason"`

	StdoutLen int64 `json:"stdout_len" gorm:"-"`
	StderrLen int64 `json:"stderr_len" gorm:"-"`

	// json
	Messages string `json:"messages"`
}

func GetExecHistory

func GetExecHistory(db *gorm.DB, id int64) (*ExecHistory, error)

func QueryExecHistory

func QueryExecHistory(db *gorm.DB, params *ypb.ExecHistoryRequest) (*bizhelper.Paginator, []*ExecHistory, error)

func (*ExecHistory) BeforeSave

func (f *ExecHistory) BeforeSave() error

func (*ExecHistory) CalcHash

func (f *ExecHistory) CalcHash() string

func (*ExecHistory) ToGRPCModel

func (f *ExecHistory) ToGRPCModel() *ypb.ExecHistoryRecord

type ExecResult

type ExecResult struct {
	gorm.Model

	YakScriptName string `json:"yak_script_name" gorm:"index"`
	Raw           string `json:"raw"`
}

func GetExecResult

func GetExecResult(db *gorm.DB, id int64) (*ExecResult, error)

func (*ExecResult) ToGRPCModel

func (e *ExecResult) ToGRPCModel() *ypb.ExecResult

type ExtractedData

type ExtractedData struct {
	gorm.Model

	// sourcetype 一般来说是标注数据来源
	SourceType string `gorm:"index"`

	// trace id 表示数据源的 ID
	TraceId string `gorm:"index"`

	// 提取数据的正则数据
	Regexp string

	// 规则 Verbose
	RuleVerbose string

	// UTF8 safe escape
	Data string
}

func ExtractedDataFromHTTPFlow added in v1.2.7

func ExtractedDataFromHTTPFlow(flowHash string, ruleName string, data string, regexpStr ...string) *ExtractedData

func GetExtractedData

func GetExtractedData(db *gorm.DB, id int64) (*ExtractedData, error)

type GeneralStorage

type GeneralStorage struct {
	gorm.Model

	Key string `json:"key" gorm:"unique_index"`

	// 经过 JSON + Strconv
	Value string `json:"value"`

	// 过期时间
	ExpiredAt time.Time

	// YAKIT SUBPROC_ENV
	ProcessEnv bool

	// 帮助信息,描述这个变量是干嘛的
	Verbose string

	// 描述变量所在的组是啥
	Group string
}

func GetKeyModel

func GetKeyModel(db *gorm.DB, key interface{}) (*GeneralStorage, error)

func GetProcessEnvKey

func GetProcessEnvKey(db *gorm.DB) []*GeneralStorage

func (*GeneralStorage) EnableProcessEnv

func (s *GeneralStorage) EnableProcessEnv()

func (*GeneralStorage) ToGRPCModel

func (s *GeneralStorage) ToGRPCModel() *ypb.GeneralStorage

type HTTPFlow

type HTTPFlow struct {
	gorm.Model

	HiddenIndex        string
	NoFixContentLength bool   `json:"no_fix_content_length"`
	Hash               string `gorm:"unique_index"`
	IsHTTPS            bool
	Url                string `gorm:"index"`
	Path               string
	Method             string
	BodyLength         int64
	ContentType        string
	StatusCode         int64
	SourceType         string
	Request            string
	Response           string
	GetParamsTotal     int
	PostParamsTotal    int
	CookieParamsTotal  int
	IPAddress          string
	RemoteAddr         string
	IPInteger          int
	Tags               string // 用来打标!

	// Websocket 相关字段
	IsWebsocket bool
	// 用来计算 websocket hash, 每次连接都不一样,一般来说,内部对象 req 指针足够了
	WebsocketHash string

	RuntimeId  string
	FromPlugin string

	// friendly for gorm build instance, not for store
	// 这两个字段不参与数据库存储,但是在序列化的时候,会被覆盖
	// 主要用来标记用户的 Request 和 Response 是否超大
	IsRequestOversize  bool `gorm:"-"`
	IsResponseOversize bool `gorm:"-"`

	IsTooLargeResponse         bool
	TooLargeResponseHeaderFile string
	TooLargeResponseBodyFile   string
}

func CreateHTTPFlow added in v1.3.2

func CreateHTTPFlow(opts ...CreateHTTPFlowOptions) (*HTTPFlow, error)

func CreateHTTPFlowFromHTTPWithBodySaved

func CreateHTTPFlowFromHTTPWithBodySaved(isHttps bool, req *http.Request, rsp *http.Response, source string, url string, remoteAddr string, opts ...CreateHTTPFlowOptions) (*HTTPFlow, error)

func CreateHTTPFlowFromHTTPWithBodySavedFromRaw

func CreateHTTPFlowFromHTTPWithBodySavedFromRaw(isHttps bool, reqRaw []byte, rspRaw []byte, source string, url string, remoteAddr string, opts ...CreateHTTPFlowOptions) (*HTTPFlow, error)

func CreateHTTPFlowFromHTTPWithNoRspSaved added in v1.2.4

func CreateHTTPFlowFromHTTPWithNoRspSaved(isHttps bool, req *http.Request, source string, url string, remoteAddr string, opts ...CreateHTTPFlowOptions) (*HTTPFlow, error)

func ExportHTTPFlow added in v1.3.0

func ExportHTTPFlow(db *gorm.DB, params *ypb.ExportHTTPFlowsRequest) (paging *bizhelper.Paginator, ret []*HTTPFlow, err error)

func FuzzerResponseToHTTPFlow

func FuzzerResponseToHTTPFlow(db *gorm.DB, rsp *ypb.FuzzerResponse) (*HTTPFlow, error)

func GetHTTPFlow

func GetHTTPFlow(db *gorm.DB, id int64) (*HTTPFlow, error)

func GetHTTPFlowByHash

func GetHTTPFlowByHash(db *gorm.DB, hash string) (*HTTPFlow, error)

func GetHTTPFlowByIDOrHash added in v1.3.1

func GetHTTPFlowByIDOrHash(db *gorm.DB, id int64, hash string) (*HTTPFlow, error)

func QueryHTTPFlow

func QueryHTTPFlow(db *gorm.DB, params *ypb.QueryHTTPFlowRequest) (paging *bizhelper.Paginator, ret []*HTTPFlow, err error)

func SaveFromHTTP

func SaveFromHTTP(db *gorm.DB, isHttps bool, req *http.Request, rsp *http.Response, source string, url string, remoteAddr string) (*HTTPFlow, error)

func SaveFromHTTPFromRaw

func SaveFromHTTPFromRaw(db *gorm.DB, isHttps bool, req []byte, rsp []byte, source string, url string, remoteAddr string) (*HTTPFlow, error)

func SaveFromHTTPWithBodySaved

func SaveFromHTTPWithBodySaved(db *gorm.DB, isHttps bool, req *http.Request, rsp *http.Response, source string, url string, remoteAddr string) (*HTTPFlow, error)

func (*HTTPFlow) AddTag

func (f *HTTPFlow) AddTag(appendTags ...string)

颜色与 Tag API

func (*HTTPFlow) AddTagToFirst

func (f *HTTPFlow) AddTagToFirst(appendTags ...string)

func (*HTTPFlow) AfterCreate added in v1.3.2

func (f *HTTPFlow) AfterCreate(tx *gorm.DB) (err error)

func (*HTTPFlow) AfterDelete added in v1.3.2

func (f *HTTPFlow) AfterDelete(tx *gorm.DB) (err error)

func (*HTTPFlow) AfterSave added in v1.3.2

func (f *HTTPFlow) AfterSave(tx *gorm.DB) (err error)

func (*HTTPFlow) AfterUpdate added in v1.3.2

func (f *HTTPFlow) AfterUpdate(tx *gorm.DB) (err error)

func (*HTTPFlow) BeforeSave

func (f *HTTPFlow) BeforeSave() error

func (*HTTPFlow) Blue

func (f *HTTPFlow) Blue()

func (*HTTPFlow) CalcCacheHash added in v1.2.7

func (f *HTTPFlow) CalcCacheHash(full bool) string

func (*HTTPFlow) CalcHash

func (f *HTTPFlow) CalcHash() string

func (*HTTPFlow) ColorSharp

func (f *HTTPFlow) ColorSharp(rgbHex string)

func (*HTTPFlow) Cyan

func (f *HTTPFlow) Cyan()

func (*HTTPFlow) FixHTTPRequest added in v1.3.2

func (f *HTTPFlow) FixHTTPRequest(req *http.Request)

func (*HTTPFlow) Green

func (f *HTTPFlow) Green()

func (*HTTPFlow) Grey

func (f *HTTPFlow) Grey()

func (*HTTPFlow) Orange

func (f *HTTPFlow) Orange()

func (*HTTPFlow) Purple

func (f *HTTPFlow) Purple()

func (*HTTPFlow) Red

func (f *HTTPFlow) Red()

func (*HTTPFlow) RemoveColor

func (f *HTTPFlow) RemoveColor()

func (*HTTPFlow) SetCacheGRPCModel added in v1.3.2

func (f *HTTPFlow) SetCacheGRPCModel(full bool, m *ypb.HTTPFlow)

func (*HTTPFlow) ToGRPCModel

func (f *HTTPFlow) ToGRPCModel(full bool) (*ypb.HTTPFlow, error)

func (*HTTPFlow) ToGRPCModelFull

func (f *HTTPFlow) ToGRPCModelFull() (*ypb.HTTPFlow, error)

func (*HTTPFlow) Yellow

func (f *HTTPFlow) Yellow()

type HTTPFlowUrl

type HTTPFlowUrl struct {
	Url string `json:"url"`
}

type Host

type Host struct {
	gorm.Model

	IP        string `json:"ip" gorm:"unique_index"`
	IPInteger int64  `json:"ip_integer"`

	IsInPublicNet bool

	// splite by comma
	Domains string
}

func GetHost

func GetHost(db *gorm.DB, id int64) (*Host, error)

func GetHostByIP

func GetHostByIP(db *gorm.DB, ip string) (*Host, error)

func NewHost

func NewHost(ip string) (*Host, error)

func QueryHost

func QueryHost(db *gorm.DB, params *ypb.QueryHostsRequest) (*bizhelper.Paginator, []*Host, error)

type HybridScanTask added in v1.2.9

type HybridScanTask struct {
	gorm.Model

	TaskId string `gorm:"unique_index"`
	// executing
	// paused
	// done
	Status              string
	Reason              string // user cancel / finished / recover failed so on
	SurvivalTaskIndexes string // 暂停的时候正在执行的任务

	// struct{ https bool; request bytes }[]
	Targets string
	// string[]
	Plugins         string
	TotalTargets    int64
	TotalPlugins    int64
	TotalTasks      int64
	FinishedTasks   int64
	FinishedTargets int64

	ScanConfig []byte
}

func GetHybridScanByTaskId added in v1.2.9

func GetHybridScanByTaskId(db *gorm.DB, taskId string) (*HybridScanTask, error)

func QueryHybridScan added in v1.2.9

func QueryHybridScan(db *gorm.DB, query *ypb.QueryHybridScanTaskRequest) (*bizhelper.Paginator, []*HybridScanTask, error)

type MarkdownDoc

type MarkdownDoc struct {
	gorm.Model

	YakScriptId   int64  `json:"yak_script_id" gorm:"index"`
	YakScriptName string `json:"yak_script_name" gorm:"index"`
	Markdown      string `json:"markdown"`
}

func GetMarkdownDoc

func GetMarkdownDoc(db *gorm.DB, id int64) (*MarkdownDoc, error)

func GetMarkdownDocByName

func GetMarkdownDocByName(db *gorm.DB, sid int64, name string) (*MarkdownDoc, error)
type MenuItem struct {
	gorm.Model

	Group         string `json:"group" `
	Verbose       string `json:"verbose"`
	YakScriptName string `json:"yak_script_name"`
	Hash          string `json:"-" gorm:"unique_index"`

	// quoted json
	BatchPluginFilterJson string `json:"batch_plugin_filter_json"`
	Mode                  string `json:"mode"`
	MenuSort              int64  `json:"menu_sort"`
	GroupSort             int64  `json:"group_sort"`
}

func GetAllMenuItem

func GetAllMenuItem(db *gorm.DB) []*MenuItem

func GetMenuItem

func GetMenuItem(db *gorm.DB, group string, name string) (*MenuItem, error)

func GetMenuItemById

func GetMenuItemById(db *gorm.DB, id int64) (*MenuItem, error)

func NewMenuItemByBatchExecuteConfig

func NewMenuItemByBatchExecuteConfig(raw interface{}) (*MenuItem, error)

func QueryAllMenuItemByWhere

func QueryAllMenuItemByWhere(db *gorm.DB, req *ypb.QueryAllMenuItemRequest) []*MenuItem
func (m *MenuItem) BeforeSave() error
func (m *MenuItem) CalcHash() string

type ModuleType

type ModuleType struct {
	Name      string `json:"name"`
	VerboseCN string `json:"verbose_cn"`
	VerboseEn string `json:"verbose_en"`
	External  bool   `json:"external"`
	Dir       string `json:"dir"`
}

type NaslScript

type NaslScript struct {
	gorm.Model
	OriginFileName  string `json:"origin_file_name"`
	Hash            string `json:"hash" gorm:"unique_index"`
	OID             string `json:"oid"`
	CVE             string `json:"cve"`
	ScriptName      string `json:"script_name"`
	Script          string `json:"script"`
	Tags            string `json:"tags,omitempty"`
	Version         string `json:"version"`
	Category        string `json:"category"`
	Family          string `json:"family"`
	Copyright       string `json:"copyright"`
	Dependencies    string `json:"dependencies,omitempty"`
	RequirePorts    string `json:"require_ports,omitempty"`
	RequireUdpPorts string `json:"require_udp_ports,omitempty"`
	ExcludeKeys     string `json:"exclude_keys,omitempty"`
	Xref            string `json:"xref,omitempty"`
	Preferences     string `json:"preferences,omitempty"`
	BugtraqId       string `json:"bugtraqId,omitempty"`
	MandatoryKeys   string `json:"mandatory_keys,omitempty"`
	Timeout         int    `json:"timeout,omitempty"`
	RequireKeys     string `json:"require_keys,omitempty"`
}

func FilterRootScriptsWithDbModelType added in v1.2.2

func FilterRootScriptsWithDbModelType(scripts []*NaslScript) []*NaslScript

func NewEmptyNaslScript

func NewEmptyNaslScript() *NaslScript

func NewNaslScript

func NewNaslScript(name, content string) *NaslScript

func QueryNaslScriptByName added in v1.2.2

func QueryNaslScriptByName(db *gorm.DB, name string) (*NaslScript, error)

func QueryNaslScriptByOID added in v1.2.2

func QueryNaslScriptByOID(db *gorm.DB, oid string) (*NaslScript, error)

func QueryNaslScriptByYakScriptRequest added in v1.2.2

func QueryNaslScriptByYakScriptRequest(db *gorm.DB, params *ypb.QueryYakScriptRequest) (*bizhelper.Paginator, []*NaslScript, error)

func QueryRootNaslScriptByYakScriptRequest added in v1.2.2

func QueryRootNaslScriptByYakScriptRequest(db *gorm.DB, params *ypb.QueryYakScriptRequest) (*bizhelper.Paginator, []*NaslScript, error)

func (*NaslScript) CalcHash

func (p *NaslScript) CalcHash() string

func (*NaslScript) CreateOrUpdateNaslScript

func (p *NaslScript) CreateOrUpdateNaslScript(db *gorm.DB) error

func (*NaslScript) ToYakScript added in v1.2.2

func (p *NaslScript) ToYakScript() *YakScript
type NavigationBar struct {
	gorm.Model
	Group         string `json:"group" `
	YakScriptName string `json:"yak_script_name"`
	Hash          string `json:"-" gorm:"unique_index"`
	Mode          string `json:"mode"`
	VerboseSort   int64  `json:"verbose_sort"`
	GroupSort     int64  `json:"group_sort"`
	Route         string `json:"route"`
	Verbose       string `json:"verbose"`
	GroupLabel    string `json:"group_label"`
	VerboseLabel  string `json:"verbose_label"`
}

func GetAllNavigation added in v1.2.3

func GetAllNavigation(db *gorm.DB, req *ypb.GetAllNavigationRequest) []*NavigationBar
func (m *NavigationBar) CalcHash() string

type Paging added in v1.2.9

type Paging struct {
	OrderBy string
	Order   string
	Page    int
	Limit   int
}

func NewPaging added in v1.2.9

func NewPaging() *Paging

type Payload

type Payload struct {
	gorm.Model

	// Must: payload group
	Group string `json:"group" gorm:"index"`

	// payload folder
	Folder     *string `json:"folder" gorm:"column:folder;default:''"`          // default empty string
	GroupIndex *int64  `json:"group_index" gorm:"column:group_index;default:0"` // default 0

	// strconv Quoted
	// Must: payload data
	Content *string `json:"content"`

	// hit count
	HitCount *int64 `json:"hit_count" gorm:"column:hit_count;default:0"` // default 0

	// the group save in file only contain one payload, and this `payload.IsFile = true` `payload.Content` is filepath
	IsFile *bool `json:"is_file" gorm:"column:is_file;default:false"` // default false

	// Hash string
	Hash string `json:"hash" gorm:"unique_index"`
}

func GetPayloadById added in v1.2.9

func GetPayloadById(db *gorm.DB, id int64) (*Payload, error)

func GetPayloadFirst added in v1.3.0

func GetPayloadFirst(db *gorm.DB, group string) (*Payload, error)

func GetPayloadsByFolder added in v1.2.9

func GetPayloadsByFolder(db *gorm.DB, folder string) ([]*Payload, error)

func GetPayloadsByGroup added in v1.2.9

func GetPayloadsByGroup(db *gorm.DB, group string) ([]*Payload, error)

func NewPayload added in v1.2.9

func NewPayload(group string, content string) *Payload

/ payload

func QueryPayload

func QueryPayload(db *gorm.DB, folder, group, keyword string, paging *Paging) (*bizhelper.Paginator, []*Payload, error)

func QueryPayloadWithoutPaging added in v1.3.0

func QueryPayloadWithoutPaging(db *gorm.DB, folder, group, keyword string) ([]*Payload, error)

func (*Payload) BeforeCreate added in v1.3.0

func (p *Payload) BeforeCreate() error

func (*Payload) BeforeSave

func (p *Payload) BeforeSave() error

func (*Payload) BeforeUpdate added in v1.2.9

func (p *Payload) BeforeUpdate() error

func (*Payload) CalcHash

func (p *Payload) CalcHash() string

type PluginGroup added in v1.3.1

type PluginGroup struct {
	gorm.Model

	YakScriptName string `json:"yak_script_name" gorm:"index"`
	Group         string `json:"group"`
	Hash          string `json:"hash" gorm:"unique_index"`
	TemporaryId   string `json:"temporary_id"`
	IsPocBuiltIn  bool   `json:"is_poc_built_in"`
}

func GetGroup added in v1.3.1

func GetGroup(db *gorm.DB, scriptNames []string) (req []*PluginGroup, err error)

func GetPluginByGroup added in v1.3.1

func GetPluginByGroup(db *gorm.DB, group string) (req []*PluginGroup, err error)

func (*PluginGroup) CalcHash added in v1.3.1

func (p *PluginGroup) CalcHash() string

type PluginScanFilter added in v1.3.2

type PluginScanFilter struct {
	ExcludePluginScanURIs []string
	IncludePluginScanURIs []string
}

type Port

type Port struct {
	gorm.Model

	Host        string `json:"host" gorm:"index"`
	IPInteger   int    `json:"ip_integer" gorm:"column:ip_integer" json:"ip_integer"`
	Port        int    `json:"port" gorm:"index"`
	Proto       string `json:"proto"`
	ServiceType string `json:"service_type"`
	State       string `json:"state"`
	Reason      string `json:"reason"`
	Fingerprint string `json:"fingerprint"`
	CPE         string `json:"cpe"`
	HtmlTitle   string `json:"html_title"`
	From        string `json:"from"`
	Hash        string `json:"hash"`
	TaskName    string `json:"task_name"`

	// runtime id 运行时 ID
	RuntimeId string `json:"runtime_id"`
}

func GetPort

func GetPort(db *gorm.DB, id int64) (*Port, error)

func QueryPorts

func QueryPorts(db *gorm.DB, params *ypb.QueryPortsRequest) (*bizhelper.Paginator, []*Port, error)

func (*Port) BeforeSave

func (p *Port) BeforeSave() error

func (*Port) CalcHash

func (p *Port) CalcHash() string

type PortsTypeGroup added in v1.2.2

type PortsTypeGroup struct {
	Nginx                   int32
	Apache                  int32
	IIS                     int32
	Litespeed               int32
	Tomcat                  int32
	ApacheTrafficServer     int32
	OracleHTTPServer        int32
	Openresty               int32
	Jetty                   int32
	Caddy                   int32
	Gunicorn                int32
	Cowboy                  int32
	Lighttpd                int32
	Resin                   int32
	Zeus                    int32
	Cherrypy                int32
	Tengine                 int32
	Glassfish               int32
	PhusionPassenger        int32
	Tornadoserver           int32
	Hiawatha                int32
	OracleApplicationServer int32
	AbyssWebServer          int32
	Boa                     int32
	Xitami                  int32
	Simplehttp              int32
	Cherokee                int32
	MonkeyHTTPServer        int32
	NodeJS                  int32
	Websphere               int32
	Zope                    int32
	Mongoose                int32
	Macos                   int32
	Kestrel                 int32
	Aolserver               int32
	Dnsmasq                 int32
	Ruby                    int32
	Webrick                 int32
	WeblogicServer          int32
	Jboss                   int32
	SqlServer               int32
	Mysql                   int32
	Mongodb                 int32
	Redis                   int32
	Elasticsearch           int32
	Postgresql              int32
	DB2                     int32
	Hbase                   int32
	Memcached               int32
	Splunkd                 int32
}

func PortsServiceTypeGroup added in v1.2.2

func PortsServiceTypeGroup() ([]*PortsTypeGroup, error)

type Project

type Project struct {
	gorm.Model

	ProjectName  string
	Description  string
	DatabasePath string

	IsCurrentProject bool
	FolderID         int64
	ChildFolderID    int64
	Type             string
}

Project 描述一个 Yakit 项目 一般项目数据都是应该用 ProjectDatabase 作为连接的 但是项目本身的元数据应该存在 ProfileDatabase 中

func GetCurrentProject

func GetCurrentProject(db *gorm.DB) (*Project, error)

func GetDefaultProject

func GetDefaultProject(db *gorm.DB) (*Project, error)

func GetProject

func GetProject(db *gorm.DB, params *ypb.IsProjectNameValidRequest) (*Project, error)

func GetProjectByID

func GetProjectByID(db *gorm.DB, id int64) (*Project, error)

func GetProjectById

func GetProjectById(db *gorm.DB, id int64, Type string) (*Project, error)

func GetProjectByName

func GetProjectByName(db *gorm.DB, name string) (*Project, error)

func GetProjectByWhere

func GetProjectByWhere(db *gorm.DB, name string, folderID, childFolderID int64, Type string, id int64) (*Project, error)

func GetTemporaryProject added in v1.3.0

func GetTemporaryProject(db *gorm.DB) (*Project, error)

func QueryProject

func QueryProject(db *gorm.DB, params *ypb.GetProjectsRequest) (*bizhelper.Paginator, []*Project, error)

func (*Project) CalcHash

func (p *Project) CalcHash() string

func (*Project) ToGRPCModel

func (p *Project) ToGRPCModel() *ypb.ProjectDescription

type ProjectGeneralStorage added in v1.2.2

type ProjectGeneralStorage struct {
	gorm.Model

	Key string `json:"key" gorm:"unique_index"`

	// 经过 JSON + Strconv
	Value string `json:"value"`

	// 过期时间
	ExpiredAt time.Time

	// YAKIT SUBPROC_ENV
	ProcessEnv bool

	// 帮助信息,描述这个变量是干嘛的
	Verbose string

	// 描述变量所在的组是啥
	Group string
}

func GetProjectKeyByWhere added in v1.2.7

func GetProjectKeyByWhere(db *gorm.DB, key []string) ([]*ProjectGeneralStorage, error)

func GetProjectKeyModel added in v1.2.2

func GetProjectKeyModel(db *gorm.DB, key interface{}) (*ProjectGeneralStorage, error)

type Report

type Report struct {
	TitleValue string        `json:"title"`
	OwnerValue string        `json:"owner"`
	FromValue  string        `json:"from"`
	Items      []*ReportItem `json:"items"`
}

func NewReport

func NewReport() *Report

func (*Report) BarGraphHorizontal

func (r *Report) BarGraphHorizontal(items ...interface{})

func (*Report) BarGraphVertical

func (r *Report) BarGraphVertical(items ...interface{})

func (*Report) Code

func (r *Report) Code(items interface{})

func (*Report) Divider

func (r *Report) Divider()

func (*Report) From

func (r *Report) From(i interface{}, items ...interface{})

func (*Report) Markdown

func (r *Report) Markdown(i string)

func (*Report) Owner

func (r *Report) Owner(i interface{}, items ...interface{})

func (*Report) PieGraph

func (r *Report) PieGraph(items ...interface{})

func (*Report) Raw

func (r *Report) Raw(items interface{})

func (*Report) Save

func (r *Report) Save() int

func (*Report) SearchTable added in v1.2.4

func (r *Report) SearchTable(i interface{}, raw ...interface{})

func (*Report) Table

func (r *Report) Table(i interface{}, raw ...interface{})

func (*Report) Title

func (r *Report) Title(i interface{}, items ...interface{})

func (*Report) ToRecord

func (r *Report) ToRecord() (*ReportRecord, error)

func (*Report) WordCloud

func (r *Report) WordCloud(items ...interface{})

type ReportItem

type ReportItem struct {
	Type    string `json:"type"`
	Content string `json:"content"`
}

type ReportRecord

type ReportRecord struct {
	gorm.Model

	Title       string
	PublishedAt time.Time `json:"published_at"`
	Hash        string    `json:"hash" gorm:"unique_index"`
	Owner       string    `json:"owner"`
	From        string    `json:"from"`
	QuotedJson  string    `json:"quoted_json"`
}

func GetReportRecord

func GetReportRecord(db *gorm.DB, id int64) (*ReportRecord, error)

func GetReportRecordByHash

func GetReportRecordByHash(db *gorm.DB, id string) (*ReportRecord, error)

func QueryReportRecord

func QueryReportRecord(db *gorm.DB, params *ypb.QueryReportsRequest) (*bizhelper.Paginator, []*ReportRecord, error)

func (*ReportRecord) BeforeSave

func (r *ReportRecord) BeforeSave()

func (*ReportRecord) CalcHash

func (r *ReportRecord) CalcHash() string

func (*ReportRecord) ToGRPCModel

func (i *ReportRecord) ToGRPCModel() *ypb.Report

func (*ReportRecord) ToReport

func (r *ReportRecord) ToReport() (*Report, error)

type Risk

type Risk struct {
	gorm.Model

	Hash string `json:"hash"`

	// essential
	IP        string `json:"ip"`
	IPInteger int64  `json:"ip_integer"`

	// extraTargets
	Url  string `json:"url"`
	Port int    `json:"port"`
	Host string `json:"host"`

	//
	Title           string `json:"title"`
	TitleVerbose    string `json:"title_verbose"`
	Description     string `json:"description"`
	Solution        string `json:"solution"`
	RiskType        string `json:"risk_type"`
	RiskTypeVerbose string `json:"risk_verbose"`
	Parameter       string `json:"parameter"`
	Payload         string `json:"payload"`
	Details         string `json:"details"`
	Severity        string `json:"severity"`

	// 来源于哪个插件?
	FromYakScript string `json:"from_yak_script"`

	// 等待验证中?
	WaitingVerified bool `json:"waiting_verified"`
	// 用于验证的 ReverseToken
	ReverseToken string `json:"reverse_token"`

	// 设置运行时 ID 为了关联具体漏洞
	RuntimeId      string `json:"runtime_id"`
	QuotedRequest  string `json:"quoted_request"`
	QuotedResponse string `json:"quoted_response"`

	// 潜在威胁:用于输出合规性质的漏洞内容
	IsPotential bool `json:"is_potential"`

	CVE                 string `json:"cve"`
	IsRead              bool   `json:"is_read"`
	Ignore              bool   `json:"ignore"`
	UploadOnline        bool   `json:"upload_online"`
	TaskName            string `json:"task_name"`
	CveAccessVector     string `json:"cve_access_vector"`
	CveAccessComplexity string `json:"cve_access_complexity"`
}

func CreateRisk

func CreateRisk(u string, opts ...RiskParamsOpt) *Risk

func GetRisk

func GetRisk(db *gorm.DB, id int64) (*Risk, error)

func GetRiskByHash

func GetRiskByHash(db *gorm.DB, hash string) (*Risk, error)

func GetRisksByRuntimeId added in v1.3.1

func GetRisksByRuntimeId(db *gorm.DB, runtimeId string) ([]*Risk, error)

func IsRiskExecResult added in v1.3.2

func IsRiskExecResult(i any) (*Risk, bool)

func NewRisk

func NewRisk(u string, opts ...RiskParamsOpt) (*Risk, error)

func NewUnverifiedRisk

func NewUnverifiedRisk(u string, token string, opts ...RiskParamsOpt) (*Risk, error)

func QueryNewRisk

func QueryNewRisk(db *gorm.DB, req *ypb.QueryNewRiskRequest, newRisk bool, isRead bool) (*bizhelper.Paginator, []*Risk, error)

func QueryRisks

func QueryRisks(db *gorm.DB, params *ypb.QueryRisksRequest) (*bizhelper.Paginator, []*Risk, error)

func (*Risk) AfterCreate added in v1.3.2

func (r *Risk) AfterCreate(tx *gorm.DB) (err error)

func (*Risk) AfterDelete added in v1.3.2

func (r *Risk) AfterDelete(tx *gorm.DB) (err error)

func (*Risk) AfterSave added in v1.3.2

func (r *Risk) AfterSave(tx *gorm.DB) (err error)

func (*Risk) AfterUpdate added in v1.3.2

func (r *Risk) AfterUpdate(tx *gorm.DB) (err error)

func (*Risk) BeforeSave

func (p *Risk) BeforeSave() error

func (*Risk) ColorizedShow added in v1.3.2

func (p *Risk) ColorizedShow()

func (*Risk) ToGRPCModel

func (p *Risk) ToGRPCModel() *ypb.Risk

type RiskParamsOpt

type RiskParamsOpt func(r *Risk)

func WithRiskParam_CVE

func WithRiskParam_CVE(s string) RiskParamsOpt

func WithRiskParam_Description

func WithRiskParam_Description(i string) RiskParamsOpt

func WithRiskParam_Details

func WithRiskParam_Details(i interface{}) RiskParamsOpt

func WithRiskParam_FromScript

func WithRiskParam_FromScript(i string) RiskParamsOpt

func WithRiskParam_Ignore added in v1.2.6

func WithRiskParam_Ignore(i bool) RiskParamsOpt

func WithRiskParam_Parameter

func WithRiskParam_Parameter(i string) RiskParamsOpt

func WithRiskParam_Payload

func WithRiskParam_Payload(i string) RiskParamsOpt

func WithRiskParam_Potential

func WithRiskParam_Potential(i bool) RiskParamsOpt

func WithRiskParam_Request

func WithRiskParam_Request(i interface{}) RiskParamsOpt

func WithRiskParam_Response

func WithRiskParam_Response(i interface{}) RiskParamsOpt

func WithRiskParam_RiskType

func WithRiskParam_RiskType(i string) RiskParamsOpt

func WithRiskParam_RiskVerbose

func WithRiskParam_RiskVerbose(i string) RiskParamsOpt

func WithRiskParam_RuntimeId

func WithRiskParam_RuntimeId(i string) RiskParamsOpt

func WithRiskParam_Severity

func WithRiskParam_Severity(i string) RiskParamsOpt

func WithRiskParam_Solution

func WithRiskParam_Solution(i string) RiskParamsOpt

func WithRiskParam_Title

func WithRiskParam_Title(i string) RiskParamsOpt

func WithRiskParam_TitleVerbose

func WithRiskParam_TitleVerbose(i string) RiskParamsOpt

func WithRiskParam_Token

func WithRiskParam_Token(i string) RiskParamsOpt

func WithRiskParam_YakitPluginName

func WithRiskParam_YakitPluginName(i string) RiskParamsOpt

type RssFeed

type RssFeed struct {
	gorm.Model

	SourceXmlUrl    string
	Hash            string     `gorm:"columns:hash;unique_index"`
	Title           string     `json:"title,omitempty"`
	Description     string     `json:"description,omitempty"`
	Link            string     `json:"link,omitempty"`
	FeedLink        string     `json:"feedLink,omitempty"`
	Updated         string     `json:"updated,omitempty"`
	UpdatedParsed   *time.Time `json:"updatedParsed,omitempty"`
	Published       string     `json:"published,omitempty"`
	PublishedParsed *time.Time `json:"publishedParsed,omitempty"`
	Author          string     `json:"author,omitempty"`
	AuthorEmail     string     `json:"author_email,omitempty"`
	Language        string     `json:"language,omitempty"`
	ImageUrl        string     `json:"image_url,omitempty"`
	ImageName       string     `json:"image_name,omitempty"`
	Copyright       string     `json:"copyright,omitempty"`
	Generator       string     `json:"generator,omitempty"`
	Categories      string     `json:"categories,omitempty"`
	FeedType        string     `json:"feedType"`
	FeedVersion     string     `json:"feedVersion"`
}

func (*RssFeed) BeforeSave

func (b *RssFeed) BeforeSave() error

func (*RssFeed) CalcHash

func (b *RssFeed) CalcHash() string

type ScreenRecorder

type ScreenRecorder struct {
	gorm.Model

	// 保存到本地的路径
	Filename  string
	NoteInfo  string
	Project   string
	Hash      string `json:"hash" gorm:"unique_index"`
	VideoName string
	Cover     string `gorm:"type:longtext"`
	Duration  string
}

func GetOneScreenRecorder added in v1.2.2

func GetOneScreenRecorder(db *gorm.DB, req *ypb.GetOneScreenRecorderRequest) (*ScreenRecorder, error)

func GetScreenRecorder

func GetScreenRecorder(db *gorm.DB, id int64) (*ScreenRecorder, error)

func IsExitScreenRecorder added in v1.2.2

func IsExitScreenRecorder(db *gorm.DB, id int64, order string) (*ScreenRecorder, error)

func (*ScreenRecorder) BeforeSave

func (s *ScreenRecorder) BeforeSave() error

func (*ScreenRecorder) CalcHash

func (s *ScreenRecorder) CalcHash() string

type SimplePort

type SimplePort struct {
	Host string
	Port int
}

type StoreMeta

type StoreMeta struct {
	Types []ModuleType `json:"types"`
}

type TagAndStatusCode

type TagAndStatusCode struct {
	Value string
	Count int
}

func HTTPFlowTags

func HTTPFlowTags(refreshRequest bool) ([]*TagAndStatusCode, error)

type TagAndTypeValue

type TagAndTypeValue struct {
	Value        string
	Count        int
	TemporaryId  string
	IsPocBuiltIn bool
}

func GroupCount added in v1.3.1

func GroupCount(db *gorm.DB) (req []*TagAndTypeValue, err error)

func YakScriptTags

func YakScriptTags(db *gorm.DB, where string, havingWhere string) (req []*TagAndTypeValue, err error)

func YakScriptType

func YakScriptType(db *gorm.DB) (req []*TagAndTypeValue, err error)

type TrafficPacket added in v1.2.8

type TrafficPacket struct {
	gorm.Model

	SessionUuid string `gorm:"index"`

	LinkLayerType        string
	NetworkLayerType     string
	TransportLayerType   string
	ApplicationLayerType string
	Payload              string

	// QuotedRaw contains the raw bytes of the packet, quoted such that it can be
	// caution: QuotedRaw is (maybe) not an utf8-valid string
	// quoted-used for save to database
	QuotedRaw string

	EthernetEndpointHardwareAddrSrc string
	EthernetEndpointHardwareAddrDst string
	IsIpv4                          bool
	IsIpv6                          bool
	NetworkEndpointIPSrc            string
	NetworkEndpointIPDst            string
	TransportEndpointPortSrc        int
	TransportEndpointPortDst        int
}

func QueryTrafficPacket added in v1.2.8

func QueryTrafficPacket(db *gorm.DB, request *ypb.QueryTrafficPacketRequest) (*bizhelper.Paginator, []*TrafficPacket, error)

type TrafficSession added in v1.2.8

type TrafficSession struct {
	gorm.Model

	Uuid string `gorm:"index"`

	// Traffic SessionType Means a TCP Session / ICMP Request-Response / UDP Request-Response
	// DNS Request-Response
	// HTTP Request-Response
	// we can't treat Proto as any transport layer proto or application layer proto
	// because we can't know the proto of a packet before we parse it
	//
	// just use session type as a hint / verbose to group some frames(packets).
	//
	// 1. tcp (reassembled)
	// 2. udp (try figure out request-response)
	// 3. dns
	// 4. http (flow)
	// 5. icmp (request-response)
	// 6. sni (tls client hello)
	SessionType string `gorm:"index"`

	DeviceName string `gorm:"index"`
	DeviceType string

	// LinkLayer physical layer
	IsLinkLayerEthernet bool
	LinkLayerSrc        string
	LinkLayerDst        string

	// NetworkLayer network layer
	IsIpv4          bool
	IsIpv6          bool
	NetworkSrcIP    string
	NetworkSrcIPInt int64
	NetworkDstIP    string
	NetworkDstIPInt int64

	// TransportLayer transport layer
	IsTcpIpStack          bool
	TransportLayerSrcPort int
	TransportLayerDstPort int

	// TCP State Flags
	// PDU Reassembled
	IsTCPReassembled bool
	// TCP SYN Detected? If so, it's a new TCP Session
	// 'half' means we haven't seen a FIN or RST
	IsHalfOpen bool
	// TCP FIN Detected
	IsClosed bool
	// TCP RST Detected
	IsForceClosed bool

	// TLS ClientHello
	HaveClientHello bool
	SNI             string
}

func QueryTrafficSession added in v1.2.8

func QueryTrafficSession(db *gorm.DB, request *ypb.QueryTrafficSessionRequest) (*bizhelper.Paginator, []*TrafficSession, error)

func QueryTrafficSessionByUUID added in v1.3.0

func QueryTrafficSessionByUUID(db *gorm.DB, uuid string) (*TrafficSession, error)

type TrafficStorageManager added in v1.2.8

type TrafficStorageManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTrafficStorageManager added in v1.2.8

func NewTrafficStorageManager(db *gorm.DB) *TrafficStorageManager

func (*TrafficStorageManager) CloseTCPFlow added in v1.2.8

func (m *TrafficStorageManager) CloseTCPFlow(flow *pcaputil.TrafficFlow, force bool) error

func (*TrafficStorageManager) CreateHTTPFlow added in v1.2.8

func (m *TrafficStorageManager) CreateHTTPFlow(flow *pcaputil.TrafficFlow, req *http.Request, rsp *http.Response) error

func (*TrafficStorageManager) CreateTCPReassembledFlow added in v1.2.8

func (m *TrafficStorageManager) CreateTCPReassembledFlow(flow *pcaputil.TrafficFlow) error

func (*TrafficStorageManager) FetchSession added in v1.2.8

func (m *TrafficStorageManager) FetchSession(hash string, packet gopacket.Packet, tpacket *TrafficPacket, typeStr string, noCreate bool) (*TrafficSession, error)

func (*TrafficStorageManager) SaveRawPacket added in v1.2.8

func (m *TrafficStorageManager) SaveRawPacket(packet gopacket.Packet) error

func (*TrafficStorageManager) SaveTCPReassembledFrame added in v1.2.8

func (m *TrafficStorageManager) SaveTCPReassembledFrame(flow *pcaputil.TrafficFlow, frame *pcaputil.TrafficFrame) error

type TrafficTCPReassembledFrame added in v1.2.8

type TrafficTCPReassembledFrame struct {
	gorm.Model

	SessionUuid string `gorm:"index"`
	QuotedData  string
	Seq         int64
	Timestamp   int64
	Source      string
	Destination string
}

func QueryTrafficTCPReassembled added in v1.2.8

func QueryTrafficTCPReassembled(db *gorm.DB, request *ypb.QueryTrafficTCPReassembledRequest) (*bizhelper.Paginator, []*TrafficTCPReassembledFrame, error)

type WebFuzzerLabel added in v1.2.3

type WebFuzzerLabel struct {
	gorm.Model
	Label string `json:"label"`
	// 模版数据唯一标识,用来兼容做对比
	DefaultDescription string `json:"default_description"`
	Description        string `json:"description"`
	Hash               string `gorm:"unique_index"`
}

func QueryWebFuzzerLabel added in v1.2.3

func QueryWebFuzzerLabel(db *gorm.DB) ([]*WebFuzzerLabel, error)

func (*WebFuzzerLabel) CalcHash added in v1.2.3

func (w *WebFuzzerLabel) CalcHash() string

type WebFuzzerResponse

type WebFuzzerResponse struct {
	gorm.Model

	WebFuzzerTaskId int    `json:"web_fuzzer_task_id" gorm:"index"`
	OK              bool   `json:"ok"`
	Request         string `json:"request"`
	Content         string `json:"content"`
	Payload         string `json:"payload"`
	Url             string `json:"url"`
	StatusCode      int    `json:"status_code"`
	DurationMs      int    `json:"duration_ms"`
	Timestamp       int64  `json:"timestamp"`
}

func (*WebFuzzerResponse) CalcCacheHash added in v1.2.8

func (w *WebFuzzerResponse) CalcCacheHash() string

func (*WebFuzzerResponse) ToGRPCModel

func (w *WebFuzzerResponse) ToGRPCModel() (*ypb.FuzzerResponse, error)

type WebFuzzerTask

type WebFuzzerTask struct {
	gorm.Model

	// 原始请求 json+quote
	RawFuzzTaskRequest string `json:"raw_fuzz_task_request"`

	// 对应前端的组织形式
	FuzzerIndex    string `json:"fuzzer_index"`
	FuzzerTabIndex string `json:"fuzzer_tab_index"`

	// HTTP 数据流总量
	HTTPFlowTotal        int    `json:"http_flow_total"`
	HTTPFlowSuccessCount int    `json:"http_flow_success_count"`
	HTTPFlowFailedCount  int    `json:"http_flow_failed_count"`
	Ok                   bool   `json:"ok"`
	Reason               string `json:"reason"` // if not ok
	Host                 string `json:"host"`
	Port                 int    `json:"port"`
	// retry 相关
	RetryRootID uint `json:"retry_root_id"`
}

这个结构用于保存当前测试的结果

包含:基本参数+请求数据

耗时+执行结果

执行结果包含,失败原因与执行成功的原因。

总共有多少个请求

func GetWebFuzzerTaskById

func GetWebFuzzerTaskById(db *gorm.DB, id int) (*WebFuzzerTask, error)

func SaveWebFuzzerTask

func SaveWebFuzzerTask(db *gorm.DB, req *ypb.FuzzerRequest, total int, ok bool, reason string) (*WebFuzzerTask, error)

func (*WebFuzzerTask) CalcCacheHash added in v1.2.8

func (w *WebFuzzerTask) CalcCacheHash() string

func (*WebFuzzerTask) ToGRPCModel added in v1.2.8

func (w *WebFuzzerTask) ToGRPCModel() *ypb.HistoryHTTPFuzzerTask

func (*WebFuzzerTask) ToGRPCModelDetail added in v1.2.8

func (w *WebFuzzerTask) ToGRPCModelDetail() *ypb.HistoryHTTPFuzzerTaskDetail

type WebShell added in v1.3.0

type WebShell struct {
	gorm.Model
	Url string `json:"url" gorm:"index" `
	// pass=payload
	Pass string `json:"pass"`
	// 加密密钥
	SecretKey string `json:"secret_key" gorm:"not null"`
	// 加密模式
	EncryptedMode string `json:"enc_mode" gorm:"column:enc_mode"`
	// 字符集编码
	Charset string `json:"charset" gorm:"default:'UTF-8'"`
	// 冰蝎还是哥斯拉,或者是其他
	ShellType string `json:"shell_type"`
	// 脚本语言
	ShellScript      string `json:"shell_script"`
	Headers          string `json:"headers" gorm:"type:json"`
	Status           bool   `json:"status"`
	Tag              string `json:"tag"`
	Proxy            string `json:"proxy"`
	Remark           string `json:"remark"`
	Hash             string `json:"hash"`
	PacketCodecName  string `json:"packet_codec_name"`
	PayloadCodecName string `json:"payload_codec_name"`
}

func CreateOrUpdateWebShell added in v1.3.0

func CreateOrUpdateWebShell(db *gorm.DB, hash string, i interface{}) (*WebShell, error)

func QueryWebShells added in v1.3.0

func QueryWebShells(db *gorm.DB, params *ypb.QueryWebShellsRequest) (*bizhelper.Paginator, []*WebShell, error)

func UpdateWebShellById added in v1.3.0

func UpdateWebShellById(db *gorm.DB, id int64, i interface{}) (*WebShell, error)

func UpdateWebShellStateById added in v1.3.0

func UpdateWebShellStateById(db *gorm.DB, id int64, state bool) (*WebShell, error)

func (*WebShell) BeforeSave added in v1.3.0

func (w *WebShell) BeforeSave() error

func (*WebShell) CalcHash added in v1.3.0

func (w *WebShell) CalcHash() string

func (*WebShell) ToGRPCModel added in v1.3.0

func (w *WebShell) ToGRPCModel() *ypb.WebShell

type WebsiteNextPart added in v1.2.9

type WebsiteNextPart struct {
	Schema       string
	NextPart     string
	HaveChildren bool
	Count        int
	IsQuery      bool
	RawQueryKey  string
	RawNextPart  string
	IsFile       bool
}

func GetHTTPFlowDomainsByDomainSuffix added in v1.2.9

func GetHTTPFlowDomainsByDomainSuffix(db *gorm.DB, domainSuffix string) []*WebsiteNextPart

func GetHTTPFlowNextPartPathByPathPrefix added in v1.2.9

func GetHTTPFlowNextPartPathByPathPrefix(db *gorm.DB, originPathPrefix string) []*WebsiteNextPart

type WebsiteTree added in v1.2.9

type WebsiteTree struct {
	Path         string
	NextParts    []*WebsiteNextPart
	HaveChildren bool
}

type WebsocketFlow

type WebsocketFlow struct {
	gorm.Model

	// HTTPFlow 过来的应该有 WebsocketHash
	WebsocketRequestHash string `json:"websocket_request_hash" gorm:"index"`

	FrameIndex  int    `json:"frame_index" gorm:"index"`
	FromServer  bool   `json:"from_server"`
	QuotedData  string `json:"quoted_data"`
	MessageType string `json:"message_type"`

	Hash string `json:"hash"`
}

func GetWebsocketFlow

func GetWebsocketFlow(db *gorm.DB, id int64) (*WebsocketFlow, error)

func QueryWebsocketFlowByWebsocketHash

func QueryWebsocketFlowByWebsocketHash(db *gorm.DB, hash string, page int, limit int) (*bizhelper.Paginator, []*WebsocketFlow, error)

func (*WebsocketFlow) BeforeSave

func (f *WebsocketFlow) BeforeSave() error

func (*WebsocketFlow) CalcHash

func (f *WebsocketFlow) CalcHash() string

func (*WebsocketFlow) ToGRPCModel

func (i *WebsocketFlow) ToGRPCModel() *ypb.WebsocketFlow

type WebsocketFlowShare added in v1.2.2

type WebsocketFlowShare struct {
	// HTTPFlow 过来的应该有 WebsocketHash
	WebsocketRequestHash string

	FrameIndex  int
	FromServer  bool
	QuotedData  []byte
	MessageType string
	Hash        string
}

type YakModuleMeta

type YakModuleMeta struct {
	ModuleName           string           `json:"name" yaml:"name"`
	Tags                 []string         `json:"tags" yaml:"tags"`
	Help                 string           `json:"help" yaml:"help"`
	Author               string           `json:"author" yaml:"author"`
	ModuleFile           string           `json:"module_file" yaml:"module_file"`
	Params               []YakModuleParam `json:"params" yaml:"params"`
	Document             string           `json:"document" yaml:"document"`
	GeneralModuleVerbose string           `json:"general_module_verbose" yaml:"general_module_verbose"`
	GeneralModuleKey     string           `json:"general_module_key" yaml:"general_module_key"`
	IsGeneralModule      bool             `json:"is_general_module" yaml:"is_general_module"`
	EnablePluginSelector bool             `json:"enable_plugin_selector" yaml:"enable_plugin_selector"`
	PluginSelectorTypes  string           `json:"plugin_selector_types" yaml:"plugin_selector_types"`
}

type YakModuleParam

type YakModuleParam struct {
	Name         string `json:"name" yaml:"name"`
	Verbose      string `json:"verbose" yaml:"verbose"`
	Description  string `json:"description" yaml:"description"`
	Type         string `json:"type" yaml:"type"`
	DefaultValue string `json:"default_value" yaml:"default_value"`
	Required     bool   `json:"required" yaml:"required"`
	Group        string `json:"group" yaml:"group"`
	ExtraSetting string `json:"extra_setting" yaml:"extra_setting"`
}

type YakScript

type YakScript struct {
	gorm.Model

	ScriptName string `json:"script_name" gorm:"unique_index"`
	Type       string `json:"type" gorm:"index"`
	Content    string `json:"content"`
	Level      string `json:"level"`
	Params     string `json:"params"`
	Help       string `json:"help"`
	Author     string `json:"author"`
	Tags       string `json:"tags,omitempty"`
	Ignored    bool   `json:"ignore"`

	// 加载本地的数据
	FromLocal bool   `json:"from_local"`
	LocalPath string `json:"local_path"`

	// History string
	IsHistory bool `json:"is_history"`

	// Force Interactive
	// Means that this script will be executed in interactive mode
	// cannot load as a plugin or a module by mix caller
	ForceInteractive bool `json:"force_interactive"`

	FromStore bool `json:"from_store"`

	IsGeneralModule      bool   `json:"is_general_module"`
	GeneralModuleVerbose string `json:"general_module_verbose"`
	GeneralModuleKey     string `json:"general_module_key"`
	FromGit              string `json:"from_git"`

	// 这个是自动填写的,一般不需要自己来填写
	// 条件是 Params 中有一个名字为 target 的必填参数
	IsBatchScript bool `json:"is_batch_script"`
	IsExternal    bool `json:"is_external"`

	EnablePluginSelector bool   `json:"enable_plugin_selector"`
	PluginSelectorTypes  string `json:"plugin_selector_types"`

	// Online ID: 线上插件的 ID
	OnlineId           int64  `json:"online_id"`
	OnlineScriptName   string `json:"online_script_name"`
	OnlineContributors string `json:"online_contributors"`
	OnlineIsPrivate    bool   `json:"online_is_private"`

	// 这个插件所属用户 ID
	UserId int64 `json:"user_id"`
	// 这个插件的 UUID
	Uuid           string `json:"uuid"`
	HeadImg        string `json:"head_img"`
	OnlineBaseUrl  string `json:"online_base_url"`
	BaseOnlineId   int64  `json:"BaseOnlineId"`
	OnlineOfficial bool   `json:"online_official"`
	OnlineGroup    string `json:"online_group"`

	IsCorePlugin bool `json:"is_core_plugin"` // 判断是否是核心插件
	// 废弃字段
	RiskType string `json:"risk_type"`
	// 漏洞详情 建议,描述,cwe
	RiskDetail string `json:"risk_detail"`
	// 漏洞类型-补充说明 废弃
	RiskAnnotation string `json:"risk_annotation"`
	// 协作者
	CollaboratorInfo string `json:"collaborator_info"`
	// contains filtered or unexported fields
}

func GetNucleiYakScriptByName

func GetNucleiYakScriptByName(db *gorm.DB, scriptName string) (*YakScript, error)

GetNucleiYakScriptByName

func GetYakScript

func GetYakScript(db *gorm.DB, id int64) (*YakScript, error)

func GetYakScriptByName

func GetYakScriptByName(db *gorm.DB, name string) (*YakScript, error)

func GetYakScriptByOnlineID

func GetYakScriptByOnlineID(db *gorm.DB, onlineId int64) (*YakScript, error)

func GetYakScriptByUUID

func GetYakScriptByUUID(db *gorm.DB, uuid string) (*YakScript, error)

func GetYakScriptIdOrName

func GetYakScriptIdOrName(db *gorm.DB, id int64, name string) (*YakScript, error)

func GetYakScriptList

func GetYakScriptList(db *gorm.DB, id int64, ids []int64) ([]*YakScript, error)

func NewTemporaryYakScript added in v1.3.2

func NewTemporaryYakScript(t string, code string, suffix ...string) (*YakScript, error)

func QueryYakScript

func QueryYakScript(db *gorm.DB, params *ypb.QueryYakScriptRequest) (*bizhelper.Paginator, []*YakScript, error)

func QueryYakScriptByIsCore added in v1.2.4

func QueryYakScriptByIsCore(db *gorm.DB, isCore bool) []*YakScript

func QueryYakScriptByNames

func QueryYakScriptByNames(db *gorm.DB, names ...string) []*YakScript

func (*YakScript) AfterCreate added in v1.3.2

func (s *YakScript) AfterCreate(tx *gorm.DB) (err error)

func (*YakScript) AfterDelete added in v1.3.2

func (s *YakScript) AfterDelete(tx *gorm.DB) (err error)

func (*YakScript) AfterSave added in v1.3.2

func (s *YakScript) AfterSave(tx *gorm.DB) (err error)

func (*YakScript) AfterUpdate added in v1.3.2

func (s *YakScript) AfterUpdate(tx *gorm.DB) (err error)

func (*YakScript) BeforeSave

func (s *YakScript) BeforeSave() error

func (*YakScript) ToGRPCModel

func (s *YakScript) ToGRPCModel() *ypb.YakScript

Jump to

Keyboard shortcuts

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