2.2 KiB
Local Testing Guide for CyberChef
If you are developing new Cloud API capabilities (like the Google Translate operation) and you want to test them locally on your machine, follow these steps to spin up the local CyberChef development server.
Prerequisites
- Node.js: Ensure you have Node.js installed. CyberChef requires Node 16 or later.
node -v - NPM: Ensure you have npm installed.
npm -v
Setup and Running
-
Install Dependencies: Open a terminal, navigate to the
CyberChefClouddirectory, and run:npm installThis might take a minute as it downloads everything required to build CyberChef.
-
Start the Development Server: Run the following command to start the local instance:
npm run startThis will run a Grunt task that compiles the web interface, resolves operations, and provisions a local HTTP server using Webpack Dev Server.
-
Access CyberChef: By default, the server will host CyberChef on port 8080.
- Open your web browser.
- Go to
http://localhost:8080.
Testing the Translate Operation
- With the local CyberChef instance open, type "Google Translate" into the Operations search bar in the top left.
- Drag the
Google Translateoperation into the Recipe column. - In the Input column, type some text (e.g., "Hello world").
- In the
Google Translateoperation configuration:- Make sure Source Language is correct (e.g.,
en). - Make sure Target Language is correct (e.g.,
es). - If using an API key, leave Auth Type as API Key and paste your API key into the GCP Auth String box.
- (Note: Ensure your API key restrictions at console.cloud.google.com temporarily allow
http://localhost:8080/*).
- Make sure Source Language is correct (e.g.,
- Check the Manual Bake checkbox at the bottom of the recipe column if it isn't checked by default, or just click Bake!.
- The translated output should appear in the Output column.
Advanced Testing (Command Line)
To ensure the CyberChef engine builds cleanly and passes its internal checks without UI verification, you can run the automated tests:
npm run test