BadKB: Rename code to BadUSB for easier merges

Still called BadKB for display name and appid
This commit is contained in:
Willy-JL
2025-02-28 00:06:57 +00:00
parent 9e65b9472f
commit 02e00498a1
121 changed files with 1877 additions and 1852 deletions

View File

@@ -0,0 +1,51 @@
ID 1234:abcd Generic:USB Keyboard
REM Declare ourselves as a generic usb keyboard
REM This will install qFlipper on Linux/Gnome, using the latest AppImage package
REM Open a terminal
ALT F2
DELAY 1000
STRINGLN gnome-terminal --maximize
DELAY 1000
REM Ensure we have a folder to run executables from
STRINGLN mkdir -p $HOME/.local/bin
REM Download the latest AppImage
STRINGLN curl -fsSL "https://update.flipperzero.one/qFlipper/release/linux-amd64/AppImage" -o "$HOME/.local/bin/qFlipper"
DELAY 1000
REM Make it executable
STRINGLN chmod +x $HOME/.local/bin/qFlipper
REM Extract the appimage in /tmp to install icon and .desktop file
STRINGLN cd /tmp
STRINGLN $HOME/.local/bin/qFlipper --appimage-extract > /dev/null
STRINGLN sed "s@Exec=qFlipper@Exec=$HOME/.local/bin/qFlipper@" squashfs-root/usr/share/applications/qFlipper.desktop > $HOME/.local/share/applications/qFlipper.desktop
STRINGLN mkdir -p $HOME/.local/share/icons/hicolor/512x512/apps
STRINGLN cp squashfs-root/usr/share/icons/hicolor/512x512/apps/qFlipper.png $HOME/.local/share/icons/hicolor/512x512/apps/qFlipper.png
STRINGLN rm -rf squashfs-root
STRINGLN cd
REM Depending on the Linux distribution and display manager
REM there might be several ways to update desktop entries
REM try all
STRINGLN xdg-desktop-menu forceupdate || true
STRINGLN update-desktop-database ~/.local/share/applications || true
STRINGLN echo "
ENTER
REPEAT 60
STRINGLN ==========================================================================================
STRINGLN qFlipper has been installed to $HOME/.local/bin/
STRINGLN It should appear in your Applications menu.
STRINGLN If it does not, you might want to log out and log in again.
ENTER
STRINGLN If you prefer to run qFlipper from your terminal, either use the absolute path
STRINGLN or make sure $HOME/.local/bin/ is included in your PATH environment variable.
ENTER
STRINGLN Additional configurations might be required by your Linux distribution such as
STRINGLN group membership, udev rules or else.
STRINGLN ==========================================================================================
STRINGLN "

View File

