Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // AllPorts - Convinience var for full port range AllPorts = PortRange{1, 65535} )
Functions ¶
func ExpandCIDR ¶
ExpandCIDR - Util function for expanding a CIDR into a list of IPs
func ScanHosts ¶
func ScanHosts(hosts []string, opts ScanOpts, handler ScanResultHandler) error
ScanHosts - Perform scan on a list of hosts. hosts - list of host to scan concurrency - number of simultaneous requests timeout - request timeout for Connect Scan hanlder - port scan result callback, result for each port scanned is passed back in the handler, note that handler can be called concurrently
Types ¶
type HostPortStatus ¶
type HostPortStatus struct { Host string Port int Scan ScanType Status PortStatus }
HostPortStatus - Decriptor for the status of port on a particular host
type HostScanner ¶
type HostScanner struct { // Host Address Host string // Host IP IP net.IP // Port range to scan Range PortRange // Throttle for overall concurrency Gate chan int // RTT Timout Timeout time.Duration // Use SYNScan instead of Connect Scan for TCP scan SYNScan bool }
HostScanner - struct used to store information needed to scan a particular
host
func NewHostScanner ¶
func NewHostScanner(host string, portRange PortRange) (*HostScanner, error)
NewHostScanner - Create a new scanner for a host host - hostname/ip address portRange - range of ports to scan
func (*HostScanner) Scan ¶
func (hs *HostScanner) Scan(handler ScanResultHandler) error
Scan the ports for the current HostScanner handler - callback for each port scanned
type PortRange ¶
type PortRange struct {
Start, End int
}
PortRange - Used for specifying a port range
type PortStatus ¶
type PortStatus int
PortStatus - Type for describing Status for a port
const ( // PSOpen - Port is open PSOpen PortStatus = iota // PSClose - Port is closed PSClose // PSTimeout - Port timed out PSTimeout // PSError - Other errors when trying connect PSError )
func (PortStatus) String ¶
func (ps PortStatus) String() string
type ScanOpts ¶
type ScanOpts struct { // Max number of concurrent requests Concurrency int // Amount of time to wait for a response Timeout time.Duration // Port Range to scan Range PortRange // use SYN Scan instead of ConnectScan SYNScan bool }
ScanOpts - struct for aggregating differen scan options
type ScanResultHandler ¶
type ScanResultHandler func(*HostPortStatus)
ScanResultHandler - function type for callback used to handle results