portscan

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPortTimeoutSynScan     = 1500
	DefaultPortTimeoutConnectScan = 5000

	DefaultRateSynScan     = 2000
	DefaultRateConnectScan = 1500

	DefaultRetriesSynScan     = 3
	DefaultRetriesConnectScan = 3

	ExternalTargetForTune = "8.8.8.8"

	SynScan              = "s"
	ConnectScan          = "c"
	DefaultStatsInterval = 5
)
View Source
const (
	Full        = "1-65535"
	NmapTop100  = "" /* 393-byte string literal not displayed */
	NmapTop1000 = "" /* 3813-byte string literal not displayed */
)

Variables

This section is empty.

Functions

func IPRange

func IPRange(c *net.IPNet) string

IPRange 把 192.168.x.x/xx 转换成 192.168.x.x-192.168.x.x

func ParseIP

func ParseIP(ip string) ([]string, error)

ParseIP 参考 fscan

func ParsePorts

func ParsePorts(options *Options) ([]int, error)

ParsePorts 解析options的ports参数

Types

type Options

type Options struct {
	Stdin      bool     // Stdin specifies whether stdin input was given to the process
	Verify     bool     // Verify is used to check if the ports found were valid using CONNECT method
	Debug      bool     // Prints out debug information
	Retries    int      // Retries is the number of retries for the port Retries 是端口的重试次数
	Rate       int      // Rate is the rate of port scan requests	扫描速率
	Timeout    int      // Timeout is the seconds to wait for ports to respond 超时时间
	Host       []string // Host is the single host or comma-separated list of hosts to find ports for
	Ports      string   // Ports is the ports to use for enumeration
	TopPorts   string   // Tops ports to scan
	SourceIP   string   // SourceIP to use in TCP packets
	Interface  string   // Interface to use for TCP packets
	Threads    int      // Internal worker threads
	ScanAllIPS bool     // Scan all the ips
	ScanType   string   // Scan Type
	Proxy      string   // Socks5 proxy
}

func (*Options) NewRunner

func (o *Options) NewRunner(options *Options) (*Runner, error)

NewRunner 通过解析配置选项、配置来源、阅读列表等创建一个新的 runner 结构体实例

func (*Options) ShowNetworkCapabilities

func (o *Options) ShowNetworkCapabilities(options *Options)

ShowNetworkCapabilities 判断运行用户可能的网络功能/扫描类型

func (*Options) ValidateOptions

func (o *Options) ValidateOptions() error

ValidateOptions validates the configuration options passed

type Runner

type Runner struct {
	Options *Options
	Scanner *scan.Scanner
	// contains filtered or unexported fields
}

func (*Runner) AddTarget

func (r *Runner) AddTarget(targets []string) error

func (*Runner) Close

func (r *Runner) Close()

Close runner instance

func (*Runner) ConnectVerification

func (r *Runner) ConnectVerification()

func (*Runner) GetIPFromUrl

func (r *Runner) GetIPFromUrl(target string) ([]string, error)

GetIPFromUrl 将URL转换为IP地址

func (*Runner) ParseTarget

func (r *Runner) ParseTarget() error

func (*Runner) PickIP

func (r *Runner) PickIP(targets []*net.IPNet, index int64) string

PickIP randomly

func (*Runner) PickPort

func (r *Runner) PickPort(index int) int

PickPort 通过算法随机获取端口

func (*Runner) PickSubnetIP

func (r *Runner) PickSubnetIP(network *net.IPNet, index int64) string

func (*Runner) Run

func (r *Runner) Run() error

Run 真正地扫描程序

func (*Runner) ShowScanResultOnExit

func (r *Runner) ShowScanResultOnExit()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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