How jessebowling/ipgrep works
ipgrep is a command-line IP extraction and enrichment utility. Users provide text via stdin or a file and choose extraction options, chained enrichments, and an output format; the CLI constructs the pipeline, which extracts and normalizes IP data, applies enrichment plugins, and formats results. The README also documents local IP classification, IPInfo database enrichment, and three Shadowserver ASN lookups. Their advertised capabilities are represented below; unsampled modules are not described beyond those documented behaviors.
Main entry points: core.py Processing pipeline · asn_base.py ASN API and batching · cli.py CLI options and input · asn_prefix.py ASN prefix lookup
Components 18
CLI and orchestration
- CLI options and input
src/ipgrep/cli.py - Processing pipeline
src/ipgrep/core.py
Extraction
- IP and CIDR extractor
src/ipgrep/extractor.py
Enrichment plugins
- Plugin interfaces and discovery
src/ipgrep/plugins/base.py - IP classification
src/ipgrep/plugins/enrichment/ipaddress_enrichment.py - IPInfo database lookup
src/ipgrep/plugins/enrichment/ipinfo.py - ASN API and batching
src/ipgrep/plugins/enrichment/asn_base.py - Origin ASN lookup
src/ipgrep/plugins/enrichment/asn_origin.py - Peer ASN lookup
src/ipgrep/plugins/enrichment/asn_peer.py - ASN prefix lookup
src/ipgrep/plugins/enrichment/asn_prefix.py
Output formatting
- Plain output
src/ipgrep/plugins/output/plain.py - CSV output
src/ipgrep/plugins/output/csv.py - JSON output
src/ipgrep/plugins/output/json.py - Space output
src/ipgrep/plugins/output/space_delimited.py - Pipe output
src/ipgrep/plugins/output/pipe_delimited.py
Other components
- CLI user
- Shadowserver API
- IPInfo database service
Connections 21
- CLI user → CLI options and input: provides input
README.md - CLI options and input → Processing pipeline: constructs and runs
src/ipgrep/cli.py - CLI options and input → Plugin interfaces and discovery: loads plugins
src/ipgrep/cli.py - Processing pipeline → IP and CIDR extractor: extracts addresses
src/ipgrep/core.py - Processing pipeline → Plugin interfaces and discovery: uses plugin interfaces
src/ipgrep/core.py - Processing pipeline → Plain output: formats by default
- Processing pipeline → CSV output: formats enriched data
- Processing pipeline → JSON output: formats selected data
- Processing pipeline → Space output: formats selected data
- Processing pipeline → Pipe output: formats selected data
- Processing pipeline → IP classification: applies enrichment
- Processing pipeline → IPInfo database lookup: applies enrichment
- Processing pipeline → Origin ASN lookup: applies enrichment
- Processing pipeline → Peer ASN lookup: applies enrichment
- Processing pipeline → ASN prefix lookup: applies enrichment
- Origin ASN lookup → ASN API and batching: inherits API support
src/ipgrep/plugins/enrichment/asn_origin.py - Peer ASN lookup → ASN API and batching: inherits API support
src/ipgrep/plugins/enrichment/asn_peer.py - ASN prefix lookup → ASN API and batching: inherits API support
src/ipgrep/plugins/enrichment/asn_prefix.py - ASN prefix lookup → Origin ASN lookup: looks up origin ASN
src/ipgrep/plugins/enrichment/asn_prefix.py - ASN API and batching → Shadowserver API: requests ASN data
src/ipgrep/plugins/enrichment/asn_base.py - IPInfo database lookup → IPInfo database service: queries database