output

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

  • Package console @Author: zhizhuo @IDE:GoLand @File: console.go @Date: 2025/3/20 下午2:11*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close() error

Close 关闭所有输出资源(文件和socket)

func CloseFileOutput

func CloseFileOutput() error

CloseFileOutput 关闭仅文件输出资源。 关闭顺序:先 drain 异步队列 -> 再 Flush CSV writer -> 再关闭文件句柄, 保证 writer goroutine 不会写到已关闭的 FD。

func CloseSockOutput

func CloseSockOutput() error

CloseSockOutput 关闭socket输出资源

func CreateProgressBar

func CreateProgressBar(total int) *progressbar.ProgressBar

CreateProgressBar 创建对小窗口友好的单行进度条(委托 utils/progress)。

func GetOutputFormat

func GetOutputFormat(jsonOutput bool, outputPath string) string

GetOutputFormat 确定输出格式

func HandleMatchResults

func HandleMatchResults(targetResult *TargetResult, output string, sockOutput string, printResult func(string), outputFormat string, lastResponse *proto.Response)

HandleMatchResults 处理匹配结果并输出到控制台

func InitOutput

func InitOutput(outputPath, format string) error

InitOutput 初始化输出文件并启动异步写入器。 异步写入器把 URL 工作池的"格式化 + 落盘"动作从同步路径剥离, 消除高并发下抢占全局 mu 锁的串行瓶颈。

func InitSockOutput

func InitSockOutput(sockPath string) error

InitSockOutput 初始化socket文件输出

func PrintSummaryCounts

func PrintSummaryCounts(total, matched, unmatched int)

PrintSummaryCounts 输出聚合计数,不要求调用方保留全部扫描结果。

func WriteFingerprints

func WriteFingerprints(opts *WriteOptions) error

WriteFingerprints 使用结构体选项写入指纹组合结果

func WriteHeader

func WriteHeader(format string) error

WriteHeader 写入输出文件的表头

func WriteResultToFile

func WriteResultToFile(targetResult *TargetResult, outputs, format string, lastResponse *proto.Response)

WriteResultToFile 将结果写入文件。 优先走异步队列以解放 URL 工作池;队列满时退回同步写入,保证不丢数据。

func WriteResultToSock

func WriteResultToSock(targetResult *TargetResult, lastResponse *proto.Response)

WriteResultToSock 将结果写入socket文件

func WriteToSock

func WriteToSock(opts *WriteOptions) error

WriteToSock 将结果以JSON格式写入所有socket连接

Types

type FingerMatch

type FingerMatch struct {
	Finger   *finger.Finger  // 指纹信息
	Result   bool            // 识别结果
	Request  *proto.Request  // 请求数据
	Response *proto.Response // 响应数据
}

FingerMatch 存储每个匹配的指纹信息

type JSONOutput

type JSONOutput struct {
	URL         string                     `json:"url"`
	StatusCode  int32                      `json:"status_code"`
	Title       string                     `json:"title"`
	Server      string                     `json:"server"`
	FingerIDs   []string                   `json:"finger_ids,omitempty"`
	FingerNames []string                   `json:"finger_names,omitempty"`
	Headers     string                     `json:"headers,omitempty"`
	Wappalyzer  *wappalyzer.TypeWappalyzer `json:"wappalyzer,omitempty"`
	MatchResult bool                       `json:"match_result"`
	Remark      string                     `json:"remark,omitempty"`
	ICP         string                     `json:"icp,omitempty"`
	Certs       []*types.CertInfo          `json:"certs,omitempty"`
}

JSONOutput JSON格式输出结构体

type TargetResult

type TargetResult struct {
	URL        string                     // 目标地址
	StatusCode int32                      // 状态码
	Title      string                     // 站点标题
	ServerInfo *types.ServerInfo          // server信息
	Fingers    []*finger.Finger           // 匹配的指纹列表
	Matches    []*FingerMatch             // 匹配详细信息
	Wappalyzer *wappalyzer.TypeWappalyzer // 站点信息数据
	ICP        string                     // ICP 备案号
	Certs      []*types.CertInfo          // 证书信息
}

TargetResult 存储每个目标的扫描结果

type WriteOptions

type WriteOptions struct {
	Output      string                     // 输出文件路径
	Format      string                     // 输出格式(csv/txt/json)
	Target      string                     // 目标URL
	Fingers     []*finger.Finger           // 指纹列表
	StatusCode  int32                      // 状态码
	Title       string                     // 页面标题
	ServerInfo  *types.ServerInfo          // 服务器信息
	RespHeaders string                     // 响应头
	Response    *proto.Response            // 完整响应对象(可选)
	Wappalyzer  *wappalyzer.TypeWappalyzer // 站点使用技术
	FinalResult bool                       // 最终匹配结果
	Remark      string                     // 备注(可选)
	ICP         string                     // ICP 备案号(可选)
	Certs       []*types.CertInfo          // 证书信息(可选)
}

WriteOptions 定义写入选项结构体,用于传递写入参数

func CreateWriteOptions

func CreateWriteOptions(targetResult *TargetResult, outputPath string, format string, lastResponse *proto.Response) *WriteOptions

CreateWriteOptions 创建通用的写入选项结构体

Jump to

Keyboard shortcuts

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