Documentation
¶
Index ¶
- func DiscoverActiveHosts(hosts []string, timeout time.Duration, numWorkers int) []string
- func DiscoverActiveHostsWithOptions(hosts []string, opts DiscoveryOptions) []string
- func ExpandCIDR(cidr string) ([]string, error)
- func FormatCIDRInfo(target string) (string, int, error)
- func GetTop1000Ports() []int
- func IsCIDR(target string) bool
- func ParseTargets(target string) ([]string, error)
- type DiscoveryOptions
- type PortManager
- type ScanConfig
- type ScanResult
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverActiveHosts ¶
DiscoverActiveHosts performs a quick host discovery on a CIDR range It attempts to connect to common ports (443, 80, 22, 445, 3306) to determine if hosts are active
func DiscoverActiveHostsWithOptions ¶
func DiscoverActiveHostsWithOptions(hosts []string, opts DiscoveryOptions) []string
DiscoverActiveHostsWithOptions performs host discovery using configurable probe ports and concurrency.
func ExpandCIDR ¶
ExpandCIDR expands a CIDR notation to a list of IPs
func FormatCIDRInfo ¶
FormatCIDRInfo returns a human-readable description of what will be scanned
func GetTop1000Ports ¶
func GetTop1000Ports() []int
GetTop1000Ports returns the top 1000 most commonly used ports
func ParseTargets ¶
ParseTargets parses target(s) which can be single IP, multiple IPs, or CIDR notation Format: "192.168.1.1" or "192.168.1.0/24" or "192.168.1.1,192.168.1.5"
Types ¶
type DiscoveryOptions ¶
DiscoveryOptions controls CIDR host discovery behavior.
type PortManager ¶
type PortManager struct {
// contains filtered or unexported fields
}
PortManager handles port parsing and service mapping
func NewPortManager ¶
func NewPortManager() *PortManager
NewPortManager creates a new PortManager instance
func (*PortManager) GetPortsToScan ¶
func (pm *PortManager) GetPortsToScan(portsStr string) ([]int, error)
GetPortsToScan returns the list of ports to scan based on the specification
func (*PortManager) GetServiceName ¶
func (pm *PortManager) GetServiceName(port int, bannerService string) string
GetServiceName returns the service name for a given port
func (*PortManager) ParsePorts ¶
func (pm *PortManager) ParsePorts(portsStr string) ([]int, error)
ParsePorts parses a port specification string
type ScanConfig ¶
type ScanConfig struct {
NumWorkers int
Rate int
Timeout time.Duration
Retries int
AdaptiveTimeout bool
BackoffBase time.Duration
MaxTimeout time.Duration
RandomAgent bool
RandomIP bool
TargetCIDR string
}
ScanConfig contains runtime tuning controls for robust scans.
type ScanResult ¶
type ScanResult struct {
Port int `json:"port"`
IsOpen bool `json:"open"`
ServiceName string `json:"service,omitempty"`
Version string `json:"version,omitempty"`
Latency time.Duration `json:"-"`
LatencyMs int64 `json:"latency_ms,omitempty"`
Confidence string `json:"confidence,omitempty"`
Evidence string `json:"evidence,omitempty"`
DetectionPath string `json:"detection_path,omitempty"`
}
ScanResult holds the result of a single port scan
type Scanner ¶
type Scanner struct {
Host string
NumWorkers int
Rate int
Timeout time.Duration
Retries int
AdaptiveTimeout bool
BackoffBase time.Duration
BackoffMax time.Duration
MinAdaptiveTimeout time.Duration
MaxAdaptiveTimeout time.Duration
PortManager *PortManager
GhostMode bool
RandomAgent bool
RandomIP bool
// contains filtered or unexported fields
}
Scanner handles the port scanning logic
func NewScanner ¶
NewScanner creates a new Scanner instance
func (*Scanner) Configure ¶
func (s *Scanner) Configure(cfg ScanConfig)
Configure overrides scanner defaults with validated values.