types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// target
	Target     goflags.StringSlice
	TargetFile string
	Ports      string

	// scan
	// 扫描选项
	MaxTimeout       int
	Timeout          int
	Retries          int
	HttpRetry        int
	Threads          int
	FastMode         bool
	UseAllProbes     bool
	NmapProneName    string
	UseSSL           bool
	VersionIntensity int
	ServiceVersion   bool // 是否探测服务版本
	VersionTrace     bool // 是否跟踪版本

	Silent     bool // 是否启用静默模式
	NoProgress bool // 是否不显示进度条

	// 网络选项
	Proxy string // 代理设置

	// 指纹库选项
	AppFingerHome string // 指纹库路径
	UpdateRule    bool   // 是否更新指纹规则

	// Web扫描选项
	DisableIcon bool // 禁用图标请求匹配
	DisableJS   bool // 禁用JavaScript规则匹配

	// 其他选项
	EnablePprof bool // 是否启用性能分析

	// config
	Version bool   // 版本信息
	Banner  string // Banner信息
	// Debug
	Debug         bool
	DebugResponse bool // 是否打印响应数据
	DebugRequest  bool
	// output
	OutType    string // 输出格式
	Output     string // 输出文件路径
	OutputType string // 输出格式 (json, csv, console)

}

Options 包含XMap全局初始化选项

func DefaultOptions

func DefaultOptions() *Options

type SSLResponse added in v0.0.2

type SSLResponse struct {
	// 基本字段
	TLSVersion  string `json:"tls_version"`  // TLS 版本
	CipherSuite string `json:"cipher_suite"` // 加密套件
	RawData     string `json:"raw_data"`     // 原始 SSL 数据
	// JA3S指纹
	JA3S string `json:"ja3s,omitempty"` // JA3S指纹
	// 结构化证书信息
	CertInfo map[string]any `json:"cert_info"`
}

SSLResponse 包含 SSL/TLS 响应的完整信息

func FromTlsConnectionState added in v0.0.2

func FromTlsConnectionState(state *tls.ConnectionState) *SSLResponse

FromTlsConnectionState 从 tls.ConnectionState 创建 SSLResponse

type ScanResult

type ScanResult struct {
	// 目标信息
	Target *ScanTarget `json:"-"`
	// Protocol
	Protocol string `json:"protocol"`
	// 主机名
	Hostname string `json:"hostname"` // 域名或IP
	Port     int    `json:"port"`
	IP       string `json:"ip,omitempty"` // 解析IP,可能为空
	// Web 扫描相关字段
	URL    string                 `json:"url,omitempty"`
	Banner map[string]interface{} `json:"banner,omitempty"`
	// 通用组件信息
	Components []map[string]interface{} `json:"components,omitempty"`
	// 服务名称
	Service string `json:"service"`
	// 是否使用SSL
	SSL bool `json:"ssl,omitempty"`
	// 证书信息
	Certificate *SSLResponse `json:"certificate,omitempty"`
	// 附加信息
	Extra       map[string]interface{} `json:"extra,omitempty"`
	RawResponse []byte
	// 匹配的探针名称
	MatchedProbe string `json:"matched_probe"`
	// 匹配的正则表达式
	MatchedPattern string `json:"matched_pattern"`
	// 扫描耗时
	Duration float64 `json:"duration"`
	// 错误信息
	Error error `json:"error"`
	// 扫描状态
	Status ScanStatus `json:"status"`
	// contains filtered or unexported fields
}

ScanResult 表示扫描结果

func NewScanResult

func NewScanResult(target *ScanTarget) *ScanResult

NewScanResult 创建新的扫描结果

func (*ScanResult) Complete

func (r *ScanResult) Complete(err error)

Complete 完成扫描结果

func (*ScanResult) JSON

func (r *ScanResult) JSON() string

JSON 返回扫描结果的 JSON 字符串

func (*ScanResult) SetMatchResult

func (r *ScanResult) SetMatchResult(probeName, service, pattern string, softMatch bool)

SetMatchResult 设置匹配结果

type ScanStatus

type ScanStatus int

ScanStatus 扫描结果状态

const (
	StatusUnknown ScanStatus = iota
	StatusMatched
	StatusNoMatch
	StatusError
	StatusClosed
	StatusInvalid    // 无效目标(如连续多次连接失败)
	StatusFirewalled // 可能被防火墙阻止
)

type ScanTarget

type ScanTarget struct {
	// Web 场景下的协议(http/https),与 Protocol (tcp/udp) 区分
	Scheme string `json:"-"`
	// 原始输入(用户提供的字符串)
	Raw string `json:"raw,omitempty"`
	// 解析后的信息
	Host     string `json:"host,omitempty"`     // 主机名或IP
	IP       string `json:"ip,omitempty"`       // IP地址
	Port     int    `json:"port,omitempty"`     // 端口
	Protocol string `json:"protocol,omitempty"` // 协议 (TCP/UDP)
	Path     string `json:"path,omitempty"`     // URL路径
	// 解析状态,不输出到JSON
	Parsed bool `json:"-"`
	// TLS证书,不输出到JSON
	TLSCertificates []*x509.Certificate `json:"-"`
	// 证书信息,用于临时存储解析的证书数据
	Certificate map[string]interface{} `json:"-"`
}

ScanTarget 表示扫描目标

func NewTarget

func NewTarget(raw string) *ScanTarget

func (*ScanTarget) String

func (t *ScanTarget) String() string

String 返回目标的字符串表示

type TLSInfo added in v0.0.2

type TLSInfo struct {
	Certificates []*x509.Certificate
	Version      string
	TLSVersion   string
	CipherSuite  string
	JA3S         string
	RawData      []byte
}

TLSInfo 包含 TLS 连接的信息

Jump to

Keyboard shortcuts

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