discovery

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 21 Imported by: 7

Documentation

Index

Constants

View Source
const Label = "Discovery"

Variables

This section is empty.

Functions

func CheckSetup

func CheckSetup(nmapDir, nmapPath string) error

CheckSetup checks whether Setup() executed accordingly. Scan arguments should be checked by the scanner.

func InitInventories

func InitInventories(logger utils.Logger, config map[string]map[string]string) error

func QueryInterfaces

func QueryInterfaces(target string) (string, []string, error)

QueryInterfaces connects to a remote host via RPC to query its hostname and network interfaces

func Setup

func Setup(logger utils.Logger, nmapDir string, nmapPath string) error

Setup configures the environment accordingly, if the scan module has some special requirements. A successful setup is required before a scan can be started.

Types

type DCERPCTransport

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

type Host

type Host struct {
	Ip              string
	DnsName         string
	OtherNames      []string
	OtherIps        []string
	Hops            []string // Traceroute hops to the target host
	OsGuesses       []string
	OsSmb           string
	LastBoot        time.Time
	Uptime          time.Duration
	DetectionReason string // Reason why Nmap considers this host "up"
	AdminUsers      []string
	RdpUsers        []string
	Services        []Service // mapping port to Service result
	Scripts         []Script  // list of Script results

	Company    string // Optional attribute that could be filled by the agent with asset inventory information
	Department string // Optional attribute that could be filled by the agent with asset inventory information
	Owner      string // Optional attribute that could be filled by the agent with asset inventory information
	Critical   bool   // Optional attribute that could be filled by the agent with asset inventory information

	Ad *active_directory.Ad
}

type Inventory

type Inventory interface {
	Init(logger utils.Logger, conf map[string]map[string]string) error
	Initialized() bool
	ByIp(logger utils.Logger, ip string) (company string, department string, owner string, hostnames []string, ips []string, critical bool, err error)
	ByFqdn(logger utils.Logger, hostname string, expectedIps []string) (company string, department string, owner string, hostnames []string, ips []string, critical bool, err error)
}

type Result

type Result struct {
	Data      []*Host
	Status    string // Final scan status (success or graceful error). Should be stored along with the scan results.
	Exception bool   // Indicates if something went wrong badly and results shall be discarded. This should never be

}

type Scanner

type Scanner struct {
	Label    string
	Started  time.Time
	Finished time.Time
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(
	logger utils.Logger,
	targets []string,
	nmapPath string,
	nmapArgs []string,
	nmapVersionAll bool,
	nmapBlacklist []string,
	nmapBlacklistFile string,
	domainOrder []string,
	ldapServer string,
	ldapDomain string,
	ldapUser string,
	ldapPassword string,
	disableGssapi bool,
	excludeDomains []string,
	dialTimeout time.Duration,
) (*Scanner, error)

func (*Scanner) Run

func (s *Scanner) Run(timeout time.Duration) (res *Result)

Run starts scan execution. This must either be executed as a goroutine, or another thread must be active listening on the scan's result channel, in order to avoid a deadlock situation. The timeout argument is optional and allows cancelling the scan after a given duration. This timeout is intended for dry runs only. For actual scan timeouts, use appropriate Nmap arguments instead.

type Script

type Script struct {
	Type     string
	Port     int
	Protocol string
	Name     string
	Result   string
}

type ServerAlive2Response

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

type Service

type Service struct {
	Port       int
	Protocol   string
	Name       string // ATTENTION: Nmap sometimes uses the tunnel attribute (XML output) to indicate an encrypted service port.
	Tunnel     string // ATTENTION: Nmap sometimes describes a service like "https" as "http" in combination with the tunnel attribute set to "SSL"!
	Product    string
	Version    string
	DeviceType string
	Flavor     string
	Cpes       []string // "Common Platform Enumeration" describes platform indicated by the Service
	Info       string
	Method     string // Detection method used by Nmap
	Ttl        int    // TTL to Service. If host has ports with different TTL there might be port forwarding active
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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