sRDI icon indicating copy to clipboard operation
sRDI copied to clipboard

'PE' does not exist in the current context error

Open 1nPr0c opened this issue 2 years ago • 1 comments

Attempting to convert a simple DLL to shellcode, but receiving the following error. Am I doing something incorrect?

Note: DLL is 64bit

PS C:\Users\dev\Desktop\sRDI\PowerShell> Invoke-Shellcode -Shellcode (ConvertTo-Shellcode -File MessageBoxDLL.dll)
Add-Type : c:\Users\dev\AppData\Local\Temp\pn4hozhz\pn4hozhz.0.cs(65) : The name 'PE' does not exist in the current
context
c:\Users\dev\AppData\Local\Temp\pn4hozhz\pn4hozhz.0.cs(64) :
c:\Users\dev\AppData\Local\Temp\pn4hozhz\pn4hozhz.0.cs(65) : >>>         if (PE.Is64BitDLL(dllBytes))
c:\Users\dev\AppData\Local\Temp\pn4hozhz\pn4hozhz.0.cs(66) :         {
At C:\Users\dev\Desktop\sRDI\PowerShell\ConvertTo-Shellcode.ps1:353 char:5
+     Add-Type -TypeDefinition $Source -Language CSharp -CompilerParame ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Except
   ion
    + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand

1nPr0c avatar May 29 '22 18:05 1nPr0c

check out my fork, it fixes the issue

d4rckh avatar Aug 16 '22 12:08 d4rckh

Thanks @d4rckh - that fix worked!

1nPr0c avatar Sep 19 '22 08:09 1nPr0c