portscan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

README

portscan

Go Reference

StealthScan()

  • SYN Scan (known as Stealth Scan). Equal to nmap -sS.
  • Require root
  • Read more: Nmap Doc

ConnectScan()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMaxFD

func GetMaxFD() (int, error)

GetMaxFD returns the maximum number of open file descriptors.

func SuggestTimeout

func SuggestTimeout(n int) time.Duration

SuggestTimeout suggests a global timeout based on the number of ports

Types

type Port

type Port struct {
	Port  int
	State State
}

type Result

type Result []Port

func ConnectScan

func ConnectScan(address string, ports []int, timeout time.Duration) (Result, []error)

ConnectScan uses the basic connect() method to determine if ports are open. address can be a hostname, not limited to IP address. ConnectScan retries the FILTERED ports for once again.

func StealthScan

func StealthScan(ip string, ports []int, timeout time.Duration) (Result, []error)

StealthScan uses syn scan method to scan ports. ip must be a valid IPv4/IPv6 address, not a domain. StealthScan retries the FILTERED ports for once again.

func (*Result) GetPorts

func (r *Result) GetPorts(s State) []Port

func (*Result) GetPortsInt

func (r *Result) GetPortsInt(s State) []int

GetPorts returns the ports from r with state s.

func (*Result) Len

func (r *Result) Len(s State) int

type State

type State uint8
const (
	OPEN State = iota
	CLOSED
	FILTERED
)

func (State) String

func (s State) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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