【WIP】CLI バージョンを作成#251
Closed
kakira9618 wants to merge 15 commits into
Closed
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…NT modes Replace the boolean isGulp flag with a LogMode enum so CLI subcommands can route log output appropriately: SERVER_STDERR sends to stderr for CI visibility, SILENT suppresses all output to keep encode/decode stdout clean. AppInitializer gains setLogMode() so callers override before initCore(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…fety The CLI runs encode/decode from a plain main thread without AWT/EDT serialization. Without synchronized, concurrent test runs can race on the lazy singleton initialization. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…x dump Previously raw bytes were cast to String, producing mojibake when the pending buffer contained binary protocol data. Now the log line shows [binary N bytes] followed by the first 64 bytes in hex, matching the format used by other tools in the project. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…hutdown The server subcommand needs to close all active listen ports on SIGINT/SIGTERM. stopAll() iterates the internal map under its own lock so existing per-port close() errors do not abort the loop. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
….main() CliRoot registers server/encode/decode/encoders as subcommands. PacketProxy.main() short-circuits to picocli when the first arg matches a known CLI subcommand, leaving the legacy --gulp path untouched. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codec is a stateless object that wraps EncoderManager, reads stdin (or --in file), runs the chosen direction through the encoder, and writes to stdout (or --out file). EncodeCommand/DecodeCommand delegate to Codec. EncodersCommand lists all registered encoder names. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion Full Packet rows include large blob columns (decoded_data etc.) that are expensive to serialise over the REST API. querySummaryRange selects only the metadata columns needed for listing; querySummaryRangeFiltered adds a raw WHERE clause for server-side filtering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ManagementApiServer embeds NanoHTTPD and dispatches to five handlers: PacketApiHandler GET /api/packets — paginated packet listing ResendApiHandler POST /api/resend — resend a captured packet VulCheckApiHandler POST /api/vulcheck — run a vuln-check script ConfigApiHandler GET/POST /api/config — export/import JSON config /api/status returns STARTING → RUNNING → STOPPING lifecycle state Bearer-token auth is optional; --api-key activates it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nfig mode
ServerCommand blocks in the foreground until SIGINT/SIGTERM.
Key behaviours:
--config omitted → reuse existing ~/.packetproxy/db/resources.sqlite3
--config FILE → import JSON and apply to the DB
--api-port PORT → start ManagementApiServer before initComponents()
so /api/status returns STARTING during boot
--no-log → LogMode.SILENT
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
EncoderCharacterizationTest pins encode/decode round-trip behaviour for EncodeSample and EncodeSampleUpperCase so CLI regressions are caught. EncoderManagerCharacterizationTest verifies headless singleton access. CodecTest drives the full Codec.run() path via file I/O, covering text mode, binary passthrough, and unknown-encoder error reporting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Build and export are moved before the new subcommand dispatch so the binary is always up to date. server/encode/decode/encoders are forwarded directly to the binary; all other args fall through to the legacy gulp path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cli-plan.md tracks the design decisions and item-by-item progress for the CLI feature work. cli.md documents usage examples for the new subcommands. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
PacketProxy の CLI 版を作成。

機能
使用方法
詳しくは
docs/cli.mdを参照してください。CLI Server / CLI Client 共通
CLI Server
デフォルトでは、GUI 版で最後に使った DB / 設定で起動します。
他のAPIは
docs/cli.mdを参照してください。GET /api/status)GET /api/packets)GET /api/packets/{id})POST /api/packets/{id}/resend)POST /api/packets/{id}/bulk-send)GET /api/vulcheckers)POST /api/vulcheckers/{name}/run)GET /api/config)PUT /api/config)GET /api/db)CLI Client