runner

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPortTimeoutSynScan     = 1000
	DefaultPortTimeoutConnectScan = 5000

	DefaultRateSynScan     = 1000
	DefaultRateConnectScan = 1500

	DefaultRetriesSynScan     = 3
	DefaultRetriesConnectScan = 3

	ExternalTargetForTune = "8.8.8.8"

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

List of default ports

View Source
const Version = `2.0.5`

Version is the current version of naabu

Variables

View Source
var Naabuipports = make(map[string]map[int]struct{})

Functions

func ParsePorts

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

ParsePorts parses the list of ports and creates a port map

func WriteHostOutput

func WriteHostOutput(host string, ports map[int]struct{}, writer io.Writer) error

WriteHostOutput writes the output list of host ports to an io.Writer

func WriteJSONOutput

func WriteJSONOutput(host, ip string, ports map[int]struct{}, writer io.Writer) error

WriteJSONOutput writes the output list of subdomain in JSON to an io.Writer

Types

type JSONResult

type JSONResult struct {
	Host string `json:"host,omitempty"`
	IP   string `json:"ip,omitempty"`
	Port int    `json:"port"`
}

JSONResult contains the result for a host in JSON format

type OnResultCallback

type OnResultCallback func(string, string, []int)

OnResultCallback (hostname, ip, ports)

type Options

type Options struct {
	Verbose           bool // Verbose flag indicates whether to show verbose output or not
	NoColor           bool // No-Color disables the colored output
	JSON              bool // JSON specifies whether to use json for output format or text file
	Silent            bool // Silent suppresses any extra text and only writes found host:port to screen
	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
	Version           bool // Version specifies if we should just show version and exit
	Ping              bool // Ping uses ping probes to discover fastest active host and discover dead hosts
	Debug             bool // Prints out debug information
	ExcludeCDN        bool // Excludes ip of knows CDN ranges for full port scan
	Nmap              bool // Invoke nmap detailed scan on results
	InterfacesList    bool // InterfacesList show interfaces list
	SkipAdminBrute    bool
	Proxy             string
	LocalJndiAddress  string
	CeyeApi           string
	CeyeDomain        string
	Retries           int    // Retries is the number of retries for the port
	Rate              int    // Rate is the rate of port scan requests
	Timeout           int    // Timeout is the seconds to wait for ports to respond
	WarmUpTime        int    // WarmUpTime between scan phases
	Host              string // Host is the host to find ports for
	HostsFile         string // HostsFile is the file containing list of hosts to find port for
	Output            string // Output is the file to write found ports to.
	Ports             string // Ports is the ports to use for enumeration
	PortsFile         string // PortsFile is the file containing ports to use for enumeration
	ExcludePorts      string // ExcludePorts is the list of ports to exclude from enumeration
	ExcludeIps        string // Ips or cidr to be excluded from the scan
	ExcludeIpsFile    string // File containing Ips or cidr to exclude from the scan
	TopPorts          string // Top Ports to scan (full/http/top-100/top-1000,default http)
	SourceIP          string // SourceIP to use in TCP packets
	Interface         string // Interface to use for TCP packets
	ConfigFile        string // Config file contains a scan configuration
	NmapCLI           string // Nmap command (has priority over config file)
	Threads           int    // Internal worker threads
	EnableProgressBar bool   // Enable progress bar
	ScanAllIPS        bool   // Scan all the ips
	ScanType          string // Scan Type
	Resolvers         string // Resolvers (comma separated or file)

	OnResult OnResultCallback // OnResult callback
	// contains filtered or unexported fields
}

Options contains the configuration options for tuning the port enumeration process. nolint:maligned // just an option structure

func ParseOptions

func ParseOptions() *Options

ParseOptions parses the command line flags provided by a user

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner is an instance of the port enumeration client used to orchestrate the whole process.

func NewRunner

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

NewRunner creates a new runner struct instance by parsing the configuration options, configuring sources, reading lists, etc

func (*Runner) AddTarget

func (r *Runner) AddTarget(target string) error

func (*Runner) BackgroundWorkers

func (r *Runner) BackgroundWorkers()

func (*Runner) Close

func (r *Runner) Close()

Close runner instance

func (*Runner) ConnectVerification

func (r *Runner) ConnectVerification()

func (*Runner) Load

func (r *Runner) Load() 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

func (*Runner) PickSubnetIP

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

func (*Runner) PreProcessTargets

func (r *Runner) PreProcessTargets() error

func (*Runner) RawSocketEnumeration

func (r *Runner) RawSocketEnumeration(ip string, port int)

func (*Runner) RunEnumeration

func (r *Runner) RunEnumeration() error

RunEnumeration runs the ports enumeration flow on the targets specified

func (*Runner) SetSourceIPAndInterface

func (r *Runner) SetSourceIPAndInterface() error

Jump to

Keyboard shortcuts

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