Mantis Commands Library
Mantis Language · Command Library · Karvi LabsEvery Mantis script (.mantis) is constructed from short, uppercase commands that instruct the Mantis USB hardware to emulate keyboard strokes, manage execution timing, control onboard LEDs, or branch logic based on button inputs.
Below is the complete reference library for every command supported by the Mantis Device Compiler (MDC) in Karvi Studio. Click on any command to view its dedicated syntax guide, runtime parameters, runnable payload examples, and common mistakes.
Text Injection Commands
| Command | Syntax | Primary Use |
|---|---|---|
STRING | STRING text | Types text exactly as written at the current typing pace. |
STRINGLN | STRINGLN text | Types text and immediately sends an ENTER keystroke. |
FAST_STRING | FAST_STRING text | Injects text via batched USB HID reports at maximum machine speed. |
Timing & Pacing Commands
| Command | Syntax | Primary Use |
|---|---|---|
DELAY | DELAY ms | Pauses payload execution for a specified duration in milliseconds. |
SET_DELAY | SET_DELAY ms | Configures fixed millisecond pacing between consecutive keystrokes. |
SET_SPEED | SET_SPEED speed | Sets typing speed presets ($Human, $Normal, $Fastest, $Random). |
Key Modifiers & Navigation
| Command | Syntax | Primary Use |
|---|---|---|
GUI | GUI [key] | Presses Windows / Command key or triggers shortcuts like GUI r. |
CTRL | CTRL [key] | Emulates the Control key or shortcut chords like CTRL c. |
ALT | ALT [key] | Emulates the Alt / Option key or chords like ALT F4. |
SHIFT | SHIFT [key] | Emulates Shift modifier or text selection combinations. |
ENTER | ENTER | Sends a Return / Enter key press to submit dialogs or run commands. |
INJECT_MOD | INJECT_MOD modifier | Injects low-level raw modifier combinations directly over HID. |
Logic, Variables & Modular Code
| Command | Syntax | Primary Use |
|---|---|---|
DEFINE | DEFINE name type value | Declares compile-time constants for strings and integers. |
LOOP | LOOP [count] ... END_LOOP | Repeats blocks of keystrokes with support for BREAK and CONTINUE. |
IF / ELSE | IF cond THEN ... END_IF | Conditional branching based on button states (BUTTON_PRESSED). |
FUNCTION | FUNCTION name() ... END_FUNCTION | Declares reusable subroutines with up to 8 levels of call recursion. |
REM | REM comment | Adds comments that are stripped during compilation. |
Hardware & System Controls
| Command | Syntax | Primary Use |
|---|---|---|
LED_ON / LED_OFF | LED_ON / LED_OFF | Toggles the physical onboard status LED for execution feedback. |
WAIT_FOR_BUTTON_PRESS | WAIT_FOR_BUTTON_PRESS | Halts payload execution until the physical onboard button is pressed. |
BUTTON_DEF | BUTTON_DEF ... END_BUTTON | Defines an asynchronous event handler for button clicks. |
ATTACKMODE | ATTACKMODE mode | Configures USB endpoint profiles (HID keyboard, CDC serial, OFF). |
Next Steps
- Learn fundamental grammar rules in the Mantis Syntax Guide.
- Test ready-to-run scripts in the Payload Examples.
- Troubleshoot payload execution in the Troubleshooting Guide.
Last updated on