Documentation ¶
Index ¶
- Constants
- Variables
- func GetFreePort() (uint16, error)
- func GetLocalIP() (string, string)
- func PortToService(descriptivePort string) string
- type Config
- type ReadPacket
- type ScanExecutor
- type ScanResult
- type ScanType
- type Scanner
- func (s *Scanner) PingHost(host string) (*ping.Stats, error)
- func (s *Scanner) Scan(host string, ports []string) ([]*ScanResult, *Stats, []error)
- func (s *Scanner) SweepScan(hosts []string, port string) ([]*SweepScanResult, float64)
- func (s *Scanner) SynScan(ip, port string) (*ScanResult, error)
- func (s *Scanner) TCPScan(ip, port string) (*ScanResult, error)
- func (s *Scanner) UDPScan(ip, port string) (*ScanResult, error)
- func (s *Scanner) VanillaScan(host string) ([]*ScanResult, *Stats, []error)
- type State
- type Stats
- type SweepScanResult
Constants ¶
Variables ¶
View Source
var ( ErrAtLeastOneProtocolMustBeUsed = errors.New("use at least one protocol tpc/udp") ErrICMPResponseDontMatchEchoReply = errors.New("host did not response with echo reply") ErrSynTimedOut = errors.New("syn scan timed out") )
View Source
var DefaultConfig = Config{ Timeout: DefaultTimeout, BackoffLimit: DefaultBackoffLimit, DelayRetry: DefaultDelayRetry, TCP: true, UDP: false, SYN: false, Ping: false, }
Functions ¶
func GetFreePort ¶
func GetLocalIP ¶
func PortToService ¶
Types ¶
type Config ¶
type Config struct { // scan timeout in milliseconds Timeout int // number scan retries BackoffLimit int // Time until a scan is attempted again DelayRetry int // enable tcp scan TCP bool // enable udp scan UDP bool // enable half open connection scan SYN bool // enable ping before scanning Ping bool }
type ReadPacket ¶
type ScanExecutor ¶
type ScanExecutor interface { PingHost(host string) (*ping.Stats, error) SynScan(ip string, port string) (*ScanResult, error) UDPScan(ip, port string) (*ScanResult, error) TCPScan(ip, port string) (*ScanResult, error) Scan(host string, ports []string) ([]*ScanResult, *Stats, []error) VanillaScan(host string) ([]*ScanResult, *Stats, []error) SweepScan(hosts []string, port string) ([]*SweepScanResult, float64) }
func NewScanExecutor ¶
func NewScanExecutor(c *Config, privilegedPing bool) ScanExecutor
type ScanResult ¶
type ScanResult struct { // Rtt(round trip) of a single scan in seconds Rtt float64 // service name Service string // service port Port string // scan state // open when host is ready to accept connection // filtered when host did not return a response/timed out // closed when the host returns icmp type 3 code 13(dst unreachable) or RST packet State State }
type Scanner ¶
func (*Scanner) Scan ¶
Scan scans all the provided ports(tcp,udp and syn if enabled) on the provided host.
func (*Scanner) SweepScan ¶
func (s *Scanner) SweepScan(hosts []string, port string, ) ([]*SweepScanResult, float64)
SweepScan scans port (TCP, UDP and SYN if enabled) on each host from the provided host list.
func (*Scanner) SynScan ¶
func (s *Scanner) SynScan(ip, port string) (*ScanResult, error)
SynScan performs a TCP half-open connection scan.
func (*Scanner) TCPScan ¶
func (s *Scanner) TCPScan(ip, port string) (*ScanResult, error)
TCPScan performs a single tcp scan
func (*Scanner) UDPScan ¶
func (s *Scanner) UDPScan(ip, port string) (*ScanResult, error)
UDPScan performs a single udp scan
func (*Scanner) VanillaScan ¶
func (s *Scanner) VanillaScan(host string) ( []*ScanResult, *Stats, []error, )
VanillaScan scans 0-65535 ports(tcp,udp and syn if enabled).
type SweepScanResult ¶
type SweepScanResult struct { Host string IP string Stats *Stats ScanResults []*ScanResult Errs []error }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.