portscan

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT 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, global, read time.Duration) (Result, []error)

ip must be a valid IPv4/IPv6 address, not a domain. StealthScan retries the FILTERED ports for once again. StealthScan has two timeout: One is the global timeout, which is set to stop reading packets after X time. Second is the read timeout, which is set to terminate reading from socket after X time, if no packe read. Read timeout is useful if (for example) the global timeout is 10 sec, but no packet arrive after 2 sec, so you dont have to wait for the remaining 8 sec.

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