core

package
v0.0.0-...-33f6857 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(debug, offline bool, output string)

func PrintResults

func PrintResults(logger *zap.SugaredLogger, results []Result)

func SaveResults

func SaveResults(results []Result, format string) error

SaveResults 导出结果

Types

type Plugin

type Plugin interface {
	Name() string
	Run(ctx context.Context, config *ScanConfig) ([]Result, error)
}

Plugin 是所有扫描模块必须实现的接口

type Result

type Result struct {
	Plugin      string // 插件名称
	Level       string // "INFO", "low", "medium", "high", "critical"
	Description string // 描述
	Reference   string // 引用 (文件路径, 进程ID 等)
	Advice      string // 建议
}

Result 代表扫描器的一个发现结果

func SafeRun

func SafeRun(plugin Plugin, ctx context.Context, cfg *ScanConfig) (results []Result, err error)

SafeRun 安全执行插件,捕获 panic 并转换为错误

type ScanConfig

type ScanConfig struct {
	Debug      bool
	Offline    bool
	Output     string
	ReportPath string
}

ScanConfig 保存扫描会话的全局配置

var GlobalConfig *ScanConfig

Jump to

Keyboard shortcuts

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