Skip to contentSkip to Content

Mantis DELAY Command

The Mantis DELAY command pauses script execution for a specified duration in milliseconds (ms).

Proper timing is the single most critical factor in building reliable keystroke injection payloads. Operating systems require time to enumerate USB devices, launch applications, render GUI windows, and process terminal commands.


What It Does

  • Suspends payload processing for the exact number of milliseconds requested.
  • Maintains USB HID connection state and keep-alive signals while paused.
  • Prevents keystrokes from firing before the host operating system is ready to receive input.

Syntax & Parameters

hello.mantis
1DELAY <milliseconds>

Parameters

  • <milliseconds> (required): An integer representing pause duration (e.g. 500 for half a second, 2000 for 2 seconds).

Examples & Payload Snippets

Waiting for OS Enumeration & Application Startup

hello.mantis
1REM Initial delay to allow USB device enumeration
2DELAY 1500
3
4REM Launch Run Dialog
5GUI r
6REM Wait 600ms for Run dialog window to appear
7DELAY 600
8
9REM Type command
10STRING cmd
11ENTER
12
13REM Wait 1000ms for Command Prompt terminal to initialize
14DELAY 1000
15
16STRINGLN echo Mantis payload active.

Timing Best Practice Guidelines

OperationRecommended DelayWhy It Matters
Post-USB Plug-in10002000 msOS needs time to bind the generic USB HID keyboard driver.
Dialog Launch (GUI r)400700 msWindows Explorer animation delay.
Terminal Startup (cmd / powershell)10001500 msShell process initialization & window painting.
Browser Launch20003000 msHeavy browser process & profile loading.

Common Mistakes & Troubleshooting

  • Zero Delay at Payload Start: Plugging in Mantis and immediately sending keystrokes will cause the initial characters to be lost while the host OS initializes the USB bus. Always begin payloads with DELAY 1000 or DELAY 2000.
  • Assuming Instant App Startup: Machines with slow hard drives or heavy background processes take longer to open apps. Tune your delays conservatively to ensure reliability across varied hardware.

  • SET_DELAY — Set fixed delay between every individual keystroke.
  • SET_SPEED — Apply global speed profiles ($Human, $Fastest).
  • WAIT_FOR_BUTTON_PRESS — Pause indefinitely until physical button click.
Last updated on