vscan

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...interface{})

verbose > 3

func DecodeData

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

func DecodePattern

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

解析 nmap-service-probes 中匹配规则字符串,转换成 golang 中可以进行编译的字符串

  e.g.
	(1) pattern: \0\xffHi
		decoded: []byte{0, 255, 72, 105} 4len

	(2) pattern: \\0\\xffHI
		decoded: []byte{92, 0, 92, 120, 102, 102, 72, 105} 8len

	(3) pattern: \x2e\x2a\x3f\x2b\x7b\x7d\x28\x29\x5e\x24\x7c\x5c
		decodedStr: \.\*\?\+\{\}\(\)\^\$\|\\

func Error

func Error(v ...interface{})

verbose > 0

func Info

func Info(v ...interface{})

verbose > 2

func Warn

func Warn(v ...interface{})

verbose > 1

Types

type Config

type Config struct {
	Rarity int

	SendTimeout time.Duration
	ReadTimeout time.Duration

	NULLProbeOnly bool
	UseAllProbes  bool
	SSLAlwaysTry  bool
}

VScan 探测时的参数配置

type Details

type Details struct {
	ProbeName     string `json:"probe_name"`
	ProbeData     string `json:"probe_data"`
	MatchMatched  string `json:"match_matched"`
	IsSoftMatched bool   `json:"soft_matched"`
}

详细的结果数据(包含具体的 Probe 和匹配规则信息)

type Directive

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

type Extras

type Extras struct {
	VendorProduct   string `json:"vendor_product,omitempty"`
	Version         string `json:"version,omitempty"`
	Info            string `json:"info,omitempty"`
	Hostname        string `json:"hostname,omitempty"`
	OperatingSystem string `json:"operating_system,omitempty"`
	DeviceType      string `json:"device_type,omitempty"`
	CPE             string `json:"cpe,omitempty"`
}

对应 NMap versioninfo 信息

type Match

type Match struct {
	IsSoft bool

	Service     string
	Pattern     string
	VersionInfo string

	PatternCompiled *regexp.Regexp
}

nmap-service-probes 中每一条规则

func (*Match) MatchPattern

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

对获取到的 Banner 进行匹配

func (*Match) ParseVersionInfo

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

type Probe

type Probe struct {
	Name     string
	Data     string
	Protocol string

	Ports    string
	SSLPorts string

	TotalWaitMS  int
	TCPWrappedMS int
	Rarity       int
	Fallback     string

	Matchs *[]Match
}

探针规则,包含该探针规则下的服务匹配条目和其他探测信息

func (*Probe) ContainsPort

func (p *Probe) ContainsPort(testPort int) bool

func (*Probe) ContainsSSLPort

func (p *Probe) ContainsSSLPort(testPort int) bool

type ProbesRarity

type ProbesRarity []Probe

ProbesRarity 用于使用 sort 对 Probe 对象按 Rarity 属性值进行排序

func (ProbesRarity) Len

func (ps ProbesRarity) Len() int

func (ProbesRarity) Less

func (ps ProbesRarity) Less(i, j int) bool

func (ProbesRarity) Swap

func (ps ProbesRarity) Swap(i, j int)

type Result

type Result struct {
	Target
	Service `json:"service"`

	Timestamp int32  `json:"timestamp"`
	Error     string `json:"error"`
}

输出的结果数据

type Service

type Service struct {
	Target

	Name        string `json:"name"`
	Protocol    string `json:"protocol"`
	Banner      string `json:"banner"`
	BannerBytes []byte `json:"banner_bytes"`

	Extras  `json:"extras"`
	Details `json:"details"`
}

获取的端口服务信息

type Target

type Target struct {
	IP       string `json:"ip"`
	Port     int    `json:"port"`
	Protocol string `json:"protocol"`
}

待探测的目标端口

func (*Target) GetAddress

func (t *Target) GetAddress() string

type VScan

type VScan struct {
	Exclude string

	Probes []Probe

	ProbesMapKName map[string]Probe
}
var Vs *VScan

func (*VScan) Check

func (v *VScan) Check(protocol, host string, port int) (string, string, string)

func (*VScan) Explore

func (v *VScan) Explore(target Target, config *Config) (Result, error)

VScan 探测目标端口函数,返回探测结果和错误信息 1. probes ports contains port 2. probes sslports contains port 3. probes ports contains port use ssl try to

func (*VScan) Init

func (v *VScan) Init()

从文件中解析并加载 Probes 初始化 VScan 实例

type Worker

type Worker struct {
	In     chan Target
	Out    chan Result
	Config *Config
}

func (*Worker) Start

func (w *Worker) Start(v *VScan, wg *sync.WaitGroup)

Jump to

Keyboard shortcuts

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