2016-07-26 54 views
-3

所以最近我注意到很多程序被破解,因爲我的/小開發者的朋友有.dll作爲參考源代碼公開,然後人們重新編寫該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; 
     } 
+0

讓我谷歌爲你:https://www.google.com/search?q=Detect+if+User + modified + a + dll + that + is + used + by your + program&ie = utf-8&oe = utf-8 –

+0

@roryap ye,但是所有使用api的帖子我都記得如此,所以我讓她知道if這是一種編寫代碼並在程序啓動時運行它的方法... ima爲我加了一個編碼,我的朋友嘗試了OP(didn#T work,buti認爲它在其他方向) – Dafuqisthis

回答

相關問題