drive

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Masscan

type Masscan struct {
	// Args are masscan arguments placed before the target specs (e.g. "-p1-65535", "--rate=10000").
	Args []string
	// BinaryPath overrides the masscan binary location; empty uses $PATH.
	BinaryPath string
}

Masscan drives the masscan port scanner. masscan emits nmap-compatible XML (-oX), so its output folds into the model through the very same scan/nmap parser the Nmap driver's hosts flow through — the driver just execs masscan, appends `-oX <tmpfile>`, and on exit parses that file into per-host Results. Progress is read best-effort from masscan's stderr ("… N.NN% done").

Unlike Nmap (which drives the AIMS-native fork with a live host stream), masscan writes its XML only at completion, so hosts surface as one batch when the scan ends; the stderr percent keeps a foreground scan's display alive in the meantime.

func (Masscan) Scan

func (m Masscan) Scan(ctx context.Context, targets []*scanpb.Target, args ...string) (
	<-chan *scanpb.Result, <-chan *scanpb.TaskProgress, <-chan string, <-chan error, error,
)

type Nmap

type Nmap struct {
	// Args are nmap arguments placed before the target specs (e.g. "-sV", "-p1-1000").
	Args []string
	// BinaryPath overrides the nmap binary location; empty uses $PATH.
	BinaryPath string
}

Nmap is the reference Scanner, driving the AIMS-native nmap fork. Each host nmap reports is surfaced as a Result carrying that host (Result.Host) as it is found, so the downstream fold enriches the very objects the targets were derived from while the scan is still running.

func (Nmap) Scan

func (n Nmap) Scan(ctx context.Context, targets []*scanpb.Target, args ...string) (
	<-chan *scanpb.Result, <-chan *scanpb.TaskProgress, <-chan string, <-chan error, error,
)

type Nuclei added in v0.3.0

type Nuclei struct {
	// Args are nuclei arguments placed before the target specs (e.g. "-severity", "high").
	Args []string
	// BinaryPath overrides the nuclei binary location; empty uses $PATH.
	BinaryPath string
}

Nuclei drives the nuclei vulnerability scanner (github.com/projectdiscovery/nuclei). Unlike masscan (which writes XML only at completion), nuclei streams one JSON finding per line to stdout as it runs, so this driver emits Results LIVE — each finding folds into the host tree while the scan is still going, the same shape as the nmap driver's live host stream but from a plain exec (no fork).

Each finding is mapped by ingest.FindingToResult — the exact same code the nuclei Ingestor uses for `scan import` — so a streamed scan and an imported file fold byte-identically (as the masscan driver reuses the nmap XML parser). nuclei is a finding scanner, not a port scanner: results enrich existing hosts with severity-tagged NSE-style evidence rather than discovering new hosts.

func (Nuclei) Scan added in v0.3.0

func (n Nuclei) Scan(ctx context.Context, targets []*scanpb.Target, args ...string) (
	<-chan *scanpb.Result, <-chan *scanpb.TaskProgress, <-chan string, <-chan error, error,
)

type Scanner

type Scanner interface {
	// Scan runs the tool against targets (plus any extra tool arguments) and returns four
	// channels plus a launch error:
	//   - results:  Results to fold (Run.AddResult), closed when the scan ends;
	//   - progress: TaskProgress to display, closed when the scan ends;
	//   - warnings: the tool's live, non-fatal notices (nmap stderr lines such as "giving up on
	//               port ... retransmission cap hit") as they are emitted, closed when the scan ends.
	//               Best-effort and raw: classification/typing is the caller's concern (a long scan
	//               that is plainly busy should not look silent). A driver with no live notice stream
	//               returns an already-closed channel.
	//   - errc:     the scan's TERMINAL outcome — at most one value then closed. nil means the
	//               tool completed cleanly; a non-nil error is a failure the tool signalled AFTER
	//               launch (e.g. nmap "requires root privileges. QUITTING!", a resolve failure, a
	//               non-zero exit). Drain it AFTER results/progress close.
	//   - err:      a synchronous LAUNCH error (bad args, binary missing) — the scan never started,
	//               and results/progress/warnings/errc are all nil.
	//
	// Splitting launch (err) from terminal (errc) is the whole point: a tool that starts and then
	// dies mid-flight had, until now, nowhere to report that — so the run was misread as a success.
	Scan(ctx context.Context, targets []*scanpb.Target, args ...string) (
		results <-chan *scanpb.Result,
		progress <-chan *scanpb.TaskProgress,
		warnings <-chan string,
		errc <-chan error,
		err error,
	)
}

Scanner drives a tool against AIMS-selected targets and streams results back. It is the in-process form of the substrate; the server-side streaming RPC (SCAN.md Part C, Phase 4) puts the same surface behind the teamserver so foreground and detached scans share one path.

Jump to

Keyboard shortcuts

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