diff --git a/README.md b/README.md index d646cab..5df8b23 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # 🦆 DuckyScript Cookbook -[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Faleff-github%2FDuckyScriptCookbook%2F&count_bg=%23FFBD11&title_bg=%23800000&icon=visualstudiocode.svg&icon_color=%233CA8F1&title=HITS&edge_flat=false)](https://hits.seeyoufarm.com) ![Licence](https://img.shields.io/badge/Licence-GPLv3-%239e264c?style=for-the-badge) - Welcome to the **DuckyScript Cookbook** — your quacktastic assistant for whipping up DuckyScript magic in no time! 🚀 _This is not an official extension of Hak5 or Flipper Zero but was developed by a third party._ diff --git a/out/cpanel/code_panel_view_provider.js b/out/cpanel/code_panel_view_provider.js new file mode 100644 index 0000000..8f13aba --- /dev/null +++ b/out/cpanel/code_panel_view_provider.js @@ -0,0 +1,265 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodePanelViewProvider = void 0; +const vscode = require("vscode"); +const consts_1 = require("../utils/consts"); +const cpanel = require("./run"); +class CodePanelViewProvider { + constructor(_extension) { + this._extension = _extension; + } + resolveWebviewView(webviewView, context, _token) { + webviewView.webview.options = { + // Allow scripts in the webview + enableScripts: true, + enableForms: true, + enableCommandUris: true, + localResourceRoots: [ + this._extension.extensionUri + ] + }; + webviewView.webview.html = this._getHtmlForWebview(webviewView.webview); + webviewView.webview.onDidReceiveMessage(data => { + // select text + const active = vscode.window.activeTextEditor; + if (!active) { + return; + } // null check + const selection = active.selection; + if (!selection) { + return; + } // null check + switch (data.type) { + // DuckyScript 3.0 Payloads + case 'PAYLOAD_INTRO_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.PAYLOAD_INTRO_3_0))); + }); + break; + case 'DETECT_READY_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.DETECT_READY_3_0))); + }); + break; + case 'PASSIVE_WINDOWS_DETECT_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.PASSIVE_WINDOWS_DETECT_3_0))); + }); + break; + case 'ERASE_TRACES_SHELL_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.ERASE_TRACES_SHELL_3_0))); + }); + break; + case 'ERASE_TRACES_POWERSHELL_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.ERASE_TRACES_POWERSHELL_3_0))); + }); + break; + case 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_3_0))); + }); + break; + case 'OPEN_POWERSHELL_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.OPEN_POWERSHELL_3_0))); + }); + break; + case 'SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.SAVE_FILES_IN_RUBBER_DUCKY_STORAGE_WINDOWS_3_0))); + }); + break; + case 'GENERALIZED_WINDOWS_USER_PATH_3_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.GENERALIZED_WINDOWS_USER_PATH_3_0))); + }); + break; + // DuckyScript 1.0 Payloads + case 'PAYLOAD_INTRO_1_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.PAYLOAD_INTRO_1_0))); + }); + break; + case 'ERASE_TRACES_POWERSHELL_1_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.ERASE_TRACES_POWERSHELL_1_0))); + }); + break; + case 'ERASE_TRACES_SHELL_1_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.ERASE_TRACES_SHELL_1_0))); + }); + break; + case 'EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.EXFILTRATE_FILES_USING_DROPBOX_WINDOWS_1_0))); + }); + break; + case 'OPEN_POWERSHELL_1_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.OPEN_POWERSHELL_1_0))); + }); + break; + case 'GENERALIZED_WINDOWS_USER_PATH_1_0': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.GENERALIZED_WINDOWS_USER_PATH_1_0))); + }); + break; + // Both + case 'OPEN_SHELL': + active.edit(editBuilder => { + const code = new cpanel.Code(this._extension.extensionUri); + editBuilder.replace(selection, code.duckyscript(this._extension.asAbsolutePath(consts_1.PATH_TO_COOKBOOK.OPEN_SHELL))); + }); + break; + // showPanel + case 'showPanel': + this.showPanel(webviewView.webview); + break; + } + }); + vscode.window.onDidChangeActiveTextEditor((editor) => { + this.showPanel(webviewView.webview); + }); + } + _getHtmlForWebview(webview) { + // Do the same for the stylesheet. + const styleMainUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extension.extensionUri, 'media', 'css', 'main.css')); + // Get the local path to main script run in the webview, then convert it to a uri we can use in the webview. + const scriptMainUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extension.extensionUri, 'media', 'js', 'main.js')); + // Use a nonce to only allow a specific script to be run. + const nonce = getNonce(); + const cpBody = getCodePanelBody(); + return ` + +
+ + + + + +