runner

package
v0.0.0-...-74ba35b Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPortTimeoutSynScan     = time.Second
	DefaultPortTimeoutConnectScan = 3 * time.Second

	DefaultRateSynScan     = 1000
	DefaultRateConnectScan = 1500
	DefaultHostConcurrency = 1500

	DefaultRetriesSynScan     = 1
	DefaultRetriesConnectScan = 1

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

List of default ports

Variables

This section is empty.

Functions

func DoHealthCheck

func DoHealthCheck(options *Options, flagSet *goflags.FlagSet) string

func ParsePorts

func ParsePorts(options *Options) ([]*port.Port, error)

ParsePorts parses the list of ports and creates a port map

func ShowNetworkCapabilities

func ShowNetworkCapabilities(options *Options)

ShowNetworkCapabilities shows the network capabilities/scan types possible with the running user

func ShowNetworkInterfaces

func ShowNetworkInterfaces() error

func WriteCsvOutput

func WriteCsvOutput(host, ip string, ports []*port.Port, header bool, writer io.Writer) error

WriteCsvOutput writes the output list of subdomain in csv format to an io.Writer

func WriteHostOutput

func WriteHostOutput(host string, ports []*port.Port, writer io.Writer) error

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

func WriteJSONOutput

func WriteJSONOutput(host, ip string, ports []*port.Port, writer io.Writer) error

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

Types

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
	Silent         bool // Silent suppresses any extra text and only writes found host:port to screen
	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
	Debug          bool // Prints out debug information
	InterfacesList bool // InterfacesList show interfaces list

	Retries            int                 // Retries is the number of retries for the port
	Rate               int                 // Rate is the rate of port scan requests
	PerHostConcurrency int                 // PerHostConcurrency is the max number of concurrent port scan requests for each host
	Timeout            time.Duration       // Timeout is the milliseconds to wait for ports to respond
	WarmUpTime         int                 // WarmUpTime between scan phases
	Host               goflags.StringSlice // Host is the single host or comma-separated list of hosts to find ports for
	Output             string              // Output is the file to write found ports to.
	Ports              string              // Ports is the ports to use for enumeration
	TopPorts           string              // Tops ports to scan
	Interface          string              // Interface to use for TCP packets
	ConfigFile         string              // Config file contains a scan configuration
	Threads            int                 // Internal worker threads
	IPVersion          goflags.StringSlice // IP Version to use while resolving hostnames
	ScanType           string              // Scan Type
	Proxy              string              // Socks5 proxy
	ProxyAuth          string              // Socks5 proxy authentication (username:password)
	Resolvers          string              // Resolvers (comma separated or file)

	OnResult         result.ResultCallback // callback on final host result
	OnReceive        result.ResultCallback // callback on response receive
	CSV              bool
	HealthCheck      bool
	TcpSynPingProbes goflags.StringSlice
	TcpAckPingProbes goflags.StringSlice
	// UdpPingProbes               goflags.StringSlice - planned
	// STcpInitPingProbes          goflags.StringSlice - planned
	IcmpEchoRequestProbe        bool
	IcmpTimestampRequestProbe   bool
	IcmpAddressMaskRequestProbe bool
	// IpProtocolPingProbes        goflags.StringSlice - planned
	ArpPing                   bool
	IPv6NeighborDiscoveryPing bool
	// HostDiscoveryIgnoreRST      bool - planned
	InputReadTimeout time.Duration
	// ReversePTR lookup for ips
	ReversePTR bool
	// 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

func (*Options) ConfigureOutput

func (options *Options) ConfigureOutput()

ConfigureOutput configures the output on the screen

func (*Options) GetTimeout

func (options *Options) GetTimeout() time.Duration

func (*Options) ShouldScanIPv4

func (options *Options) ShouldScanIPv4() bool

func (*Options) ShouldScanIPv6

func (options *Options) ShouldScanIPv6() bool

func (*Options) ValidateOptions

func (options *Options) ValidateOptions() error

ValidateOptions validates the configuration options passed

type Result

type Result struct {
	Host      string    `json:"host,omitempty" csv:"host"`
	IP        string    `json:"ip,omitempty" csv:"ip"`
	Port      int       `json:"port,omitempty" csv:"port"`
	Protocol  string    `json:"protocol,omitempty" csv:"protocol"`
	Label     string    `json:"label"`
	TimeStamp time.Time `json:"timestamp,omitempty" csv:"timestamp"`
}

Result contains the result for a host

func (*Result) CSVFields

func (r *Result) CSVFields() ([]string, error)

func (*Result) CSVHeaders

func (r *Result) CSVHeaders() ([]string, error)

func (*Result) JSON

func (r *Result) JSON() ([]byte, error)

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(ctx context.Context)

func (*Runner) Close

func (r *Runner) Close()

Close runner instance

func (*Runner) ConnectVerification

func (r *Runner) ConnectVerification()

func (*Runner) GetTargetIps

func (r *Runner) GetTargetIps(ipsCallback func() []*net.IPNet) (targets, targetsV4, targetsV6 []*net.IPNet, err error)

func (*Runner) IPs

func (r *Runner) IPs() *ipranger.IPRanger

func (*Runner) LoadTargets

func (r *Runner) LoadTargets(targets []string) 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) *port.Port

func (*Runner) PickSubnetIP

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

func (*Runner) RawSocketEnumeration

func (r *Runner) RawSocketEnumeration(ctx context.Context, ip string, p *port.Port)

func (*Runner) RunEnumeration

func (r *Runner) RunEnumeration(pctx context.Context) error

RunEnumeration runs the ports enumeration flow on the targets specified

func (*Runner) SetInterface

func (r *Runner) SetInterface(interfaceName string) error

func (*Runner) SetSourceIP

func (r *Runner) SetSourceIP(sourceIP string) error

func (*Runner) ShowScanResultOnExit

func (r *Runner) ShowScanResultOnExit()

func (*Runner) Stats

func (r *Runner) Stats() clistats.StatisticsClient

type Target

type Target struct {
	Ip   string
	Cidr string
	Fqdn string
	Port string
}

Jump to

Keyboard shortcuts

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