@@ -0,0 +1,16 @@
ID 05ac:021e Apple:Keyboard
REM Keep these 3 lines IF (and only if) it's the first time you are performing a badKB attack against a specific macOS target.
REM In fact, it helps Flipper Zero bypass the macOS keyboard setup assistant. Otherwise the attack will not start.
REM Author: 47LeCoste
REM Version 1.0 (Flipper Ducky)
REM Target: macOS
DELAY 3000
F4
DELAY 2500
STRING Terminal
DELAY 2500
ENTER
DELAY 1500
STRING (cd /tmp && curl -L -o qFlipper.dmg https://update.flipperzero.one/qFlipper/release/macos-amd64/dmg && hdiutil attach qFlipper.dmg && app_volume=$(ls /Volumes | grep -i "qFlipper") && (test -e /Applications/qFlipper.app && rm -rf /Applications/qFlipper.app ); cp -R "/Volumes/$app_volume/qFlipper.app" /Applications/ && hdiutil detach "/Volumes/$app_volume" && rm qFlipper.dmg && open /Applications/qFlipper.app)
DELAY 1000
ENTER

View File

@@ -0,0 +1,42 @@
REM Written by @dexv
DELAY 2000
GUI r
DELAY 500
STRING powershell
ENTER
DELAY 1000
STRING $url = "https://update.flipperzero.one/qFlipper/release/windows-amd64/portable"
ENTER
STRING $output = "$env:USERPROFILE\Documents\qFlipper.zip"
ENTER
STRING $destination = "$env:USERPROFILE\Documents\qFlipper"
ENTER
STRING $shortcutPath = "$env:USERPROFILE\Desktop\qFlipper.lnk"
ENTER
STRING $scriptPath = "$env:USERPROFILE\Documents\qFlipperInstall.ps1"
ENTER
STRING $driverPath = "$destination\STM32 Driver"
ENTER
STRING $installBat = "$driverPath\install.bat"
ENTER
STRING (New-Object System.Net.WebClient).DownloadFile($url, $output)
ENTER
STRING Expand-Archive -Path $output -DestinationPath $destination -Force
ENTER
STRING Set-Location -Path $destination
ENTER
STRING Start-Process -FilePath ".\qFlipper.exe"
ENTER
STRING Start-Process -Wait -FilePath "cmd.exe" -ArgumentList "/c $installBat"
ENTER
STRING $shell = New-Object -ComObject WScript.Shell
ENTER
STRING $shortcut = $shell.CreateShortcut($shortcutPath)
ENTER
STRING $shortcut.TargetPath = "$destination\qFlipper.exe"
ENTER
STRING $shortcut.Save()
ENTER
DELAY 500
STRING "powershell -ExecutionPolicy Bypass -File $scriptPath"
ENTER

View File

@@ -0,0 +1,13 @@
REM Credit: John Hickens
GUI b
DELAY 600
ENTER
DELAY 1000
CTRL l
DELAY 100
STRING https://github.com/Next-Flip/Momentum-Firmware
DELAY 100
ENTER
DELAY 500
STRING f

View File

@@ -0,0 +1,85 @@
REM This is BadUSB demo script for Chrome and ChromeOS by kowalski7cc
REM Exit from Overview
ESC
REM Open a new tab
CTRL t
REM wait for some slower chromebooks
DELAY 1000
REM Make sure we have omnibox focus
CTRL l
DELAY 200
REM Open an empty editable page
DEFAULT_DELAY 50
STRING data:text/html, <html contenteditable autofocus><title>Flipper Zero BadUSB Demo</title><style>body{font-family:monospace;}
ENTER
DELAY 500
STRING Hello World!
ENTER
REM Copy-Paste previous string
UP
HOME
SHIFT DOWN
CTRL c
RIGHT
CTRL v
CTRL v
STRING =
REPEAT 59
ENTER
ENTER
STRING _.-------.._ -,
ENTER
HOME
STRING .-"```"--..,,_/ /`-, -, \
ENTER
HOME
STRING .:" /:/ /'\ \ ,_..., `. | |
ENTER
HOME
STRING / ,----/:/ /`\ _\~`_-"` _;
ENTER
HOME
STRING ' / /`"""'\ \ \.~`_-' ,-"'/
ENTER
HOME
STRING | | | 0 | | .-' ,/` /
ENTER
HOME
STRING | ,..\ \ ,.-"` ,/` /
ENTER
HOME
STRING ; : `/`""\` ,/--==,/-----,
ENTER
HOME
STRING | `-...| -.___-Z:_______J...---;
ENTER
HOME
STRING : ` _-'
ENTER
HOME
STRING _L_ _ ___ ___ ___ ___ ____--"`
ENTER
HOME
STRING | __|| | |_ _|| _ \| _ \| __|| _ \
ENTER
HOME
STRING | _| | |__ | | | _/| _/| _| | /
ENTER
HOME
STRING |_| |____||___||_| |_| |___||_|_\
ENTER
HOME
ENTER
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
ENTER
STRING More information about script syntax can be found here:
ENTER
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md
ENTER

View File

@@ -0,0 +1,95 @@
ID 1234:abcd Generic:USB Keyboard
REM Declare ourselves as a generic usb keyboard
REM You can override this to use something else
REM Check the `lsusb` command to know your own devices IDs
REM This is BadUSB demo script for Linux/Gnome
REM Exit from Overview
ESC
DELAY 200
REM Open terminal window
ALT F2
DELAY 1000
REM Let's guess user terminal, based on (almost) glib order with ptyxis now default in Fedora 41
STRING sh -c "xdg-terminal-exec||kgx||ptyxis||gnome-terminal||mate-terminal||xfce4-terminal||tilix||konsole||xterm"
DELAY 300
ENTER
REM It can take a bit to open the correct terminal
DELAY 1500
REM Make sure we are running in a POSIX-compliant shell
STRING env sh
ENTER
REM Clear the screen in case some banner was displayed
STRING clear
ENTER
REM Bigger shell script example
STRING cat > /dev/null << EOF
ENTER
STRING Hello World!
ENTER
DEFAULT_DELAY 50
STRING =
REPEAT 59
ENTER
ENTER
STRING _.-------.._ -,
ENTER
HOME
STRING .-"'''"--..,,_/ /'-, -, \
ENTER
HOME
STRING .:" /:/ /'\ \ ,_..., '. | |
ENTER
HOME
STRING / ,----/:/ /'\ _\~'_-"' _;
ENTER
HOME
STRING ' / /'"""'\ \ \.~'_-' ,-"'/
ENTER
HOME
STRING | | | 0 | | .-' ,/' /
ENTER
HOME
STRING | ,..\ \ ,.-"' ,/' /
ENTER
HOME
STRING ; : '/'""\' ,/--==,/-----,
ENTER
HOME
STRING | '-...| -.___-Z:_______J...---;
ENTER
HOME
STRING : ' _-'
ENTER
HOME
STRING _L_ _ ___ ___ ___ ___ ____--"'
ENTER
HOME
STRING | __|| | |_ _|| _ \| _ \| __|| _ \
ENTER
HOME
STRING | _| | |__ | | | _/| _/| _| | /
ENTER
HOME
STRING |_| |____||___||_| |_| |___||_|_\
ENTER
HOME
ENTER
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
ENTER
STRING More information about script syntax can be found here:
ENTER
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md
ENTER
STRING EOF
ENTER

View File

@@ -0,0 +1,13 @@
REM Credit: @Mr-Proxy-source and @Willy-JL
GUI h
DELAY 1000
GUI SPACE
DELAY 250
STRING https://github.com/Next-Flip/Momentum-Firmware
DELAY 75
TAB
DELAY 75
ENTER
DELAY 150
ENTER

View File

@@ -0,0 +1,86 @@
ID 1234:5678 Apple:Keyboard
REM You can change these values to VID/PID of original Apple keyboard
REM to bypass Keyboard Setup Assistant
REM This is BadUSB demo script for macOS
REM Open terminal window
DELAY 1000
GUI SPACE
DELAY 500
STRING terminal
DELAY 500
ENTER
DELAY 750
REM Copy-Paste previous string
UP
CTRL c
REM Bigger shell script example
STRING cat > /dev/null << EOF
ENTER
STRING Hello World!
ENTER
DEFAULT_DELAY 50
STRING =
REPEAT 59
ENTER
ENTER
STRING _.-------.._ -,
ENTER
HOME
STRING .-"'''"--..,,_/ /'-, -, \
ENTER
HOME
STRING .:" /:/ /'\ \ ,_..., '. | |
ENTER
HOME
STRING / ,----/:/ /'\ _\~'_-"' _;
ENTER
HOME
STRING ' / /'"""'\ \ \.~'_-' ,-"'/
ENTER
HOME
STRING | | | 0 | | .-' ,/' /
ENTER
HOME
STRING | ,..\ \ ,.-"' ,/' /
ENTER
HOME
STRING ; : '/'""\' ,/--==,/-----,
ENTER
HOME
STRING | '-...| -.___-Z:_______J...---;
ENTER
HOME
STRING : ' _-'
ENTER
HOME
STRING _L_ _ ___ ___ ___ ___ ____--"'
ENTER
HOME
STRING | __|| | |_ _|| _ \| _ \| __|| _ \
ENTER
HOME
STRING | _| | |__ | | | _/| _/| _| | /
ENTER
HOME
STRING |_| |____||___||_| |_| |___||_|_\
ENTER
HOME
ENTER
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
ENTER
STRING More information about script syntax can be found here:
ENTER
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md
ENTER
STRING EOF
ENTER

View File

@@ -0,0 +1,84 @@
REM This is BadUSB demo script for windows
REM Open windows notepad
DELAY 1000
GUI r
DELAY 500
STRING notepad
DELAY 500
ENTER
DELAY 750
STRING Hello World!
ENTER
DEFAULT_DELAY 50
REM Copy-Paste previous string
UP
HOME
SHIFT DOWN
CTRL c
RIGHT
CTRL v
CTRL v
REM Alt code input demo
ALTCHAR 7
ALTSTRING This line was print using Alt+Numpad input method. It works even if non-US keyboard layout is selected
ENTER
STRING =
REPEAT 59
ENTER
ENTER
STRING _.-------.._ -,
ENTER
HOME
STRING .-"```"--..,,_/ /`-, -, \
ENTER
HOME
STRING .:" /:/ /'\ \ ,_..., `. | |
ENTER
HOME
STRING / ,----/:/ /`\ _\~`_-"` _;
ENTER
HOME
STRING ' / /`"""'\ \ \.~`_-' ,-"'/
ENTER
HOME
STRING | | | 0 | | .-' ,/` /
ENTER
HOME
STRING | ,..\ \ ,.-"` ,/` /
ENTER
HOME
STRING ; : `/`""\` ,/--==,/-----,
ENTER
HOME
STRING | `-...| -.___-Z:_______J...---;
ENTER
HOME
STRING : ` _-'
ENTER
HOME
STRING _L_ _ ___ ___ ___ ___ ____--"`
ENTER
HOME
STRING | __|| | |_ _|| _ \| _ \| __|| _ \
ENTER
HOME
STRING | _| | |__ | | | _/| _/| _| | /
ENTER
HOME
STRING |_| |____||___||_| |_| |___||_|_\
ENTER
HOME
ENTER
STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format
ENTER
STRING More information about script syntax can be found here:
ENTER
STRING https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/file_formats/BadUsbScriptFormat.md
ENTER

View File

@@ -0,0 +1,46 @@
ID 1234:abcd Generic:USB Keyboard
REM Declare ourselves as a generic usb keyboard
REM You can override this to use something else
REM Check the `lsusb` command to know your own devices IDs
DEFAULT_DELAY 200
DEFAULT_STRING_DELAY 100
DELAY 1000
REM Test all mouse functions
LEFTCLICK
RIGHTCLICK
MIDDLECLICK
DELAY 1000
MOUSEMOVE -10 0
REPEAT 20
MOUSEMOVE 0 10
REPEAT 20
MOUSEMOVE 10 0
REPEAT 20
MOUSEMOVE 0 -10
REPEAT 20
DELAY 1000
MOUSESCROLL -50
MOUSESCROLL 50
DELAY 1000
REM Verify Mouse hold working
HOLD LEFTCLICK
DELAY 2000
RELEASE LEFTCLICK
DELAY 1000
REM Verify KB hold working
HOLD M
DELAY 2000
RELEASE M
ENTER