什么工具可以更改现有程序集的属性(特别是程序集名称)?

发布于 2024-11-19 22:24:24 字数 408 浏览 9 评论 0原文

我试图混淆我的 silverlight 应用程序。它包含两个程序集,我正在使用混淆器的“合并程序集”功能。与主程序集 (A1) 合并的程序集 (A2) 具有资源,并且它是本地化程序集,因此有一个根据卫星文化特定程序集名称命名的相应本地化程序集 (A2loc)。

然而,在合并期间,A2(带有资源的程序集)变成了 M(A1+A2),并且 A2localized 不再是 M 的卫星程序集,因为它具有旧的 A2 名称。我很确定是否更改 A2loc 程序集属性以匹配新的程序集名称 M 它将会工作。

问题:例如,可以使用哪种工具获取现有程序集并修改其程序集名称?

当我简单地重命名卫星程序集 A2loc 以匹配 M 程序集名称时,应用程序开始在加载时崩溃。

我描述了整个过程,因为也许有人可以提出更好的方法。

I am trying to obfuscate my silverlight application. It contains two assemblies and I am using a 'merge assemblies' feature of obfuscator. Assembly (A2) that is being merged with main assembly (A1) has resources, and it is a localized assembly so theres a corresponding localized assembly (A2loc) named according to satellite culture specific assembly names.

However during merge A2 (assembly with resources) becomes M(A1+A2) and A2localized can no longer be satellite assembly for M cause it has old A2 name.. Im pretty sure if I change A2loc assembly attributes to match new assembly name M it will be working.

Question: Which tool can be used to take existing assembly and modify its assembly name for example?

When I simply rename satellite assembly A2loc to match M assembly name app begins to crash on load.

I describe whole process cause maybe someone can suggest a better approach.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吻风 2024-11-26 22:24:25

我能够从这里解决以下解决方案 使用 ildasm攻击程序集清单

->转储->编辑IL代码->伊拉斯姆 ->从编辑的 IL 代码生成新的程序集

这里是链接内容,以防它出现故障:

我正在调试一个特别令人讨厌的问题,发现自己想要编辑已编译的 .NET 程序集的清单,以更改它所引用的程序集的版本号。不一定是最佳实践,但在这种情况下,它将使我能够确认确切的问题,而无需两个小时的构建和部署周期。事实证明,像这样的令人讨厌的黑客攻击非常简单:

运行 ILDASM,打开程序集并选择“文件...转储”以提取 IL
在 Visual Studio 中打开 IL 文件并编辑清单 - 在这种情况下,可以在文件顶部轻松找到引用的程序集的版本号:

// Metadata version: v2.0.50727
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 2:0:0:0
}
.assembly extern x.y.z
{
  .publickeytoken = (E4 21 0D 54 23 66 A2 B4 )                         // . .D'f..
  .ver 1:0:9:12
}

保存 IL 并使用 ILASM 重新组装它 - 如果程序集已签名,则重新编译使用 ilasm /DLL xyzil /KEY=xyzsnk 对其进行签名
确保新程序集与原始程序集具有相同的名称,并且它将作为精确替换进行操作,只是现在它的依赖项将针对修改后的版本。
Simon McEnlly 在 CodeProject 上的文章描述了如何进一步使用清单来更改方法的可见性,以及通常在没有源代码的情况下修改和重建程序集。请注意,如果程序集已签名,但您没有强名称密钥来重新签名,则修改后的程序集将发出有关被篡改的警告,并且不会加载。

I was able to solve this following solution from here hacking assembly manifest

using ildasm -> dump -> edit IL code -> ilasm -> generate new assembly from edited IL code

Heres link contents in case it goes down:

I was debugging a particularly nasty problem and found myself wanting to edit the manifest of a compiled .NET assembly, to change the version number of the assemblies it was referencing. Not necessarily best practice, but in this case it would enable me to confirm the exact issue without a two-hour build-and-deploy cycle. Turns out that nasty hacks like this are very straightforward:

Run ILDASM, open the assembly and choose File…Dump to extract the IL
Open the IL file in Visual Studio and edit the manifest – in this case, the version numbers of the referenced assemblies are easily found at the top of the file:

// Metadata version: v2.0.50727
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 2:0:0:0
}
.assembly extern x.y.z
{
  .publickeytoken = (E4 21 0D 54 23 66 A2 B4 )                         // . .D'f..
  .ver 1:0:9:12
}

Save the IL and reassemble it with ILASM – if the assembly was signed, re-sign it using ilasm /DLL x.y.z.il /KEY=x.y.z.snk
Ensure the new assembly has the same name as the original, and it will operate as an exact replacement, only now its dependencies will be for the modified versions.
Simon McEnlly's article on CodeProject describes going further with the manifest to change the visibility of methods, and generally modifying and rebuilding assemblies where you don't have the source code. Note that if the assembly is signed and you don't have the strong name key to re-sign it, the modified assembly will warn about being tampered with and won't load.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文