Ducky Script · Volume 18

Ducky Script Volume 18 — Cheatsheet

The whole manual compressed — the language, the four devices, the deploy steps, the patterns, the decision tree, and the posture checklist

Contents

SectionTopic
1About this volume
2Ducky Script 1.0 — the core
3Ducky Script 3.0 — the structured language
4Smart-payload + exfil quick reference
5Key names and modifiers
6The four devices — quick reference
7Deploy — quick reference per device
8The payload patterns
9The device decision tree
10The posture checklist
11Volume index

1. About this volume

Vol 18 is the cheatsheet — the whole 18-volume manual compressed to laminate-ready reference. Nothing new; pure synthesis. Every entry points back to the volume with the full treatment. This is the page you keep open while you work.


2. Ducky Script 1.0 — the core

(Vol 3 — runs on every device)

CommandDoes
REM <text>comment (inject nothing). Header every payload; include an authorization ref.
STRING <text>type the text (auto-shifts for uppercase/symbols)
STRINGLN <text>STRING + ENTER
DELAY <ms>pause (min ~20 ms). The blind payload’s only sync tool.
named keysENTER TAB SPACE ESCAPE DELETE BACKSPACE UP/DOWN/LEFT/RIGHT F1-F12 HOME END PAGEUP/PAGEDOWN … (layout-independent)
modifiersSHIFT ALT CONTROL/CTRL COMMAND WINDOWS/GUI — combine on one line: GUI r, CTRL c, ALT F4

Rules: one command per line · command words UPPERCASE · STRING’s argument is literal to end-of-line · payload runs top-to-bottom, once · a 1.0 payload types blind (Vol 3 §9).


3. Ducky Script 3.0 — the structured language

(Vol 4 — Mark II Ducky + dialects on Bunny/Croc/O.MG)

VAR $x = 0              # variable: unsigned int 0-65535, global scope, $ sigil
$x = ($x + 1)           # reassign (no += ; parentheses for grouping)
DEFINE #NAME value      # compile-time constant, # sigil, find-and-replace

IF ( $x > 0 ) THEN      # conditional
    ...
ELSE                    # optional
    ...
END_IF                  # mandatory close

WHILE ( $x < 10 )       # loop (no FOR — counter + WHILE)
    ...
END_WHILE

FUNCTION name()         # reusable block
    ...
    RETURN <int/bool>   # optional early return / value
END_FUNCTION
name()                  # call

REM_BLOCK ... END_REM           # multi-line comment
STRING ... END_STRING           # multi-line type (strips leading ws)
STRINGLN ... END_STRINGLN       # multi-line type (preserves formatting)
RESTART_PAYLOAD / STOP_PAYLOAD / RESET   # payload control

Operators: + - * / % ^ · == != > < >= <= · && || · & | >> << · parentheses required for grouping.


4. Smart-payload + exfil quick reference

(Vols 5-6)

FeatureKey syntax
OS detectionIF ($_OS == WINDOWS) / MAC / …
Lock-key state$_CAPSLOCK_ON $_NUMLOCK_ON $_SCROLLLOCK_ON
Wait on host signalWAIT_FOR_CAPS_ON/OFF/CHANGE (+ NUM, SCROLL)
Save/restore lock stateSAVE_HOST_KEYBOARD_LOCK_STATE / RESTORE_…
ButtonWAIT_FOR_BUTTON_PRESS · BUTTON_DEF…END_BUTTON · DISABLE/ENABLE_BUTTON
Jitter$_JITTER_ENABLED = TRUE · $_JITTER_MAX = <ms>
RandomizationRANDOM_LETTER RANDOM_NUMBER RANDOM_SPECIAL RANDOM_CHAR … · $_RANDOM_INT ($_RANDOM_MIN/MAX)
Attack modeATTACKMODE HID / STORAGE / HID STORAGE / OFF
Identity spoofATTACKMODE HID VID_xxxx PID_xxxx MAN_… PROD_… SERIAL_… (+ _RANDOM variants)
Save/restore modeSAVE_ATTACKMODE / RESTORE_ATTACKMODE
Exfil (Keystroke Reflection)$_EXFIL_MODE_ENABLED = TRUE · EXFIL $varloot.bin
Hide payload filesHIDE_PAYLOAD / RESTORE_PAYLOAD (needs ATTACKMODE OFF or HID)
LEDLED_OFF LED_R LED_G

