Documentation
¶
Overview ¶
Package runtools embeds ProjectDiscovery scanners (tlsx, dnsx, httpx, naabu, nuclei) as Go SDK calls. Each function writes JSONL output matching the corresponding CLI's format.
Index ¶
- func InitNucleiProcess()
- func RaiseFileLimit()
- func RunDnsx(ctx context.Context, hosts []string, opts DnsxOptions) (string, error)
- func RunHttpx(ctx context.Context, targets []string, opts HttpxOptions) (string, []string, error)
- func RunNaabu(ctx context.Context, hosts []string, opts NaabuOptions) (string, error)
- func RunNuclei(ctx context.Context, opts NucleiOptions) (string, error)
- func RunTlsx(ctx context.Context, targets []string, opts TlsxOptions) (string, error)
- func SilenceSDKLoggers()
- func SystemChromePath() (string, bool)
- func UpdateNucleiTemplates() error
- type DnsxOptions
- type HttpxOptions
- type NaabuOptions
- type NucleiOptions
- type TlsxOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitNucleiProcess ¶
func InitNucleiProcess()
InitNucleiProcess flips nuclei's package-level globals once. These are process-wide, so per-scan toggling risks a write race with concurrent scans.
func RaiseFileLimit ¶
func RaiseFileLimit()
RaiseFileLimit raises RLIMIT_NOFILE soft as high as the kernel accepts. On macOS rl.Max is often RLIM_INFINITY but setrlimit is capped by kern.maxfilesperproc, so probe a ladder of decreasing values.
func RunDnsx ¶
RunDnsx resolves every hostname in hosts and writes one JSON DNSData per line to opts.OutputFile. Per-host errors are logged at DEBUG and skipped.
func RunHttpx ¶
RunHttpx probes every target and writes one JSON Result per line to opts.OutputFile. Returns the output path and the URLs of successful probes.
func RunNaabu ¶
RunNaabu scans every target and writes one "host:port" line per open port to opts.OutputFile.
func RunNuclei ¶
func RunNuclei(ctx context.Context, opts NucleiOptions) (string, error)
RunNuclei runs nuclei via the embedded SDK and writes one JSON ResultEvent per finding to opts.OutputFile.
func RunTlsx ¶
RunTlsx scans every target and writes one JSON Response per reachable host to opts.OutputFile. Targets may be bare hosts or "host:port". Per-target errors are logged and skipped, not surfaced.
func SilenceSDKLoggers ¶
func SilenceSDKLoggers()
SilenceSDKLoggers routes gologger output to a discard sink. httpx and naabu SDKs write per-result lines via gologger.Silent() and ignore their own DisableStdout options. Call once at startup before any scanner runs.
func SystemChromePath ¶
SystemChromePath returns the resolved system browser path and whether one was found, so callers can log which browser the embedded scanners will use.
func UpdateNucleiTemplates ¶
func UpdateNucleiTemplates() error
UpdateNucleiTemplates installs nuclei-templates if missing, otherwise updates them. Idempotent.
Types ¶
type DnsxOptions ¶
type DnsxOptions struct {
// OutputFile receives one JSON DNSData per line. Required.
OutputFile string
Concurrency int
Retries int
Resolvers []string
// QueryAll requests every record type (A/AAAA/CNAME/MX/...) instead of A only.
QueryAll bool
}
DnsxOptions configures an embedded dnsx scan.
type HttpxOptions ¶
type HttpxOptions struct {
// OutputFile receives one JSON Result per line. Required.
OutputFile string
Concurrency int
Timeout time.Duration
Screenshot bool
// ScreenshotTimeout bounds each headless screenshot.
ScreenshotTimeout time.Duration
// DisableStdout suppresses httpx's per-result stdout writes.
DisableStdout bool
StoreResponseDir string
}
HttpxOptions configures an embedded httpx scan.
type NaabuOptions ¶
type NaabuOptions struct {
// OutputFile receives one "host:port" line per open port. Required.
OutputFile string
// Ports is the control-plane port spec: "top-<N>" (e.g. "top-100"), "full",
// or a literal list/range ("80,443", "1-1000"). Empty uses naabu's default.
Ports string
SkipHostDiscovery bool
// ServiceVersion enables nmap-service-probes scanning (no external nmap binary).
ServiceVersion bool
// ServiceDiscovery enables port-number-to-service mapping (cheaper than ServiceVersion).
ServiceDiscovery bool
}
NaabuOptions configures an embedded naabu scan.
type NucleiOptions ¶
type NucleiOptions struct {
// OutputFile receives one JSON ResultEvent per match. Required.
OutputFile string
// Targets is the list of hosts/URLs to scan. Required.
Targets []string
// Templates lists template paths or IDs; empty runs the default set.
Templates []string
// ScanID and TeamID stamp dashboard-upload metadata into output.
ScanID string
TeamID string
AllowLocalFileAccess bool
MatcherStatus bool
EnableCodeTemplates bool
Headless bool
// ProbeNonHttp enables tcp/dns/etc protocol probing in addition to HTTP.
ProbeNonHttp bool
// ConfigYAML is the cloud-shipped nuclei RuntimeConfig (tags, severity,
// rate-limit, ...). Already base64-decoded by the caller.
ConfigYAML []byte
// ReportingConfigYAML is the cloud-shipped tracker config (Jira/Linear/GitHub/etc.).
ReportingConfigYAML []byte
}
NucleiOptions configures an embedded nuclei scan.
type TlsxOptions ¶
type TlsxOptions struct {
// OutputFile receives one JSON Response per line. Required.
OutputFile string
Concurrency int
Timeout time.Duration
Retries int
// ScanMode picks the TLS implementation: "ctls" (default), "ztls", "openssl", "auto".
ScanMode string
}
TlsxOptions configures an embedded tlsx scan.