Skip to content

Add recursive file discovery, performance improvements, and usability fixes#3

Open
ssstonebraker wants to merge 1 commit intoshifty0g:masterfrom
ssstonebraker:feature/recursive-search
Open

Add recursive file discovery, performance improvements, and usability fixes#3
ssstonebraker wants to merge 1 commit intoshifty0g:masterfrom
ssstonebraker:feature/recursive-search

Conversation

@ssstonebraker
Copy link
Copy Markdown

What this does

Adds a --recursive (or --r) flag that uses find to discover .gnmap files in subdirectories so you don't have to pass them all manually on the command line. Works with all existing features (csv, summary, web, ssl, hostports, etc).

Performance

Replaced the shell while read loops in makecsv, summary, web, webdirty, ssl, and hostports with single-pass POSIX awk. This is a huge speedup when working with hundreds or thousands of scan files. The old code was spawning 5-7 subprocesses per line per file. Now it's one awk process per function.

Recursive file loading uses batched xargs cat instead of a per-file cat/sort loop.

Usability

  • Single-dash switches now work (-all, -csv, etc) by normalizing to double-dash internally
  • Added smb-ips.txt output with plain IPs for SMB hosts
  • Output directory path printed at the end so you know where files landed
  • Guard on summay-log so it doesn't error when no .log files exist
  • Added recursive usage example to the help menu

Bug fixes

  • Exclude temp.gnmap from recursive find (was catting into itself)
  • mkdir before realpath so it works on macOS (BSD realpath fails on non-existent paths)
  • Split gnmap port entries on /, instead of comma to preserve commas in version strings (e.g. LDAP domain info was getting truncated)
  • Fixed double slash in summay-log file paths
  • Fixed stray dollar sign in summay-log redirect

Compatibility

  • All awk code uses POSIX features only, tested on both macOS (BSD awk) and Linux (gawk)
  • find syntax is portable across BSD and GNU find
  • No changes to existing behavior when --recursive is not used

@ssstonebraker ssstonebraker marked this pull request as ready for review March 23, 2026 17:32
@ssstonebraker ssstonebraker force-pushed the feature/recursive-search branch 5 times, most recently from 61af65e to ac5e13f Compare March 23, 2026 17:43
… fixes

Added --r / --recursive flag that uses find to discover .gnmap files
in subdirectories so you don't have to pass them all manually.
Works with all existing features (csv, summary, web, ssl, etc).

Performance:
- Replaced makecsv, summary, web, webdirty, ssl, and hostports
  shell loops with single-pass POSIX awk. Huge speedup when
  working with hundreds or thousands of scan files.
- Recursive file loading uses batched xargs cat instead of
  per-file cat/sort loop.

Usability:
- Single-dash switches now work (-all, -csv, etc) by normalizing
  to double-dash internally.
- Added smb-ips.txt output with plain IPs for SMB hosts.
- Output directory path printed at the end so you know where
  files landed.
- Guard on summay-log so it doesn't error when no .log files exist.

Fixes:
- Exclude temp.gnmap from recursive find (was catting into itself).
- mkdir before realpath so it works on macOS.
- Split gnmap port entries on /, instead of comma to preserve
  commas in version strings (e.g. LDAP domain info).
- Fixed double slash in summay-log file paths.
- Fixed stray dollar sign in summay-log redirect.
@ssstonebraker ssstonebraker force-pushed the feature/recursive-search branch from ac5e13f to d2ad9c4 Compare March 23, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant