Feature request: Command-line interface for CyberChef
- Dominant language
- JavaScript
- Stars
- 35.8k
- Forks
- 4.1k
- Avg merge
- 2d 26m
- Merged PRs (30d)
- 33
Description
It would be very helpful to have a command line interface for performing CyberChef operations on local files without the need for a GUI web app.
@d98762625 suggested I create this ticket to be a better venue than PR #1043 for the design discussion of what CyberChef's official CLI could look like.
## Design considerations
An ideal CLI would have a fairly simple interface. The only inputs needed are:
* A recipe, being a list of operations to perform
* A list of files upon which to perform the operations
* A directory or file into which to place the output
In keeping with a common paradigm in unix-like operating systems, if no input files are given, then input should come from stdin; likewise, if no output destination is specified, then output should go to stdout. This is to accommodate the very common practice of chaining several single-purpose commands together to address specific needs.
A CLI would not replace the web app, and should not be designed with feature-parity to the web app in mind. The thrust of this ticket is to get command-line access to the operations which CyberChef provides, for use on data which shouldn't or can't easily be loaded into the web app.
A CLI would not replace the Node API, and should not be designed to expose every last detail of that API. Using the CLI should be easier for the general case than writing a program.
## Specifying recipes
There are many ways one could specify a recipe to the CLI, and this is probably where most of the complexity will come from. The CLI could possibly support multiple ways of receiving the recipe. Some possibilities:
* String of JSON from a file
* eg. from CyberChef's "Save Recipe → Clean JSON" or "→ Compact JSON" dialog
* List of "Chef Format" operations in a file
* eg. from CyberChef's "Save Recipe → Chef Format" dialog
* List of operations specified on the command line
* Strict "Chef Format": `To_Base64('A-Za-z0-9+/=') To_Hex('None')`
* Simplified semantic format leveraging the flexibility of `chef.bake()`: `'tobase64:A-Za-z0-9+/=' to-hex:none`
I ordered these roughly from least to most end-user friendly, but they aren't mutually exclusive. Some use cases are easier when loading a pre-composed recipe from a file, while others are easier by specifying operations on the command line.
Contributor guide
Research direction
Start by reviewing PR #1043 and CyberChef's Node API, especially chef.bake(), to understand the existing operation interface. The issue is still defining the CLI's recipe formats, input/output behavior, and scope rather than naming implementation files. Done would require an agreed design and a defined implementation plan.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100