Documentation
¶
Index ¶
- Constants
- Variables
- func AddScan(plugin string, info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
- func ArrayCountValueTop(arrInit []string, length int, flag bool) (arrTop []string, arrLen []int)
- func CheckLive(hostslist []string, Ping bool) []string
- func DecodeData(s string) ([]byte, error)
- func DecodePattern(s string) ([]byte, error)
- func ExecCommandPing(ip string) bool
- func IsContain(items []string, item string) bool
- func NoPortScan(hostslist []string, ports string) []string
- func PortConnect(addr Addr, results chan<- ScanResult, timeout int64, wg *sync.WaitGroup)
- func PortScan(hostslist []string, ports string, timeout int64) []string
- func RunIcmp1(hostslist []string, conn *icmp.PacketConn, chanHosts chan string)
- func RunIcmp2(hostslist []string, chanHosts chan string)
- func RunPing(hostslist []string, chanHosts chan string)
- func Scan(info Common.HostInfo)
- func ScanFunc(name *string, info *Common.HostInfo)
- type Addr
- type Directive
- type Extras
- type Info
- type Match
- type PortInfoScanner
- type Probe
- type ProbesRarity
- type Result
- type ScanResult
- type ScanTask
- type Service
- type ServiceInfo
- type Target
- type VScan
Constants ¶
View Source
const WrTimeout = 5 // 默认读写超时时间(秒)
Variables ¶
View Source
var ( AliveHosts []string // 存活主机列表 ExistHosts = make(map[string]struct{}) // 已发现主机记录 )
View Source
var ( LocalScan bool // 本地扫描模式标识 WebScan bool // Web扫描模式标识 )
全局变量定义
View Source
var Mutex = &sync.Mutex{}
Mutex 用于保护共享资源的并发访问
View Source
var ProbeString string
Functions ¶
func ArrayCountValueTop ¶
ArrayCountValueTop 统计IP地址段存活数量并返回TOP N结果
func DecodeData ¶
func NoPortScan ¶
NoPortScan 生成端口列表(不进行扫描) hostslist: 主机列表 ports: 端口范围 返回地址列表
func PortConnect ¶
func PortConnect(addr Addr, results chan<- ScanResult, timeout int64, wg *sync.WaitGroup)
PortConnect 执行单个端口连接检测 addr: 待检测的地址 results: 结果通道 timeout: 超时时间 wg: 等待组
func RunIcmp1 ¶
func RunIcmp1(hostslist []string, conn *icmp.PacketConn, chanHosts chan string)
RunIcmp1 使用ICMP批量探测主机存活(监听模式)
Types ¶
type Extras ¶
type Info ¶
type Info struct { Address string // 目标IP地址 Port int // 目标端口 Conn net.Conn // 网络连接 Result Result // 探测结果 Found bool // 是否成功识别服务 }
Info 定义单个端口探测的上下文信息
type Match ¶
type Match struct { IsSoft bool // 是否为软匹配 Service string // 服务名称 Pattern string // 匹配模式 VersionInfo string // 版本信息格式 FoundItems []string // 找到的项目 PatternCompiled *regexp.Regexp // 编译后的正则表达式 }
func (*Match) MatchPattern ¶
MatchPattern 使用正则表达式匹配响应内容
func (*Match) ParseVersionInfo ¶
ParseVersionInfo 解析版本信息并返回额外信息结构
type PortInfoScanner ¶
type PortInfoScanner struct { Address string // 目标IP地址 Port int // 目标端口 Conn net.Conn // 网络连接 Timeout time.Duration // 超时时间 // contains filtered or unexported fields }
PortInfoScanner 定义端口服务识别器
func NewPortInfoScanner ¶
func NewPortInfoScanner(addr string, port int, conn net.Conn, timeout time.Duration) *PortInfoScanner
NewPortInfoScanner 创建新的端口服务识别器实例
func (*PortInfoScanner) Identify ¶
func (s *PortInfoScanner) Identify() (*ServiceInfo, error)
Identify 执行服务识别,返回识别结果
type Probe ¶
type Probe struct { Name string // 探测器名称 Data string // 探测数据 Protocol string // 协议 Ports string // 端口范围 SSLPorts string // SSL端口范围 TotalWaitMS int // 总等待时间 TCPWrappedMS int // TCP包装等待时间 Rarity int // 稀有度 Fallback string // 回退探测器名称 Matchs *[]Match // 匹配规则列表 }
func (*Probe) ContainsPort ¶
ContainsPort 检查指定端口是否在探测器的端口范围内
type ProbesRarity ¶
type ProbesRarity []Probe
ProbesRarity 用于按稀有度排序的探测器切片
func (ProbesRarity) Less ¶
func (ps ProbesRarity) Less(i, j int) bool
Less 比较函数,按稀有度升序排序,实现 sort.Interface 接口
func (ProbesRarity) Swap ¶
func (ps ProbesRarity) Swap(i, j int)
Swap 交换切片中的两个元素,实现 sort.Interface 接口
type Result ¶
type Result struct { Service Service // 识别出的服务信息 Banner string // 服务横幅 Extras map[string]string // 额外信息 Send []byte // 发送的探测数据 Recv []byte // 接收到的响应数据 }
Result 定义单次探测的结果
type ScanResult ¶
type ScanResult struct { Address string // IP地址 Port int // 端口号 Service *ServiceInfo // 服务信息 }
ScanResult 扫描结果
type ServiceInfo ¶
type ServiceInfo struct { Name string // 服务名称,如 http、ssh 等 Banner string // 服务返回的横幅信息 Version string // 服务版本号 Extras map[string]string // 其他额外信息,如操作系统、产品名等 }
ServiceInfo 定义服务识别的结果信息
Click to show internal directories.
Click to hide internal directories.