scanner

package
v0.0.0-...-bb2a896 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllIPs

func GetAllIPs(ipNet *net.IPNet) []net.IP

GetAllIPs returns all IP addresses in a subnet

func GetMACFromIP

func GetMACFromIP(ip string) string

GetMACFromIP attempts to get the MAC address for an IP using TCP/UDP connections

func IsReachable

func IsReachable(ip string) (bool, []int)

IsReachable checks if a host is reachable using various methods

func LookupVendor

func LookupVendor(mac string) string

LookupVendor looks up the vendor for a MAC address

func NormalizeMACAddress

func NormalizeMACAddress(mac string) string

NormalizeMACAddress converts a MAC address to a standard format

Types

type Device

type Device struct {
	IPAddress    string
	Hostname     []string          // Multiple hostnames possible
	MDNSName     string            // mDNS discovered name
	MDNSServices map[string]string // Map of service type to service info
	MACAddress   string
	Vendor       string
	DeviceType   string
	Interface    string
	Status       string // For showing discovery status
	OpenPorts    []int  // Separate ports from status
}

Device represents a discovered network device

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner handles network scanning operations

func NewScanner

func NewScanner(debug bool) *Scanner

NewScanner creates a new scanner instance

func (*Scanner) Close

func (s *Scanner) Close()

Close closes the scanner and its report file

func (*Scanner) GetResults

func (s *Scanner) GetResults() (chan Device, chan bool)

GetResults returns the channels for receiving scan results

func (*Scanner) GetWorkerStats

func (s *Scanner) GetWorkerStats() map[int]WorkerStatus

GetWorkerStats returns a copy of current worker statistics

func (*Scanner) ScanNetwork

func (s *Scanner) ScanNetwork(cidr string, workers int) error

ScanNetwork starts scanning the specified CIDR range

func (*Scanner) Stop

func (s *Scanner) Stop()

Stop signals the scanner to stop

type WorkerStatus

type WorkerStatus struct {
	StartTime  time.Time
	LastSeen   time.Time
	CurrentIP  string
	State      string
	IPsFound   int32
	IPsScanned int32
	TotalIPs   int32
	SentCount  int32 // Track IPs sent to workers
}

WorkerStatus tracks the status of each worker goroutine

Jump to

Keyboard shortcuts

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