【问题标题】:Detect if User modified a dll that is used by your program检测用户是否修改了程序使用的 dll
【发布时间】:2016-07-26 19:37:04
【问题描述】:

所以最近我注意到许多程序被破解,因为我的朋友/小型开发人员将 .dll 作为参考,哪些源代码是公开的,然后人们重新编码该 dll 并添加了一个调试系统,因此程序所做的所有事情都会打印到一个运行时控制台。我想找到一种方法来检查 dll 是否被用户修改/与我在开始时包含的 dll 不完全相同。任何帮助表示赞赏。

private bool check()
        {
            bool flag = false;
            string dllname = "dllname";
            string str = "1a720eff0feeb58484180c0f01a774ba";
            AssemblyName name = (from assembly in Assembly.GetExecutingAssembly().GetReferencedAssemblies()
                                 where assembly.Name.ToLower().Equals(dllname.ToLower())
                                 select assembly).FirstOrDefault<AssemblyName>();
            if (name != null)
            {
                string location = Assembly.ReflectionOnlyLoad(name.FullName).Location;
                if (!(location != string.Empty))
                {
                    return flag;
                }
                if (!System.IO.File.Exists(location))
                {
                    return flag;
                }
                byte[] buffer = System.IO.File.ReadAllBytes(location);
                if (BitConverter.ToString(MD5.Create().ComputeHash(buffer)).Replace("-", "").ToUpper().Equals(str.ToUpper()))
                {
                    flag = true;
                }
            }
            return flag;
        }

【问题讨论】:

  • 让我为您搜索一下:google.com/…
  • @roryap ye,但我至少记得所有使用 api 的帖子,所以我问她是否有办法对其进行编码并在程序启动时运行它......我添加编码我和我的朋友尝试了 OP(没有#T 工作,但我认为它在正确的方向)

标签: c# dll


【解决方案1】:

用密钥签署您的程序集?加载时会自动检查强命名程序集(如果我理解你的话)。

Creating and Using Strong-Named Assemblies

【讨论】:

    【解决方案2】:

    您可以使用强名称签署程序集: Strong-Named Assemblies

    【讨论】:

      猜你喜欢
      • 2015-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-28
      • 1970-01-01
      • 2011-01-30
      • 2011-06-16
      相关资源
      最近更新 更多