├── .gitignore ├── 3d_models ├── duckycpark_flash.3dm ├── duckyspark_flash.jpg ├── duckyspark_flash.stl └── duckyspark_flash1.stl ├── Duckyspark_translator.py ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.ino 3 | *.txt 4 | -------------------------------------------------------------------------------- /3d_models/duckycpark_flash.3dm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxydose/Duckyspark/db2bcd9b7243884bf42b8e2200a79443659de28c/3d_models/duckycpark_flash.3dm -------------------------------------------------------------------------------- /3d_models/duckyspark_flash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxydose/Duckyspark/db2bcd9b7243884bf42b8e2200a79443659de28c/3d_models/duckyspark_flash.jpg -------------------------------------------------------------------------------- /3d_models/duckyspark_flash.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxydose/Duckyspark/db2bcd9b7243884bf42b8e2200a79443659de28c/3d_models/duckyspark_flash.stl -------------------------------------------------------------------------------- /3d_models/duckyspark_flash1.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toxydose/Duckyspark/db2bcd9b7243884bf42b8e2200a79443659de28c/3d_models/duckyspark_flash1.stl -------------------------------------------------------------------------------- /Duckyspark_translator.py: -------------------------------------------------------------------------------- 1 | # !/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # Duckyspark - Translator from USB-Rubber-Ducky payloads (Ducky script) to a Digispark code. 5 | # Authors: 6 | # Alex Bridges https://github.com/toxydose 7 | # https://awake.pro/ 8 | # Vlad Khomenko https://github.com/eclipse7 9 | # 10 | # Usage of this program is only allowed within boundaries of law. 11 | # Developers assume no liability and are not responsible for any misuse or damage caused by this program. 12 | 13 | 14 | from __future__ import print_function 15 | import sys 16 | 17 | out = sys.__stdout__ 18 | 19 | VERSION = '0.4.1' 20 | HELP = ''' 21 | ========== Duckyspark v.''' + VERSION + ''' ============================== 22 | https://github.com/toxydose/Duckyspark/ 23 | Translator from USB-Rubber-Ducky payloads (Ducky script) to a Digispark code. 24 | ============================================================= 25 | Authors: 26 | Alex Bridges https://github.com/toxydose 27 | Vlad Khomenko https://github.com/eclipse7 28 | https://awake.pro/ community 29 | 30 | Options: 31 | -h, --help Show basic help message and exit 32 | 33 | Usage: 34 | 35 | python3 Duckyspark_translator.py [payload.txt] [output_file] - 36 | specify payload file and output file 37 | 38 | python Duckyspark_translator.py [payload.txt] - 39 | translated payload will be saved in "digipayload.ino" 40 | 41 | --------------------------------------------------------------- 42 | Ducky payloads you can find here: 43 | https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads 44 | 45 | Or, you can simply write your own payloads using Ducky script: 46 | https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript 47 | ---------------------------------------------------------------- 48 | ''' 49 | 50 | SUCCESS = 'Success!' 51 | ERROR = 'ERROR! -h or --help for help\n' 52 | 53 | # order is important 54 | SPECIAL_BUTTONS = {'CONTROL_RIGHT': 'MOD_CONTROL_RIGHT', 55 | 'CONTROL_LEFT': 'MOD_CONTROL_LEFT', 56 | 'CONTROL': 'MOD_CONTROL_LEFT', 57 | 58 | 'CTRL_RIGHT': 'MOD_CONTROL_RIGHT', 59 | 'CTRL_LEFT': 'MOD_CONTROL_LEFT', 60 | 'CTRL': 'MOD_CONTROL_LEFT', 61 | 62 | 'SHIFT_RIGHT': 'MOD_SHIFT_RIGHT', 63 | 'SHIFT_LEFT': 'MOD_SHIFT_LEFT', 64 | 'SHIFT': 'MOD_SHIFT_LEFT', 65 | 66 | 'ALT_RIGHT': 'MOD_ALT_RIGHT', 67 | 'ALT_LEFT': 'MOD_ALT_LEFT', 68 | 'ALT': 'MOD_ALT_LEFT', 69 | 70 | 'GUI_RIGHT': 'MOD_GUI_RIGHT', 71 | 'GUI_LEFT': 'MOD_GUI_LEFT', 72 | 'GUI': 'MOD_GUI_LEFT', 73 | 'WINDOWS': 'MOD_GUI_LEFT'} 74 | 75 | # menu = Shift + F10 76 | BUTTONS = {'a': 'KEY_A', 77 | 'b': 'KEY_B', 78 | 'c': 'KEY_С', 79 | 'd': 'KEY_D', 80 | 'e': 'KEY_E', 81 | 'f': 'KEY_F', 82 | 'g': 'KEY_G', 83 | 'h': 'KEY_H', 84 | 'i': 'KEY_I', 85 | 'j': 'KEY_J', 86 | 'k': 'KEY_K', 87 | 'l': 'KEY_L', 88 | 'm': 'KEY_M', 89 | 'n': 'KEY_N', 90 | 'o': 'KEY_O', 91 | 'p': 'KEY_P', 92 | 'q': 'KEY_Q', 93 | 'r': 'KEY_R', 94 | 's': 'KEY_S', 95 | 't': 'KEY_T', 96 | 'u': 'KEY_U', 97 | 'v': 'KEY_V', 98 | 'w': 'KEY_W', 99 | 'x': 'KEY_X', 100 | 'y': 'KEY_Y', 101 | 'z': 'KEY_Z', 102 | 103 | 'F1': 'KEY_F1', 104 | 'F2': 'KEY_F2', 105 | 'F3': 'KEY_F3', 106 | 'F4': 'KEY_F4', 107 | 'F5': 'KEY_F5', 108 | 'F6': 'KEY_F6', 109 | 'F7': 'KEY_F7', 110 | 'F8': 'KEY_F8', 111 | 'F9': 'KEY_F9', 112 | 'F10': 'KEY_F10', 113 | 'F11': 'KEY_F11', 114 | 'F12': 'KEY_F12', 115 | 116 | 'LEFTARROW': 'KEY_ARROW_LEFT', 117 | 'RIGHTARROW': 'KEY_ARROW_RIGHT', 118 | 'UPARROW': 'KEY_ARROW_UP', 119 | 'DOWNARROW': 'KEY_ARROW_DOWN', 120 | 'LEFT': 'KEY_ARROW_LEFT', 121 | 'RIGHT': 'KEY_ARROW_RIGHT', 122 | 'UP': 'KEY_ARROW_UP', 123 | 'DOWN': 'KEY_ARROW_DOWN', 124 | 125 | 'DELETE': 'KEY_DELETE', 126 | 'DEL': 'KEY_DELETE', 127 | 'PRINTSCREEN': 'KEY_PRT_SCR', 128 | 'TAB': 'KEY_TAB', 129 | 'ESCAPE': 'KEY_ESC', 130 | 'SPACE': 'KEY_SPACE', 131 | 'ENTER': 'KEY_ENTER'} 132 | 133 | # arguments 134 | payload_input = '' 135 | payload_len = 0 136 | 137 | if '-h' in sys.argv or '--help' in sys.argv: 138 | print(HELP) 139 | exit() 140 | elif '-v' in sys.argv or '--version' in sys.argv: 141 | print (''' 142 | ========== Duckyspark v.''' + VERSION + ''' ============================== 143 | https://github.com/toxydose/Duckyspark/ 144 | Translator from USB-Rubber-Ducky payloads (Ducky script) to a Digispark code. 145 | =============================================================''') 146 | exit() 147 | elif len(sys.argv) == 2: 148 | try: 149 | payload_input = open(sys.argv[1], "r") 150 | sys.stdout = open("digipayload.ino", "w") 151 | payload_len = len(open(sys.argv[1], "r").readlines()) 152 | except IOError: 153 | error_reason = ('File "' + sys.argv[1] + '" does not exist!\n') 154 | print(ERROR + error_reason) 155 | exit() 156 | elif len(sys.argv) == 3: 157 | try: 158 | payload_input = open(sys.argv[1], "r") 159 | sys.stdout = open(sys.argv[2] + '.ino', 'w') 160 | payload_len = len(open(sys.argv[1], "r").readlines()) 161 | except IOError: 162 | error_reason = ('File "' + sys.argv[1] + '" does not exist!\n') 163 | print(ERROR + error_reason) 164 | exit() 165 | elif len(sys.argv) > 3: 166 | error_reason = 'Too much Arguments' 167 | print(ERROR + error_reason) 168 | exit() 169 | else: 170 | try: 171 | payload_input = open('payload.txt', "r") 172 | sys.stdout = open("digipayload.ino", "w") 173 | payload_len = len(open('payload.txt', "r").readlines()) 174 | except FileNotFoundError: 175 | print('\nERROR: Payload file "payload.txt" was not found') 176 | print(HELP) 177 | exit() 178 | 179 | # Digispark program fragment 180 | print ('''//generated by Duckyspark https://github.com/toxydose/Duckyspark 181 | 182 | #include "DigiKeyboard.h" 183 | #define KEY_ESC 41 184 | #define KEY_BACKSPACE 42 185 | #define KEY_TAB 43 186 | #define KEY_PRT_SCR 70 187 | #define KEY_DELETE 76 188 | #define KEY_ARROW_RIGHT 0x4F 189 | #define KEY_ARROW_DOWN 0x51 190 | #define KEY_ARROW_UP 0x52 191 | 192 | void setup() { 193 | 194 | DigiKeyboard.delay(5000); 195 | DigiKeyboard.sendKeyStroke(0); 196 | ''') 197 | # --------------------------------------- 198 | 199 | for i in range(payload_len): 200 | line = payload_input.readline().replace('\n', '') 201 | 202 | if len(line) < 1: 203 | print('', end='') 204 | 205 | else: 206 | 207 | if 'REM' in line: 208 | print('//', line.replace('REM ', '')) 209 | 210 | else: 211 | if 'DELAY' in line: 212 | print('DigiKeyboard.', end='') 213 | print(line.replace('DELAY', 'delay(').replace(' ', ''), end='') 214 | print(');') 215 | 216 | elif 'STRING' in line: 217 | print('DigiKeyboard.', end='') 218 | print(line.replace('"', '")); DigiKeyboard.print(char(34)); DigiKeyboard.print(F("') 219 | .replace('\\', '")); DigiKeyboard.print(char(92)); DigiKeyboard.print(F("') 220 | .replace('STRING ', 'print(F("'), end='') 221 | print('")', end='') 222 | print(');') 223 | 224 | elif 'MENU' in line: 225 | line = 'KEY_F10' 226 | mod = 'MOD_SHIFT_LEFT' 227 | print('DigiKeyboard.', end='') 228 | print('sendKeyStroke(', end='') 229 | print(str(line), end='') 230 | print(',' + mod, end='') 231 | print(');') 232 | 233 | else: 234 | mod = '' 235 | for key in SPECIAL_BUTTONS.keys(): 236 | if key in line: # order in keys is important 237 | line = line.replace(key, '') 238 | mod += SPECIAL_BUTTONS.get(key) + ' | ' 239 | mod += '0' 240 | 241 | line = line.replace(' ', '') 242 | if line in BUTTONS.keys(): 243 | line = BUTTONS.get(line) 244 | else: 245 | line = '0' 246 | 247 | print('DigiKeyboard.', end='') 248 | print('sendKeyStroke(', end='') 249 | print(str(line), end='') 250 | print(',' + mod, end='') 251 | print(');') 252 | 253 | if len(line) < 1: 254 | print('', end='') 255 | 256 | # Digispark program fragment 257 | print(''' 258 | } 259 | 260 | 261 | void loop() { 262 | 263 | }''') 264 | # ----------------------------------- 265 | 266 | payload_input.close() 267 | sys.stdout = out 268 | print(SUCCESS) 269 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Alexander Bridges 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Duckyspark v.0.4.1 2 | 3 | Translator from USB-Rubber-Ducky payloads (Ducky script) to a Digispark code. 4 | 5 | ### DISCLAIMER: 6 | 7 | Usage of this program is only allowed within boundaries of law. Developers assume no liability and are not responsible for any misuse or damage caused by this program. 8 | 9 | # Usage: 10 | 11 | python3 Duckyspark_translator.py [payload.txt] [output_file] 12 | 13 | ### or 14 | 15 | python3 Duckyspark_translator.py [payload.txt] 16 | ###### in this case the translated payload will be saved in the file "digipayload.ino" 17 | 18 | 19 | Ducky payloads you can find here: https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads 20 | 21 | or here: https://github.com/CedArctic/DigiSpark-Scripts 22 | 23 | Or, you can simply write your own payloads using Ducky script 24 | 25 | Ducky script syntax: https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript 26 | 27 | Recently we found the video "Digispark Flashing Guide & Ducky Payload Converters" that shows how to flash Digispark using the payloads generated by our script: https://www.youtube.com/watch?v=Lrn_hgckhGw&lc 28 | 29 | Our site: https://awake.pro/ 30 | 31 | Upd: added 3d models of USB flesh drive to hide Digispark. 32 | 33 | You could edit 3d model, or just print on 3d printer ready-for-print .stl models 34 | ![duckyspark_flash](https://user-images.githubusercontent.com/20900400/56039187-5d861500-5d3c-11e9-8c4c-b385f8a05b6f.jpg) 35 | --------------------------------------------------------------------------------