The BadUsbInterpreter
is a C# utility designed to simulate keyboard inputs programmatically. It processes command-like input lines to simulate keystrokes, key combinations, delays, and other keyboard interactions on a Windows system. This tool is particularly useful for scripting automated input sequences, such as those used in penetration testing scenarios where a BadUSB device might be involved.
- Introduction
- Features
- Installation
- Usage
- Configuration
- Dependencies
- Examples
- Troubleshooting
- Contributors
- License
- Version limitation
- Command-based Input Simulation: Execute commands like
STRING
,DELAY
,GUI
,CTRL
,SHIFT
,ALT
, and more to simulate keyboard actions. - Support for Delays: Set default or specific delays between commands for more controlled input simulation.
- Command Repetition: Repeat the last executed command a specified number of times using the
REPEAT
command. - Key Combinations: Simulate key combinations involving control keys like
CTRL
,ALT
,SHIFT
, etc. - Customizable Input: Easily modify the script to add support for additional keys or commands.
To use the BadUsbInterpreter
, follow these steps:
-
Clone the Repository:
git clone https://github.com/blod22/BadUsbDeveloperAndTester.git
-
Build the Project:
Open the project in Visual Studio or use the .NET CLI to build:dotnet build
-
Run the Application:
Execute the application with your script file as input.
You can use BadUsbInterpreter
by running a script that contains lines of commands. Each command will be executed sequentially to simulate keyboard inputs.
DEFAULT_DELAY 100
STRING Hello, World!
ENTER
DELAY 500
CTRL C
REPEAT 2
- DEFAULT_DELAY
<ms>
: Sets the default delay between commands. - STRING
<text>
: Types the provided text. - DELAY
<ms>
: Pauses for the specified number of milliseconds. - GUI
<key>
: Simulates the Windows key press with the specified key. - CTRL
<key>
: Simulates a CTRL +<key>
combination. - SHIFT
<key>
: Simulates a SHIFT +<key>
combination. - ALT
<key>
: Simulates an ALT +<key>
combination. - REPEAT
<count>
: Repeats the last command<count>
times.
You can configure the interpreter by modifying the default delay and other parameters directly in the source code. The defaultDelay
variable controls the pause between commands, and other configurations can be adjusted according to your needs.
The project depends on the following libraries:
- WindowsInput: A library for simulating keyboard and mouse input in .NET applications.
STRING Hello, this is a test.
ENTER
DEFAULT_DELAY 200
STRING First line.
ENTER
REPEAT 3
STRING This will repeat 3 times.
ENTER
- Invalid Command: Ensure that each command is spelled correctly and matches the expected syntax.
- Unhandled Key: If the script attempts to use a key that is not supported, you'll need to add support for that key in the source code or modify the script.
- blod22 - Initial work
This project is licensed under the MIT License - see the LICENSE file for details.
Current version doesnćt support ALTCHAR, ALTSTRING and ALTCODE commands