【问题标题】:Reading from Settings.settings file After Obfuscation混淆后从 Settings.settings 文件中读取
【发布时间】:2017-07-02 12:22:59
【问题描述】:

我最近使用 Dotfuscator CE 和 Visual Studio 2015 Update 3 混淆了一个 DLL。这是我使用的 Dotfuscator.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}\" />
  </output>
</dotfuscator>

现在的问题是,经过混淆处理的程序集包含一些存储在 Settings.settings 中的信息。文件,当我的代码尝试从设置文件访问数据时,它会失败并出现以下异常。

未找到设置属性“ProxyTestURL”

这里是读取设置的语法:

 Dim strURI As String = My.Settings.ProxyTestURL

我知道有一个类似的问题“Dotfuscator : Error after obfuscation”,但它似乎既不完整也不健壮,虽然我也把我的 cmets 放在那里,但在这里我希望得到第二个意见和更健壮的解决方案将我的设置文件文字重命名为混淆名称(如那里所述)。

【问题讨论】:

标签: c# obfuscation dotfuscator


【解决方案1】:

您应该从重命名中排除My.Settings。这样做的说明在the docs

【讨论】:

  • 请注意,我相信 GUI 会自动应用此排除;从 GUI 开始,而不是尝试手动编辑配置文件,您可能会获得更好的结果。
  • 感谢@Nathan 的回复。我使用了 GUI 并在排除列表中手动添加了 MySettings 文件;并解决了问题。但是,我仍然在 post build 命令中使用 CLI。否则,只要我的 DLL 由 Visual Studio 构建,GUI 就会一个接一个地打开所有 35 个 DLL(即使 /q 参数传递给它),我必须再次按下 GUI 中的构建按钮。为了避免这个额外的步骤,我在构建后事件中使用了 CLI。
  • 是的,这是有道理的 - 很抱歉造成混乱。通常,将 GUI 视为配置文件生成器,将 CLI 视为实际的混淆器是最简单的。他们每个人实际上都可以做任何一项工作,但以这种方式与他们一起工作感觉最自然。
猜你喜欢
  • 2011-04-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-06-04
  • 2013-02-19
相关资源
最近更新 更多