Documentation
¶
Index ¶
- Constants
- Variables
- 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 EnhancedPortScan(hosts []string, ports string, timeout int64) []string
- func ExecCommandPing(ip string) bool
- func ExecuteScanTasks(targets []Common.HostInfo, strategy ScanStrategy, ch *chan struct{}, ...)
- func GetAllPlugins() []string
- func IsContain(items []string, item string) bool
- 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)
- type Directive
- type Extras
- type Info
- type LocalScanStrategy
- func (s *LocalScanStrategy) Description() string
- func (s *LocalScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
- func (s *LocalScanStrategy) GetPlugins() ([]string, bool)
- func (s *LocalScanStrategy) IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
- func (s *LocalScanStrategy) LogPluginInfo()
- func (s *LocalScanStrategy) Name() string
- func (s *LocalScanStrategy) PrepareTargets(info Common.HostInfo) []Common.HostInfo
- type Match
- type PortInfoScanner
- type Probe
- type ProbesRarity
- type Result
- type ScanStrategy
- type ScanTask
- type Scanner
- type Service
- type ServiceInfo
- type ServiceScanStrategy
- func (s *ServiceScanStrategy) Description() string
- func (s *ServiceScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
- func (s *ServiceScanStrategy) GetPlugins() ([]string, bool)
- func (s *ServiceScanStrategy) IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
- func (s *ServiceScanStrategy) LogPluginInfo()
- func (s *ServiceScanStrategy) Name() string
- func (s *ServiceScanStrategy) PrepareTargets(info Common.HostInfo) []Common.HostInfo
- type Target
- type VScan
- type WebScanStrategy
- func (s *WebScanStrategy) Description() string
- func (s *WebScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
- func (s *WebScanStrategy) GetPlugins() ([]string, bool)
- func (s *WebScanStrategy) IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
- func (s *WebScanStrategy) LogPluginInfo()
- func (s *WebScanStrategy) Name() string
- func (s *WebScanStrategy) PrepareTargets(baseInfo Common.HostInfo) []Common.HostInfo
Constants ¶
const WrTimeout = 5 // 默认读写超时时间(秒)
Variables ¶
var ( AliveHosts []string // 存活主机列表 ExistHosts = make(map[string]struct{}) // 已发现主机记录 )
var ProbeString string
Functions ¶
func ArrayCountValueTop ¶
ArrayCountValueTop 统计IP地址段存活数量并返回TOP N结果
func DecodeData ¶
func EnhancedPortScan ¶
EnhancedPortScan 高性能端口扫描函数
func ExecuteScanTasks ¶
func ExecuteScanTasks(targets []Common.HostInfo, strategy ScanStrategy, ch *chan struct{}, wg *sync.WaitGroup)
任务执行通用框架
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 LocalScanStrategy ¶
type LocalScanStrategy struct{}
LocalScanStrategy 本地扫描策略
func NewLocalScanStrategy ¶
func NewLocalScanStrategy() *LocalScanStrategy
NewLocalScanStrategy 创建新的本地扫描策略
func (*LocalScanStrategy) Description ¶
func (s *LocalScanStrategy) Description() string
Description 返回策略描述
func (*LocalScanStrategy) Execute ¶
func (s *LocalScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
Execute 执行本地扫描策略
func (*LocalScanStrategy) GetPlugins ¶
func (s *LocalScanStrategy) GetPlugins() ([]string, bool)
GetPlugins 获取本地扫描插件列表
func (*LocalScanStrategy) IsPluginApplicable ¶
func (s *LocalScanStrategy) IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
IsPluginApplicable 判断插件是否适用于本地扫描
func (*LocalScanStrategy) LogPluginInfo ¶
func (s *LocalScanStrategy) LogPluginInfo()
LogPluginInfo 输出本地扫描插件信息
func (*LocalScanStrategy) PrepareTargets ¶
func (s *LocalScanStrategy) PrepareTargets(info Common.HostInfo) []Common.HostInfo
PrepareTargets 准备本地扫描目标
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 ScanStrategy ¶
type ScanStrategy interface {
// 名称和描述
Name() string
Description() string
// 执行扫描的主要方法
Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
// 插件管理方法
GetPlugins() ([]string, bool)
LogPluginInfo()
// 任务准备方法
PrepareTargets(info Common.HostInfo) []Common.HostInfo
IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
}
ScanStrategy 定义扫描策略接口
type ScanTask ¶
type ScanTask struct {
// contains filtered or unexported fields
}
ScanTask 表示单个扫描任务
type ServiceInfo ¶
type ServiceInfo struct {
Name string // 服务名称,如 http、ssh 等
Banner string // 服务返回的横幅信息
Version string // 服务版本号
Extras map[string]string // 其他额外信息,如操作系统、产品名等
}
ServiceInfo 定义服务识别的结果信息
type ServiceScanStrategy ¶
type ServiceScanStrategy struct{}
ServiceScanStrategy 服务扫描策略
func NewServiceScanStrategy ¶
func NewServiceScanStrategy() *ServiceScanStrategy
NewServiceScanStrategy 创建新的服务扫描策略
func (*ServiceScanStrategy) Description ¶
func (s *ServiceScanStrategy) Description() string
Description 返回策略描述
func (*ServiceScanStrategy) Execute ¶
func (s *ServiceScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
Execute 执行服务扫描策略
func (*ServiceScanStrategy) GetPlugins ¶
func (s *ServiceScanStrategy) GetPlugins() ([]string, bool)
GetPlugins 获取服务扫描插件列表
func (*ServiceScanStrategy) IsPluginApplicable ¶
func (s *ServiceScanStrategy) IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
IsPluginApplicable 判断插件是否适用于服务扫描
func (*ServiceScanStrategy) LogPluginInfo ¶
func (s *ServiceScanStrategy) LogPluginInfo()
LogPluginInfo 输出服务扫描插件信息
func (*ServiceScanStrategy) PrepareTargets ¶
func (s *ServiceScanStrategy) PrepareTargets(info Common.HostInfo) []Common.HostInfo
PrepareTargets 准备目标信息
type VScan ¶
type WebScanStrategy ¶
type WebScanStrategy struct{}
WebScanStrategy Web扫描策略
func (*WebScanStrategy) Description ¶
func (s *WebScanStrategy) Description() string
Description 返回策略描述
func (*WebScanStrategy) Execute ¶
func (s *WebScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, wg *sync.WaitGroup)
Execute 执行Web扫描策略
func (*WebScanStrategy) GetPlugins ¶
func (s *WebScanStrategy) GetPlugins() ([]string, bool)
GetPlugins 获取Web扫描插件列表
func (*WebScanStrategy) IsPluginApplicable ¶
func (s *WebScanStrategy) IsPluginApplicable(plugin Common.ScanPlugin, targetPort int, isCustomMode bool) bool
IsPluginApplicable 判断插件是否适用于Web扫描
func (*WebScanStrategy) LogPluginInfo ¶
func (s *WebScanStrategy) LogPluginInfo()
LogPluginInfo 输出Web扫描插件信息
func (*WebScanStrategy) PrepareTargets ¶
func (s *WebScanStrategy) PrepareTargets(baseInfo Common.HostInfo) []Common.HostInfo
PrepareTargets 准备URL目标列表