Timing-reliability hierarchy (best→worst): operator-gated (WAIT_FOR_BUTTON_PRESS) → host-confirmed (WAIT_FOR_CAPS_CHANGE) → OS-branched (IF $_OS) → blind DELAY. Climb it as far as the job allows.


5. Key names and modifiers

(Vol 3 §6-7 — named keys are LAYOUT-INDEPENDENT; typed characters are NOT — Vol 7)

Navigation : UP DOWN LEFT RIGHT (UPARROW…) PAGEUP PAGEDOWN HOME END
             INSERT DELETE/DEL BACKSPACE TAB SPACE
System     : ENTER ESCAPE PAUSE/BREAK PRINTSCREEN MENU/APP F1-F12
Lock       : CAPSLOCK NUMLOCK SCROLLLOCK
Modifiers  : SHIFT ALT CONTROL/CTRL COMMAND WINDOWS/GUI
Combos     : CTRL SHIFT · ALT SHIFT · COMMAND CTRL · CONTROL ALT DELETE …
Standalone : INJECT_MOD WINDOWS   (taps a modifier alone)
Hold       : HOLD <key> / RELEASE <key>

Cross-OS gotchas: GUI r = Run dialog (Win only) · GUI SPACE = Spotlight (macOS) · branch on $_OS for portability.


6. The four devices — quick reference

(Vols 8-11)

Rubber DuckyBash BunnyKey CrocO.MG
IsmicrocontrollerLinux boxLinux boxESP implant
Form”flash drive”chunky stickinline adaptercable/plug/adapter
Fires onplug-inplug-in (~7s boot)a MATCHremote / geo trigger
VectorsHID (+storage)HID/storage/serial/ETHHID/storage/serial/ETHHID
NetworknoneETH emulationWi-FiWi-Fi
Remote opsnonoyesyes (web UI)
Covertvisual onlynovisible if looked-foryes — IS the object
ExfilKeystroke ReflectionSSD / networkkeylog + Wi-Fiover its Wi-Fi
Best atfast clean injectionmulti-vector + toolingobserve-then-actcovert + remote + leave

7. Deploy — quick reference per device

(Vol 12)

DeviceAuthor/encodeDeploy
Rubber DuckyPayload Studio (official editor+encoder) → inject.bincopy inject.bin to the microSD card
Bash Bunnybunny script (DuckyScript + bash)arming switch → copy into a slot folder
Key CrocMATCH + actionarming/udisk mode → copy payload + set matches + Wi-Fi
O.MGauthor in the web UIweb UI over Wi-Fi → slot (remote, re-deployable)

Payload Studio tips: default tool, always-current · set the keyboard layout deliberately every time (Vol 7 — wrong layout = silent garbage) · keep payload.txt in scripts/ under version control · REM-header (what / OS / layout / auth) · DEFINE tuning constants up top · re-encode after every edit (inject.bin is a build artifact) · a successful encode = valid syntax, not correct payload.

Testing gate (Vol 12 §10): owned machine · target layout · target OS (both branches) · watched doing the right thing · re-tested after the last edit · community payloads read line-by-line.


8. The payload patterns

(Vol 13)

