Skip to contentSkip to Content
Payload examplesHello World

Mantis Hello World Payload Example

The Hello World payload demonstrates the core lifecycle of a Mantis script: waiting for USB enumeration, opening an editor application, and injecting text.


The Script

hello.mantis
1REM ============================================
2REM Mantis Hello World Demo
3REM ============================================
4
5REM Allow host OS to recognize USB device
6DELAY 1500
7
8REM Turn on status LED during execution
9LED_ON
10
11REM Set natural typing pace
12SET_SPEED $Normal
13
14REM Open Windows Run Dialog
15GUI r
16DELAY 600
17
18REM Open Notepad
19STRINGLN notepad
20DELAY 1000
21
22REM Type greeting text
23STRING Hello from Karvi Mantis!
24ENTER
25STRING Automated USB HID Keystroke Injection in India.
26ENTER
27
28REM Signal completion with LED blink
29LED_OFF
30DELAY 200
31LED_ON
32DELAY 200
33LED_OFF

Code Breakdown

  • DELAY 1500: Ensures the host operating system has attached the generic HID keyboard driver before keystrokes fire.
  • GUI r: Opens the Windows Run dialog.
  • STRINGLN notepad: Types notepad and sends ENTER in one command.
  • DELAY 1000: Gives Notepad time to allocate its UI window and receive input focus.
  • STRING ...: Types the message cleanly.
  • LED_ON / LED_OFF: Gives clear visual confirmation on the physical Mantis board.

Last updated on