/DigiSparkHID-Scripter

A GUI tool which generates the digispark hid code by typing mnemonics.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

DigiSparkHID-Scripter

A GUI tool which generates the digispark hid code by typing mnemonics.

Key Features

  • Simple and clean GUI.
  • Two large windows one for mnemonics and other for digispark code.
  • Convert Button - Convert mnemonics to digispark script.
  • Copy Button - Copy digispark script to the clipboard so that it can paste anywhere.
  • Reset Button - Clear all data from both windows.
  • Save Button - Save digispark scripts on the system for future use.
  • Exit Button - Close the application.

New Features Added!

  • for Loop added.
  • Next line function added.
  • TYPE and TYNL supports ".
  • TYPE and TYNL supports \.
  • Multiple statements are supported inside for loop.
  • WRITE function added.

Supported Arduino Boards

The following boards are working on a microcontroller named ATtiny85.

  • It has a built-in USB Communication so that it can act as Keyboard, Mouse, Game Controller etc.
  • List of supported boards :
  1. Digispark ATtiny85 (USB Type-A)
  2. Digispark ATtiny85 (Micro USB)

Credits

The mnemoics used in this tool is heavily inspired by Hak5 Ducky Script.

Setup

  1. Make sure the latest python and pip3 is installed on your system (Windows/Linux/MacOS).
  2. Download Arduino IDE from here according to your Operating System.
  3. Install it.
  4. Done! All required libraries are pre-installed in Arduino IDE.

Mnemonic Table

Mnemonics Description Example
TYPE It add text want to type in the code and put the cursor on the same line. TYPE Hello World!
TYNL It add text want to type in the code and put the cursor on the next line. TYNL DigiSparkHID Scripter
WAIT It add time in the code. WAIT 1000
PRESS It press and hold the key(s) and then release all key(s). PRESS GUI R
REDO It add loop in the code. REDO 6 TYPE Hello World!

Details of Mnemonics

1. TYPE

  • It add text want to type in the code and put the cursor on the same line.
  • NEW - It supports " " in the TYPE.
  • Example - TYPE Hello World!

2. TYNL

  • It add text want to type in the code and put the cursor on the next line.
  • NEW - It supports " " in the TYNL.
  • Example - TYNL Hello World!

3. WAIT

  • It add time in the code.
  • It gives time to execute between two commands.
  • Time is in milliseconds.
  • 1000 ms = 1 second.
  • Example - WAIT 1000

4. PRESS

  • It press and hold the key(s) and then release all key(s).
  • The supported mnemonics given below works with PRESS.
  • Example -
  1. PRESS GUI R
  2. PRESS CTRL SHIFT N
  3. PRESS CTRL SHIFT ENTER

5. REDO

  • It add loop in the code.
  • The loop used in this is for loop.
  • It takes two values : Number of repeatation and Statement inside the loop.
  • Example - REDO 6 TYPE Hello World!
  • Here, 6 is number of repetations and TYPE Hello World! is the statement.
  • NEW - It supports multi statements.
  • Multi statement are separated by comma ,.
  • Example - REDO 9 TYPE Hello World!, WAIT 1000, TYPE This is a test for script!
  • Here, TYPE Hello World!, WAIT 1000 and TYPE This is a test for script! are three statements and they are separated by commas.
  • REDO only supports TYPE, TYNL and WAIT Only.

Supported Mnemonics

Alphabet Keys

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Function Keys

F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12

Navigation Keys

LEFT UP RIGHT DOWN TAB HOME END PGUP PGDN

Lock Keys

CAPS NUM SCROLL

System and GUI Keys

GUI ESC PRTSCR PAUSE

Editing Keys

INSERT DEL BKSP ENTER

Modifier Keys

CTRL SHIFT ALT

ASCII Characters

` - = [ ] \ ; ' , . / SPACE : " < > ? 0 1 2 3 4 5 6 7 8 9

Examples

Example - 1 : Mnemonic for Open Notepad and Type

WAIT 1000
PRESS GUI R
WAIT 1000
TYPE notepad
WAIT 1000
PRESS ENTER
WAIT 1000
TYPE This is a test for digispark script developed by DigiSparkHID Scripter!

after click on Convert button, the digispark script of the following mnemonic is :

#include<DigiKeyboard.h>
void setup()
{
 DigiKeyboard.delay(1000);
 DigiKeyboard.sendKeyStroke(KEY_R,MOD_GUI_LEFT);
 DigiKeyboard.delay(1000);
 DigiKeyboard.print("notepad");
 DigiKeyboard.delay(1000);
 DigiKeyboard.sendKeyStroke(KEY_ENTER);
 DigiKeyboard.delay(1000);
 DigiKeyboard.print("This is a test for digispark script developed by DigiSparkHID Scripter!");
}
void loop()
{
 //Nothing to do here ;)
}

Just copy this code and paste it in the Arduino IDE.

Example - 2 : Mnemonic for Open Notepad and Type 6 times

WAIT 1000
PRESS GUI R
WAIT 1000
TYPE notepad
WAIT 1000
PRESS ENTER
WAIT 1000
REDO 6 TYNL This is a test for digispark script developed by DigiSparkHID Scripter!

after click on Convert button, the digispark script of the following mnemonic is :

#include<DigiKeyboard.h>
void setup()
{
 DigiKeyboard.delay(1000);
 DigiKeyboard.sendKeyStroke(KEY_R,MOD_GUI_LEFT);
 DigiKeyboard.delay(1000);
 DigiKeyboard.print("notepad");
 DigiKeyboard.delay(1000);
 DigiKeyboard.sendKeyStroke(KEY_ENTER);
 DigiKeyboard.delay(1000);
 for (int i=1; i<=6; i++)
 {
  DigiKeyboard.println("This is a test for digispark script developed by DigiSparkHID Scripter!");
 }
}
void loop()
{
 //Nothing to do here ;)
}

Just copy this code and paste it in the Arduino IDE.

Tested Systems

The tool is currently tested on :

  • Windows (10)

Before coding...

Start your code with WAIT so that board get time to initiate.

Install and Run

  1. Download or Clone the Repository.
  2. Open the folder and just double click on DigiSparkHIDScripter.py file.
  3. Type the mnemonics in the left window.
  4. Click on Convert button to get corresponding digispark script.
  5. Click on Copy button to copy the digispark script to the clipboard.
  6. Paste the code in the Arduino IDE.
  7. Compile the code.
  8. Select the board from the Tools.
  9. Select the port number of that board.
  10. Upload the code.
  11. When it ask for Plug in device now... (will timeout in 60 seconds), then connect the board to the PC/Laptop.
  12. When Micronucleus done. Thank you! show, plug out the board from PC/Laptop. -Be Careful! As it is uploaded the script start executing.