+ Invalid Cast Fix
This is a fix for https://github.com/PowerShellMafia/PowerSploit/issues/151
This commit is contained in:
parent
872f711e3d
commit
b895866c3b
|
|
@ -2416,7 +2416,7 @@ function Invoke-CredentialInjection
|
||||||
$PEInfo = Get-PEBasicInfo -PEBytes $PEBytes -Win32Types $Win32Types
|
$PEInfo = Get-PEBasicInfo -PEBytes $PEBytes -Win32Types $Win32Types
|
||||||
$OriginalImageBase = $PEInfo.OriginalImageBase
|
$OriginalImageBase = $PEInfo.OriginalImageBase
|
||||||
$NXCompatible = $true
|
$NXCompatible = $true
|
||||||
if (($PEInfo.DllCharacteristics -band $Win32Constants.IMAGE_DLLCHARACTERISTICS_NX_COMPAT) -ne $Win32Constants.IMAGE_DLLCHARACTERISTICS_NX_COMPAT)
|
if (([Int] $PEInfo.DllCharacteristics -band $Win32Constants.IMAGE_DLLCHARACTERISTICS_NX_COMPAT) -ne $Win32Constants.IMAGE_DLLCHARACTERISTICS_NX_COMPAT)
|
||||||
{
|
{
|
||||||
Write-Warning "PE is not compatible with DEP, might cause issues" -WarningAction Continue
|
Write-Warning "PE is not compatible with DEP, might cause issues" -WarningAction Continue
|
||||||
$NXCompatible = $false
|
$NXCompatible = $false
|
||||||
|
|
@ -2474,7 +2474,7 @@ function Invoke-CredentialInjection
|
||||||
Write-Verbose "Allocating memory for the PE and write its headers to memory"
|
Write-Verbose "Allocating memory for the PE and write its headers to memory"
|
||||||
|
|
||||||
[IntPtr]$LoadAddr = [IntPtr]::Zero
|
[IntPtr]$LoadAddr = [IntPtr]::Zero
|
||||||
if (($PEInfo.DllCharacteristics -band $Win32Constants.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) -ne $Win32Constants.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
|
if (([Int] $PEInfo.DllCharacteristics -band $Win32Constants.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) -ne $Win32Constants.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE)
|
||||||
{
|
{
|
||||||
Write-Warning "PE file being reflectively loaded is not ASLR compatible. If the loading fails, try restarting PowerShell and trying again" -WarningAction Continue
|
Write-Warning "PE file being reflectively loaded is not ASLR compatible. If the loading fails, try restarting PowerShell and trying again" -WarningAction Continue
|
||||||
[IntPtr]$LoadAddr = $OriginalImageBase
|
[IntPtr]$LoadAddr = $OriginalImageBase
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue