測試開源.net 混淆器ConfuserEx

来源:https://www.cnblogs.com/iiiii/archive/2019/12/19/12066427.html
-Advertisement-
Play Games

由於公司業務需要簡單的把代碼加密混淆,於是瞭解了一下相關的工具然後打算用ConfuserEx試試。 開源地址:https://github.com/yck1509/ConfuserEx/ 下載地址:https://github.com/yck1509/ConfuserEx/releases 開始工作 ...


由於公司業務需要簡單的把代碼加密混淆,於是瞭解了一下相關的工具然後打算用ConfuserEx試試。

開源地址:https://github.com/yck1509/ConfuserEx/

下載地址:https://github.com/yck1509/ConfuserEx/releases

開始工作

1.簡單編寫一個產生隨機數的Winform視窗程式

 

 

 代碼如下

using System;
using System.Windows.Forms;

namespace ConfuserEx_Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var max = (double)numericUpDown1.Value;
            var min = (double)numericUpDown2.Value;
            Random random = new Random();
            double v = random.NextDouble() * (max -min) + min;
            label1.Text = v.ToString();
            textBox1.AppendText(v.ToString() + "\r\n");

        }
    }
}
Form1.cs
namespace ConfuserEx_Test
{
    partial class Form1
    {
        /// <summary>
        /// 必需的設計器變數。
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// 清理所有正在使用的資源。
        /// </summary>
        /// <param name="disposing">如果應釋放托管資源,為 true;否則為 false。</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows 窗體設計器生成的代碼

        /// <summary>
        /// 設計器支持所需的方法 - 不要修改
        /// 使用代碼編輯器修改此方法的內容。
        /// </summary>
        private void InitializeComponent()
        {
            this.button1 = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(225, 140);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(213, 53);
            this.button1.TabIndex = 0;
            this.button1.Text = "生成隨機數";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(35, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "label1";
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(12, 36);
            this.textBox1.Multiline = true;
            this.textBox1.Name = "textBox1";
            this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.textBox1.Size = new System.Drawing.Size(207, 157);
            this.textBox1.TabIndex = 2;
            // 
            // numericUpDown1
            // 
            this.numericUpDown1.Location = new System.Drawing.Point(298, 68);
            this.numericUpDown1.Maximum = new decimal(new int[] {
            100000,
            0,
            0,
            0});
            this.numericUpDown1.Minimum = new decimal(new int[] {
            100000,
            0,
            0,
            -2147483648});
            this.numericUpDown1.Name = "numericUpDown1";
            this.numericUpDown1.Size = new System.Drawing.Size(84, 20);
            this.numericUpDown1.TabIndex = 3;
            this.numericUpDown1.Value = new decimal(new int[] {
            100,
            0,
            0,
            0});
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(247, 70);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(43, 13);
            this.label2.TabIndex = 5;
            this.label2.Text = "最大值";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(247, 96);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(43, 13);
            this.label3.TabIndex = 6;
            this.label3.Text = "最小值";
            // 
            // numericUpDown2
            // 
            this.numericUpDown2.Location = new System.Drawing.Point(298, 94);
            this.numericUpDown2.Maximum = new decimal(new int[] {
            100000,
            0,
            0,
            0});
            this.numericUpDown2.Minimum = new decimal(new int[] {
            100000,
            0,
            0,
            -2147483648});
            this.numericUpDown2.Name = "numericUpDown2";
            this.numericUpDown2.Size = new System.Drawing.Size(84, 20);
            this.numericUpDown2.TabIndex = 7;
            this.numericUpDown2.Value = new decimal(new int[] {
            100,
            0,
            0,
            -2147483648});
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(444, 205);
            this.Controls.Add(this.numericUpDown2);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.numericUpDown1);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.button1);
            this.Name = "Form1";
            this.Text = "ConfuserEx加密混淆測試";
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.NumericUpDown numericUpDown1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.NumericUpDown numericUpDown2;
    }
}
Form1.Designer.cs

其功能如圖:

 

 

 2.下載打開ConfuserEx使用

2.1 將生成的exe文件拖拽到ConfuserEx的Project中

 

 

 2.2在Settings中選中Packer(據說dll文件不是這樣的),再點擊exe文件,添加一個True。

 

 

 2.3點擊Protect!看到Finished at xx:xx, xx:xx elapsed.表示完成

 

 

 3.測試加密混淆結果

3.1下載ILSpy--(百度百科:ILspy是一個開源的.net反編譯軟體,使用十分方便。)

3.2將保護前編譯出的exe文件拖拉到ILSpy中

很方便就能夠看到源碼

 

3.2 將保護後的exe文件拖拉到ILSpy中與之前的做對比

 

 

4.結論

簡單的測試了一下,這種保護便於操作,有明顯的保護效果,能夠防止只會下載反編譯軟體來獲得源碼的人,但是可能不是所有反編譯軟體都能防止。只是做個簡單保護。

後面我會做一個Reflector反編譯實驗以及脫殼後再來反編譯。

附加1

Reflector反編譯實驗結果,保護後的直接打不開


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 首先在ConfigureServices添加 public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("any", builder => ...
  • .NET Core 3.1 作為LTS長期支持版本,會提供3年的支持(明年就出.net5),值得升級(嗎)。 目前主流的第三方包大多都已經提供了支持,2.x => 3.1還是變化不是特別多,EF Core坑就大咯,謹慎。 ASP.NET Core 3.1 的新增功能 https://docs.mic ...
  • 我們搜索一下yum庫關於nginx的rpm包:yum list | grep nginx 找到rpm安裝包,我們就可以使用yum直接安裝了:yum install nginx 修改nginx配置文件:vi /etc/nginx/nginx.conf 註釋掉下麵的配置: 創建一個netcore.con ...
  • WPF中一些圖片處理方案整理,可以大致實現類似PS的一些基本功能:移動,裁剪,摳圖,背景橡皮擦等等 ...
  • Protected 在基類中定義後,能被派生類調用,但是不能被其他類調用。 virtual 在基類中定義後,在派生類中能被重寫。 using System; using System.Collections.Generic; using System.Text; namespace 繼承 { cla ...
  • 一丶簡單介紹下目錄結構和項目依賴,如圖 二丶主要核心自定義代碼 1. 添加自定義實現類 CustomProvider 2. 在silo中註入代替預設實現 3. 在grain類上啟用 三丶運行結果如下 示例代碼下載地址:SimpleStorage ...
  • string strguid = Guid.NewGuid().ToString();//57d99d89-caab-482a-a0e9-a0a803eed3ba 生成標準的標誌符 (36位標準)strguid = Guid.NewGuid().ToString("D");//57d99d89-ca ...
  • 目錄 獲取請求的參數 獲取完整的請求路徑 獲取功能變數名稱 編碼 文件上傳的保存方法 獲取物理路徑 返回Json屬性大小寫問題 webconfig的配置移植到appsettings.json 設置區域塊MVC的路由器和訪問區域塊的視圖 NetCore訪問靜態資源文件 MVC調用子頁視圖 過濾器 使用sess ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...