Skip to content

Repository files navigation

proton

High-performance content scanning engine for detecting leaked credentials, API keys, private keys, and other sensitive information — in files, process memory, environment variables, and live network traffic.

Architecture

proton/
├── sysinfo/ # standalone Go module — data acquisition layer
│ ├── process # enumerate processes, read env/cmdline/fd/conn/pipe
│ ├── memory # cross-platform process memory reading
│ ├── capture # raw network packet capture (Linux/macOS/Windows)
│ ├── stream # TCP stream reassembly
│ └── packet # Ethernet/IPv4/TCP parsing
├── proton/file/ # scanning engine — prefilter → Aho-Corasick → RE2
├── proton/sys/ # sys protocol — targeted process scan templates
├── pkg/runner/ # scan orchestration — Runner API, templates, output
└── cmd/ # CLI shell (found)

Three layers:

  • sysinfo — independent Go module (sysinfo/go.mod), zero proton dependency. Reads data from processes, memory, and network. Usable standalone.
  • proton/file — scanning engine with three-layer pipeline (prefilter → Aho-Corasick DFA → RE2). Importable as a library.
  • found (CLI) / pkg/runner — scan orchestration, template management, output formatting. pkg/runner exposes a programmatic Runner API.

Scanning Pipeline

Each line passes through progressively expensive layers, skipping work as early as possible:

  1. Prefilterbytes.Contains on raw []byte, zero allocation (~4ns/line)
  2. Aho-Corasick DFA — multi-pattern index, selects relevant regex subset per line
  3. RE2 regex — only runs patterns identified by the previous layer (8.4x faster than Go stdlib)

Installation

go install github.com/chainreactors/proton@latest

Or build from source:

git clone https://github.com/chainreactors/proton
cd proton
go build -o found .

Quick Start

# Scan a directory with built-in key-detection templates
found -i ~/projects
# Auto-detect OS and scan common sensitive directories
found --auto
# Search with regex directly (like ripgrep)
found -i ~/projects -e "AKIA[0-9A-Z]{16}"# Scan process environment variables for secrets
found --pid 1234 --env
# Scan all processes matching a name
found --process nginx --env --cmdline
# Scan process memory
found --pid 1234 --mem
# Capture and scan live network traffic
found --listen eth0
# Output as JSON
found -i ~/projects -j -s results.json

Data Sources

found scans across multiple data sources using the same templates:

SourceFlagDescription
Files-i <path>Local files and directories (archives auto-extracted)
Memory--memProcess virtual memory regions
Env--envProcess environment variables
Cmdline--cmdlineProcess command-line arguments
FD--fdOpen file descriptors
Connections--connNetwork connections
Pipes--pipeNamed pipes
Network--listen <iface>Live traffic capture with TCP stream reassembly

Process Scanning

# Scan a specific PID — defaults to all data sources (env, cmdline, fd, conn, pipe)
found --pid 1234
# Scan only specific sources
found --pid 1234 --env --cmdline
# Add memory scanning
found --pid 1234 --mem
# Scan all readable memory regions (including mapped libraries)
found --pid 1234 --mem-all
# Scan all processes matching a name
found --process sshd --env
# Scan all accessible processes
found --pid 0 --env

sys: Protocol Templates

For targeted process scanning with process/region filtering:

id: chrome-secretsinfo:
name: Chrome Process Secret Scannerseverity: highsys:
- source: memoryprocess: chromeregions: [heap, stack, anonymous]extractors:
- type: regexregex:
- "password[=:]\\S+"
- source: envprocess: sshdextractors:
- type: regexregex:
- "(?i)(?:password|secret|token)=\\S+"

Network Scanning

# Capture and scan all traffic on an interface
found --listen eth0
# Filter by port
found --listen eth0 --bpf "port 80"# Scan with custom regex
found --listen eth0 -e "password=\S+"

TCP streams are reassembled before scanning — matches spanning multiple packets are detected.

Using as a Library

proton/file — Scanning Engine

