英文:
How to use Peverify.exe (PEVerify tool)?
问题
我看到了一些帖子(尤其是这个帖子),讨论了如何使用 peverify.exe
来检查 .net exe(或 dll)是否包含不安全的代码。但无论我怎么做,我都一直收到“文件未找到或具有错误的标头”错误。
以下是我的步骤 -
- 打开 2022 年的开发者 PowerShell - 请注意,我没有更改 exe 所在的路径。
peverify <dll 或 exe 的完整路径>
- 输入
我一直收到“文件未找到或具有错误的标头”错误。这应该很简单,但我似乎漏掉了什么?
其他尝试 使用不同的命令,但结果相同,如下所示
- peverify.exe <exe/dll 的完整路径> /md /il
- 尝试在 Visual Studio 2022 的开发者命令提示符中运行相同命令
英文:
I saw a couple of post(this post specifically) talking about using peverify.exe
to check whether the .net exe(or dll) contains unsafe code. But no matter what I do I keep getting File not found or has bad headers
error.
Here are my steps -
- Open developer power shell for 2022 - Note I did not change the path
to where the exe is. peverify <complete path of the dll or exe>
- Enter
I keep getting File not found or has bad headers
error. This should be simple yet there is something I am missing?
Other attempts with different command with same result is as follows
- peverify.exe <complete path of the exe/dll> /md /il
- Tried running the same in Developer Command Prompt for visual studio
2022
答案1
得分: 1
PEVerify适用于“旧版”Windows特定的.NET Framework。针对.NET 5+和.NET Core创建了一个更新的工具(尽管它也适用于旧的.NET Framework),ILVerify。
要安装和运行(从README中复制,以便此信息在此处而不容易失效):
ILVerify被发布为全局工具包。通过运行以下命令来安装它:
dotnet tool install --global dotnet-ilverify
使用示例:
C:\test>dotnet ilverify hello.dll -r "c:\Program Files\dotnet\shared\Microsoft.NETCore.App.1.12\*.dll" C:\test\hello.dll中的所有类和方法已经验证。
请注意,ILVerify要求明确在命令行上指定要验证的程序集的所有依赖项。
包本身位于NuGet.org上的dotnet-ilverify
(链接)。
英文:
PEVerify is for the "old" Windows-specific .NET Framework. A newer tool was created for .NET 5+ and .NET Core (although it also works with the old .NET Framework), ILVerify.
To install and run (copying from the README, so this information is here instead of susceptible to link rot):
> ILVerify is published as a global tool package. Install it by running:
>
>
> dotnet tool install --global dotnet-ilverify
>
>
> Example of use:
>
>
> C:\test>dotnet ilverify hello.dll -r "c:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.12\*.dll"
> All Classes and Methods in C:\test\hello.dll Verified.
>
>
> Note that ILVerify requires all dependencies of assembly that is being verified to be explicitly specified on the command line.
The package itself is dotnet-ilverify
on NuGet.org (here).
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论