portfinger

package
v1.8.40 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeData

func DecodeData(s string) ([]byte, error)

DecodeData socket发送探测数据包编码

func DecodePattern

func DecodePattern(s string) ([]byte, error)

DecodePattern 解析探针数据包

func GetAddress

func GetAddress(ip, port string) string

GetAddress 组合host

func IsExclude

func IsExclude(m []int, value int) bool

Types

type Address

type Address struct {
	IP   string
	Port string
}

type Directive

type Directive struct {
	DirectiveName string
	Flag          string
	Delimiter     string
	DirectiveStr  string
}

Directive 定义探针probe说明字段

type Engine

type Engine struct {
	Scanner *NmapProbe
	Proxy   string
}

func NewEngine

func NewEngine(proxy string, scanner *NmapProbe) (*Engine, error)

func (*Engine) Run

func (e *Engine) Run(targets map[string][]int) []*Result

type Extras

type Extras struct {
	ServiceName     string
	VendorProduct   string
	Version         string
	Info            string
	Hostname        string
	OperatingSystem string
	DeviceType      string
	CPE             string
	Sign            string
}

Extras 探针匹配成功解析数据

type Match

type Match struct {
	IsSoft          bool
	Service         string
	Pattern         string
	VersionInfo     string
	PatternCompiled *regexp.Regexp
}

func (*Match) MatchPattern

func (m *Match) MatchPattern(response []byte) (matched bool)

MatchPattern 正则匹配respone内容

func (*Match) ParseVersionInfo

func (m *Match) ParseVersionInfo(response []byte) Extras

ParseVersionInfo 正则匹配respone成功,取出相应的内容

type NmapProbe

type NmapProbe struct {
	Probes         []*Probe
	ProbesMapKName map[string]*Probe // 以探针名为key对应Probe
}

对nmap指纹库进行解析

func (*NmapProbe) Count

func (N *NmapProbe) Count() int

Count 统计指纹库中正则条数

func (*NmapProbe) Init

func (N *NmapProbe) Init(nmapData []byte) error

Init nmap指纹库初始化

func (*NmapProbe) ResultSocket

func (N *NmapProbe) ResultSocket(address, proxyAddr string, Indexes, SocketTimeout int, ResultChan chan *Result)

ResultSocket 识别端口服务指纹

func (*NmapProbe) ScanWithProbe

func (N *NmapProbe) ScanWithProbe(host, port, proxyAddr string, SocketTimeout int) *Result

ScanWithProbe 单端口 指纹探测

type Probe

type Probe struct {
	Name     string              // 探针名称
	Ports    []map[string]string // 该探针默认端口
	Data     []byte              // socket发送的数据
	Fallback string              // 如果探针匹配项没有匹配到,则使用Fallback指定的探针作为备用
	Matchs   []*Match            // 正则协议内容
	Rarity   int                 // 指纹探测等级
}

type Result

type Result struct {
	Addr          string
	ServiceName   string
	ProbeName     string
	VendorProduct string
	Version       string
}

Result 定义返回结果

Jump to

Keyboard shortcuts

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