PatternShapeUse
Launchersettle → open a runner → type a commandthe 80% case: “execute this”
Staged loadertype a SHORT loader → it pulls/runs the real payloadlong/symbol-heavy payloads; minimal typed footprint
OS-adaptiveIF $_OS → per-OS bodyone payload, multiple targets (3.0)
Exfiltratorget data off — mechanism differs per deviceobjective is a credential/token/file
Operator-gatedWAIT_FOR_BUTTON_PRESS → bodyoperator confirms the moment (best timing)
Conditional/triggeredMATCH / geo-fence → bodyfires on target behaviour or environment

Payload anatomy: HEADER (REM + auth) · CONFIG (DEFINE/ATTACKMODE/VAR) · GATE (optional) · SETTLE (DELAY/RESET) · BODY (the pattern) · CLOSE (restore state, leave clean).


9. The device decision tree

(Vol 17)

WHEN must it fire?
  plug-in + just typing .............. USB RUBBER DUCKY
  plug-in + need network/storage/
    serial/Linux tooling ............. BASH BUNNY
  when the TARGET types a trigger .... KEY CROC
  when I decide / a condition ........ O.MG

OVERRIDES:
  must be genuinely COVERT ........... O.MG (overrides above)
  must CAPTURE what's typed ......... KEY CROC (overrides above)
  needs more than one device ........ COMBINED workflow (Vol 14)

Four axes: timing (when fires — dominant) · access (what physical access) · capability (is typing enough) · detection (stealth requirement).


10. The posture checklist

(Vol 16 — EVERYONE reads Vol 16)

THE CORE FACT: there is NO passive mode. If a Ducky Script
device is doing anything, it is ACTING on a computer system.
THE LINE: owned hardware OR explicit written authorization.
No third lawful category.

PRE-ENGAGEMENT
  □ Written authorization artifact — IN HAND, ON me
  □ Names: who / which systems / which actions / which devices
  □ Implants explicitly authorized to be LEFT
  □ Keylogging (Key Croc) authorized explicitly — incl.
    interception/consent (Vol 16 §7 — the hard gate)
  □ Data handling + destruction specified
  □ Points of contact named
  □ Every payload: REM-headed, vetted, scoped, TESTED
  □ Community payloads edited DOWN to scope
  □ Implants: trigger/geo-fence scoped tight; retrieval plan
  □ I can articulate the legal basis for every planned action

IF DISCOVERED
  □ STOP · PRODUCE the artifact · CONTACT the POC ·
    don't destroy/flee/lie · DOCUMENT

CLOSEOUT
  □ Every device accounted for; every implant RETRIEVED
  □ Every changed host RESTORED — left clean
  □ All captured data handled + DESTROYED per the artifact
  □ Added attack surface (C2, device Wi-Fi) torn down
  □ Report written — incl. which controls would have stopped it

11. Volume index

VolTitleVolTitle
1Overview — keystroke injection, the device family, the decision tree10The Key Croc
2History & generations11The O.MG Family: Cable, Plug & Adapter
3The language core (Ducky Script 1.0)12The encode & deploy workflow (Payload Studio)
4Ducky Script 3.0 — the structured language13Payload patterns, worked examples & the Payload Hub
5Smart payloads — detection, jitter & timing14Combined-device & combined-tool workflows
6Exfiltration & ATTACKMODE15Defense & detection
7Keyboard layouts — the cross-locale problem16Operational posture — legal, ethics & OPSEC
8The USB Rubber Ducky17Device comparison & which-to-use-when
9The Bash Bunny18Cheatsheet (this volume)

Sibling reference: the WiFi Pineapple deep dive — (combined workflows: Vol 14). Hub: ../_shared/comparison.md · ../_shared/legal_ethics.md.

This is Volume 18 of an 18-volume series — the final volume. The manual is complete: Part I (Vols 1-7) is the language, Part II (Vols 8-12) is the four owned devices and the deploy workflow, Part III (Vols 13-18) is payloads, combined workflows, defense, posture, device selection, and this cheatsheet. Start anywhere the [volume index] points you; everyone reads Vol 16.