Skip to content

feat(capture): add --duration parameter with auto-save to temp pcap - #101

Merged
luongnv89 merged 1 commit into
mainfrom
feat/100-add-duration-parameter-to-capture
Aug 27, 2026
Merged

feat(capture): add --duration parameter with auto-save to temp pcap#101
luongnv89 merged 1 commit into
mainfrom
feat/100-add-duration-parameter-to-capture

Conversation

@luongnv89

Copy link
Copy Markdown
Collaborator

Summary

Addresses issue #100: Add --duration parameter to the capture command with auto-save to temp file.

Changes

New -d/--duration <seconds> option for capture command

  • Runs a timed capture loop that stops automatically after the specified duration
  • Saves captured packets to a temp pcap file at /tmp/mmtreader-<pid>.pcap
  • Prints the temp file path to stdout so agents can reference it
  • Graceful shutdown on SIGINT/SIGTERM (existing Ctrl+C behavior preserved)
  • No --duration flag = existing infinite capture behavior unchanged

Bug fix

  • Fixed missing colon after F in getopt string (regression from adding d:)

Acceptance Criteria

  • --duration <seconds> parameter accepted by the capture command and documented in --help
  • Capture loop stops automatically after the specified duration, with graceful shutdown
  • Captured packets are saved to a temp pcap file by default
  • The temp file path is printed to stdout
  • Existing behavior (Ctrl+C to stop) is preserved when no --duration is given

Testing

  • All 350 unit + integration tests pass
  • Build is warning-free (-Wall -Wextra)
  • CLI integration tests pass

…issue #100)

Add -d/--duration <seconds> to the capture command for timed captures:
- Timed capture loop with automatic pcap file save to /tmp/mmtreader-<pid>.pcap
- Prints the temp file path to stdout for agent consumption
- Graceful shutdown on SIGINT/SIGTERM (existing Ctrl+C behavior preserved)
- No duration flag = existing infinite capture behavior unchanged

Fix: added missing colon after F in getopt string (regression from adding d:)
@luongnv89
luongnv89 merged commit 1d9e3a4 into main Aug 27, 2026
2 checks passed
@luongnv89
luongnv89 deleted the feat/100-add-duration-parameter-to-capture branch August 27, 2026 23:07
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