【问题标题】:Referencing an Obfuscated DLL引用混淆的 DLL
【发布时间】:2017-02-13 13:21:58
【问题描述】:

我使用 DotfuscatorCLI 和 Visual Studio 2015 Update 3 Post Build 事件命令混淆了 .Net DLL。它似乎已成功混淆,因为在该命令之后没有出现错误。

命令如下:

dotfuscatorcli.exe /q /p=SourceDirectory="$(TargetDir)\",SourceFile=$(TargetFileNa‌​me) "$(ProjectDir)Dotfuscator.xml"

这里是 Obfuscator.xml

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v1.1.dtd">
<dotfuscator version="1.1">
   <propertylist>
      <property name="SourceDirectory" value="This Path Will Be Replaced By Visual Studio" />
      <property name="SourceFile" value="This Filename Will Be Replaced By Visual Studio" />
   </propertylist>
   <trigger>
      <filelist>
         <file dir="${SourceDirectory}\" name="${SourceFile}" />
      </filelist>
   </trigger>
   <output>
      <file dir="${SourceDirectory}\Dotfuscator\" />
   </output>
</dotfuscator>

现在,当我在另一个项目中引用该 DLL 并尝试访问其公共成员时;我无法再访问它们。就好像它们没有在该 DLL 中定义/公开,并且它们在智能感知中也不可用。

如果我在对象浏览器中查看该 DLL,它会显示具有一些奇怪名称的类,例如h、I、m、n 等

为了使用该 DLL,我是否在这里遗漏了什么?

我们将不胜感激任何回应、提示或解决方案。

【问题讨论】:

标签: c# dll dotfuscator


【解决方案1】:

听起来您可能为该程序集禁用 Library Mode。尝试重新启用它,这将告诉 Dotfuscator 自动排除公共类型和成员重命名。

【讨论】:

  • 谢谢@Nathan。我已经更新了我的问题,您可以在那里看到 XML 文件。我没有明确禁用任何模式。
  • @AzazulHaq,问题是在配置文件级别,您必须启用库模式。如果您使用 UI 生成配置文件,它将默认启用它。该博客文章中的配置文件没有打开它,所以这就是混乱的根源。如果您想了解如何通过手动编辑 XML 来启用它,请参阅the relevant section in the user guide for Pro
【解决方案2】:

在@Nathan 的帮助下,我能够解决我遇到的问题。这是更新后的 Obfuscator.xml 文件中的内容。

<?xml version="1.0" encoding="utf-8" standalone="no"?>
    <!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.3.dtd">
    <dotfuscator version="2.3">
       <propertylist>
          <property name="SourceDirectory" value="This Path Will Be Replaced By Visual Studio" />
          <property name="SourceFile" value="This Filename Will Be Replaced By Visual Studio" />
       </propertylist>
        <input>
        <asmlist>
          <inputassembly>
           <option>library</option>
             <file dir="${SourceDirectory}\" name="${SourceFile}" />
          </inputassembly>
       </asmlist>
      </input>
       <output>
          <file dir="${SourceDirectory}\Dotfuscator\" />
       </output>
    </dotfuscator>

我知道如果我使用 dotfuscator UI,它会自动启用库模式,但我故意选择 CLI 方法。我想自动化并为我在一个项目中引用的 35 多个 DLL 提供通用解决方案。 所以现在使用这种方法,我希望这不仅可以自动化我的混淆过程,还可以加快处理速度,因为它是一种构建后事件命令方法。简而言之,我需要做的就是按下构建解决方案按钮,然后就完成了。

希望这对其他人有所帮助。如果有任何歧义或疑虑,或者您有任何其他建议,请告诉我。

【讨论】:

    猜你喜欢
    • 2010-12-05
    • 2018-11-10
    • 1970-01-01
    • 2012-09-25
    • 1970-01-01
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 2019-07-25
    相关资源
    最近更新 更多