测试开源.net 混淆器ConfuserEx

由于公司业务需要简单的把代码加密混淆,于是了解了一下相关的工具然后打算用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

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");

        }
    }
}

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

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;
    }
}

其功能如图:

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反编译实验结果,保护后的直接打不开

原文地址:https://www.cnblogs.com/webenh/p/12079605.html

时间: 2024-07-31 09:04:29

测试开源.net 混淆器ConfuserEx的相关文章

开源.net 混淆器ConfuserEx介绍

原文:开源.net 混淆器ConfuserEx介绍 今天给大家介绍一个开源.net混淆器——ConfuserEx http://yck1509.github.io/ConfuserEx/ 由于项目中要用到.net 混淆器,网上搜寻了很多款,比如Dotfuscator.xeoncode.foxit等等. 但大部分收费,当然也有破解版的,公司要求不能用盗版软件. 找了半天终于找到了ConfuserEX,用起来还行,就赶紧拿出来给大家分享下. 下载地址:https://github.com/yck15

一个开源.net混淆器——ConfuserEx (收藏)

一个开源.net混淆器——ConfuserEx http://yck1509.github.io/ConfuserEx/ 由于项目中要用到.net 混淆器,网上搜寻了很多款,比如Dotfuscator.xeoncode.foxit等等. 但大部分收费,当然也有破解版的,公司要求不能用盗版软件. 找了半天终于找到了ConfuserEX,用起来还行,就赶紧拿出来给大家分享下. 下载地址:https://github.com/yck1509/ConfuserEx/releases 由于网上中文介绍的比

.net 混淆器ConfuserEx

今天给大家介绍一个开源.net混淆器——ConfuserEx http://yck1509.github.io/ConfuserEx/ 由于项目中要用到.net 混淆器,网上搜寻了很多款,比如Dotfuscator.xeoncode.foxit等等. 但大部分收费,当然也有破解版的,公司要求不能用盗版软件. 找了半天终于找到了ConfuserEX,用起来还行,就赶紧拿出来给大家分享下. 下载地址:https://github.com/yck1509/ConfuserEx/releases 由于网

Python:渗透测试开源项目

Python:渗透测试开源项目[源码值得精读] sql注入工具:sqlmap DNS安全监测:DNSRecon 暴力破解测试工具:patator XSS漏洞利用工具:XSSer Web服务器压力测试工具:HULK SSL安全扫描器:SSLyze 网络 Scapy: send, sniff and dissect and forge network packets. Usable interactively or as a library pypcap, Pcapy and pylibpcap:

Python:渗透测试开源项目【源码值得精读】

sql注入工具:sqlmap DNS安全监测:DNSRecon 暴力破解测试工具:patator XSS漏洞利用工具:XSSer Web服务器压力测试工具:HULK SSL安全扫描器:SSLyze 网络 Scapy: send, sniff and dissect and forge network packets. Usable interactively or as a library pypcap, Pcapy and pylibpcap: several different Python

使用calabash测试开源中国Android客户端

Calabash-android是支持android的UI自动化测试框架,前面已经介绍过<中文Win7下成功安装calabash-android步骤>,这篇博文尝试测试一个真实应用:开源中国客户端.目的是和大家一起学习calabash测试工具. 测试环境与源码准备 先介绍一下oschina.net oschina除了有网站,还有三大平台手机客户端: http://www.oschina.net/app 客户端已经开源! 那么开源可以用来做什么呢? 我正在学用calabash-android,得

.NET混淆器Dotfuscator v4.25发布,界面优化,改进多项功能

Dotfuscator是一个.NET混淆器和压缩器,它可以帮助您防止您的应用程序被反编译.本次更新改进了界面,并增强和改进了多个功能,下面就一起来看看吧! [点击下载Dotfuscator试用] 增强 增加了一个新的调试检查功能. 新增"Action"属性"DebuggingCheckAttribute"和"InsertTamperCheckAttribute"来对应用程序进 行控制,管理其Debugging Check和Tamper Check

Android项目:proguard混淆之常见开源项目混淆配置

1.Gson混淆 ## ---------------------------------- ##   ########## Gson混淆    ########## ## ---------------------------------- -keepattributes Signature  -keep class sun.misc.Unsafe { *; }  -keep class com.google.gson.examples.android.model.** { *; } 2.gr

11大Java开源中文分词器的使用方法和分词效果对比

本文的目标有两个: 1.学会使用11大Java开源中文分词器 2.对比分析11大Java开源中文分词器的分词效果 本文给出了11大Java开源中文分词的使用方法以及分词结果对比代码,至于效果哪个好,那要用的人结合自己的应用场景自己来判断. 11大Java开源中文分词器,不同的分词器有不同的用法,定义的接口也不一样,我们先定义一个统一的接口: /** * 获取文本的所有分词结果, 对比不同分词器结果 * @author 杨尚川 */ public interface WordSegmenter {