import (
"github.com/chainreactors/proton/proton/file""github.com/chainreactors/neutron/protocols"
)
scanner:=file.NewScanner(rules, execOpts)
scanner.Scan("/path/to/target", func(f file.Finding) {
fmt.Printf("[%s] %s: %s\n", f.Severity, f.TemplateID, f.FilePath)
})

sysinfo — Data Acquisition (standalone module)

import"github.com/chainreactors/proton/sysinfo"// Read process environmentenv, _:=sysinfo.ReadProcessEnv(pid)
// Walk process memorysysinfo.WalkProcessMemory(pid, sysinfo.MemScanOptions{}, func(data []byte, labelstring) {
// scan data chunk
})
// TCP stream reassemblyreassembler:=sysinfo.NewStreamReassembler(func(data []byte, labelstring) {
// scan reassembled stream data
}, overlapSize, windowSize)
reassembler.ProcessPacket(pkt)
// Enumerate processesprocs, _:=sysinfo.ListProcesses()

pkg/runner — Programmatic Runner

import"github.com/chainreactors/proton/pkg/runner"cfg:=&runner.Config{
Input: "/path/to/scan",
Categories: []string{"keys"},
Quiet: true,
Output: "json",
}
r, _:=runner.New(cfg)
r.Run()

CLI Reference

Input Options

FlagShortDescription
--input-iTarget file or directory to scan
--autoAuto-detect OS and scan common sensitive directories
--template-tTemplate file or directory (can specify multiple)
--exclude-templateTemplate to exclude
--category-cTemplate categories (default: keys)
--idFilter templates by ID
--exclude-idExclude templates by ID
--tagsInclude only templates matching tags
--etagsExclude templates matching tags
--expression-eRegex pattern to search directly
--extFile extensions filter for -e mode
--ignoreIgnore rules file (.foundignore.yaml)

Output Options

FlagShortDescription
--output-oFormat: text, json, zombie (default: text)
--json-jShorthand for -o json
--save-sSave results to file
--collectCollect matched files into zip
--collect-treePreserve directory structure in zip
--quiet-qOnly print findings
--no-colorDisable colored output

Scan Options

FlagDescription
--binInclude binary files (default: text-only)
--listenCapture live traffic on network interface
--bpfBPF packet filter (e.g. port 80)
--severityFilter by severity (critical,high,medium,low,info)
--baselineSuppress known findings from baseline file
--findingsSave findings as baseline
--fail-onExit code 1 if findings match severity

Process Scan Options

FlagDescription
--pidScan specific PID (0 = all accessible processes)
--processScan processes matching name substring
--memScan process memory regions
--mem-allScan ALL readable memory regions
--envScan environment variables
--cmdlineScan command-line arguments
--fdScan open file descriptors
--connScan network connections
--pipeScan named pipes

Template Management

FlagDescription
--listList available templates
--validateValidate template files
--template-displayDisplay template content
--update-templatesDownload/update templates from git
--template-urlCustom template repository URL

Template Format

id: aws-credentialsinfo:
name: AWS Credentials Detectionseverity: criticaltags: cloud,awsfile:
- extensions:
- allmatchers:
- type: wordwords:
- "AKIA"extractors:
- type: regexregex:
- "AKIA[0-9A-Z]{16}"

Benchmark

Intel Core Ultra 9 285H, 156 built-in templates (863 regex patterns), real source files.

DataFilesprotonnaiveSpeedup
1 KB1151 µs4 ms28x
1 MB137362 µs18.4 s50,000x
1 GB162,25834 ms~5h (projected)540,000x

File Filtering

CategoryExamplesBehavior
Media/Font.png .jpg .mp4 .ttf .woffAlways skipped
Executable.exe .dll .so .class .pycSkipped; --bin to include
Archive.tar .gz .zip .7z .rarAuto-scanned (streaming)
Document.pdf .doc .ppt .xlsSkipped by default
Text/Config.go .py .yaml .json .env .pemAlways scanned

License

See LICENSE.

About

nuclei file protocol engine

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages