首页 新闻 会员 周边

这种c# 程序怎么逆向破解,虽然最终的功能在服务器。但是加载器如何破解呢?

0
悬赏园豆:180 [待解决问题]

程序下载地址:http : //dl.free.fr/gVf7wz4nS

请各位C# 帮忙解释一下这种程序 如何逆向破解。

using main_loader.Utility;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;

namespace main_loader.frames
{
public class RegisterForm : Form
{
private bool is_aborted;

    private bool has_registered;

    private IContainer components;

    public TextBox license_key;

    private TextBox password;

    private TextBox repassword;

    private Button registerButton;

    private Button clearButton;

    public string Login
    {
        get
        {
            return this.license_key.Text;
        }
    }

    public string Password
    {
        get
        {
            return this.password.Text;
        }
    }

    public bool IsRegisteredSuccessfully
    {
        get
        {
            return this.has_registered;
        }
    }

    public RegisterForm()
    {
        this.InitializeComponent();
    }

    private void ClearButton_Click(object sender, EventArgs e)
    {
        this.license_key.ResetText();
        this.password.ResetText();
        this.repassword.ResetText();
    }

    private void RegisterButton_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(this.license_key.Text) || string.IsNullOrEmpty(this.password.Text) || string.IsNullOrEmpty(this.repassword.Text))
        {
            MessageBox.Show("必須填寫表格的所有字段!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            return;
        }
        if (this.password.Text != this.repassword.Text)
        {
            MessageBox.Show("密碼必須相同!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            return;
        }
        if (this.password.Text.Length < 4)
        {
            MessageBox.Show("密码长度必须至少为4个字符!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            return;
        }
        if (!Regex.IsMatch(this.license_key.Text, "^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$", RegexOptions.IgnoreCase))
        {
            MessageBox.Show("许可证密钥无效!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            return;
        }
        this.DisableControls();
        try
        {
            HttpWebRequest httpWebRequest = WebRequest.Create("http://127.0.0.1/loader/register.php") as HttpWebRequest;
            Dictionary<string, string> expr_E9 = new Dictionary<string, string>();
            expr_E9["login"] = this.license_key.Text;
            expr_E9["password"] = this.password.Text;
            byte[] array = NetClient.SerializeParameters(expr_E9);
            httpWebRequest.Method = "POST";
            httpWebRequest.ContentType = "application/x-www-form-urlencoded";
            httpWebRequest.ContentLength = (long)array.Length;
            this.is_aborted = false;
            ThreadPool.RegisterWaitForSingleObject(httpWebRequest.BeginGetRequestStream(new AsyncCallback(this.UploadValuesCallback), httpWebRequest).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallback), httpWebRequest, 60000, true);
        }
        catch (WebException ex)
        {
            if (ex.Status != WebExceptionStatus.RequestCanceled)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            this.EnableControls();
        }
        catch (Exception arg_1A1_0)
        {
            this.EnableControls();
            MessageBox.Show(arg_1A1_0.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }
    }

    private void TimeoutCallback(object state, bool timedOut)
    {
        if (timedOut)
        {
            HttpWebRequest httpWebRequest = state as HttpWebRequest;
            if (httpWebRequest != null)
            {
                if (!this.is_aborted)
                {
                    this.EnableControls();
                    this.is_aborted = true;
                    MessageBox.Show("无法连接到服务器!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                httpWebRequest.Abort();
            }
        }
    }

    private void UploadValuesCallback(IAsyncResult result)
    {
        try
        {
            HttpWebRequest httpWebRequest = result.AsyncState as HttpWebRequest;
            Stream arg_4A_0 = httpWebRequest.EndGetRequestStream(result);
            Dictionary<string, string> expr_18 = new Dictionary<string, string>();
            expr_18["login"] = this.license_key.Text;
            expr_18["password"] = this.password.Text;
            byte[] array = NetClient.SerializeParameters(expr_18);
            arg_4A_0.Write(array, 0, array.Length);
            arg_4A_0.Close();
            ThreadPool.RegisterWaitForSingleObject(httpWebRequest.BeginGetResponse(new AsyncCallback(this.ResponseCallback), httpWebRequest).AsyncWaitHandle, new WaitOrTimerCallback(this.TimeoutCallback), httpWebRequest, 60000, true);
        }
        catch (WebException ex)
        {
            if (ex.Status != WebExceptionStatus.RequestCanceled)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            this.EnableControls();
        }
        catch (Exception arg_B3_0)
        {
            MessageBox.Show(arg_B3_0.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            this.EnableControls();
        }
    }

    private void ResponseCallback(IAsyncResult result)
    {
        this.EnableControls();
        try
        {
            using (Stream responseStream = ((result.AsyncState as HttpWebRequest).EndGetResponse(result) as HttpWebResponse).GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(responseStream))
                {
                    NetClient.AuthResult authResult = JsonConvert.DeserializeObject<NetClient.AuthResult>(Encryption.Base64Decode(streamReader.ReadToEnd()));
                    responseStream.Close();
                    streamReader.Close();
                    if (!authResult.IsAuthenticated)
                    {
                        MessageBox.Show(authResult.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    }
                    else
                    {
                        this.has_registered = true;
                        base.Invoke(new MethodInvoker(delegate
                        {
                            base.Close();
                        }));
                    }
                }
            }
        }
        catch (WebException ex)
        {
            if (ex.Status != WebExceptionStatus.RequestCanceled)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }
        catch (Exception arg_B8_0)
        {
            MessageBox.Show(arg_B8_0.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
        }
    }

    private void DisableControls()
    {
        this.license_key.SetPropertyThreadSafe(() => this.license_key.Enabled, false);
        this.password.SetPropertyThreadSafe(() => this.password.Enabled, false);
        this.repassword.SetPropertyThreadSafe(() => this.repassword.Enabled, false);
        this.registerButton.SetPropertyThreadSafe(() => this.registerButton.Enabled, false);
        this.clearButton.SetPropertyThreadSafe(() => this.clearButton.Enabled, false);
    }

    private void EnableControls()
    {
        this.license_key.SetPropertyThreadSafe(() => this.license_key.Enabled, true);
        this.password.SetPropertyThreadSafe(() => this.password.Enabled, true);
        this.repassword.SetPropertyThreadSafe(() => this.repassword.Enabled, true);
        this.registerButton.SetPropertyThreadSafe(() => this.registerButton.Enabled, true);
        this.clearButton.SetPropertyThreadSafe(() => this.clearButton.Enabled, true);
    }

    protected override void Dispose(bool disposing)
    {
        if (disposing && this.components != null)
        {
            this.components.Dispose();
        }
        base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
        this.license_key = new TextBox();
        this.password = new TextBox();
        this.repassword = new TextBox();
        this.registerButton = new Button();
        this.clearButton = new Button();
        base.SuspendLayout();
        this.license_key.Location = new Point(12, 12);
        this.license_key.Name = "license_key";
        this.license_key.Size = new Size(215, 20);
        this.license_key.TabIndex = 0;
        this.license_key.Text = "注册码";
        this.password.Location = new Point(12, 38);
        this.password.Name = "password";
        this.password.PasswordChar = '*';
        this.password.Size = new Size(100, 20);
        this.password.TabIndex = 1;
        this.repassword.Location = new Point(12, 64);
        this.repassword.Name = "repassword";
        this.repassword.PasswordChar = '*';
        this.repassword.Size = new Size(100, 20);
        this.repassword.TabIndex = 2;
        this.registerButton.Location = new Point(199, 61);
        this.registerButton.Name = "registerButton";
        this.registerButton.Size = new Size(75, 23);
        this.registerButton.TabIndex = 3;
        this.registerButton.Text = "注册";
        this.registerButton.UseVisualStyleBackColor = true;
        this.registerButton.Click += new EventHandler(this.RegisterButton_Click);
        this.clearButton.Location = new Point(118, 61);
        this.clearButton.Name = "clearButton";
        this.clearButton.Size = new Size(75, 23);
        this.clearButton.TabIndex = 4;
        this.clearButton.Text = "清除";
        this.clearButton.UseVisualStyleBackColor = true;
        this.clearButton.Click += new EventHandler(this.ClearButton_Click);
        base.AutoScaleDimensions = new SizeF(6f, 13f);
        base.AutoScaleMode = AutoScaleMode.Font;
        base.ClientSize = new Size(407, 95);
        base.Controls.Add(this.clearButton);
        base.Controls.Add(this.registerButton);
        base.Controls.Add(this.repassword);
        base.Controls.Add(this.password);
        base.Controls.Add(this.license_key);
        base.FormBorderStyle = FormBorderStyle.FixedDialog;
        base.Name = "RegisterForm";
        this.Text = "yxxxx";
        base.ResumeLayout(false);
        base.PerformLayout();
    }
}

}

private void updateReleases()
{
for (int i = 0; i < this.loaderReleases.core_versions.Count; i++)
{
this.comboBox1.Items.Add(this.loaderReleases.core_versions[i].version);
}
for (int j = 0; j < this.comboBox1.Items.Count; j++)
{
if ((string)this.comboBox1.Items[j] == Config.LastVersion)
{
this.comboBox1.SelectedIndex = j;
break;
}
}
this.textBox1.Text = Encoding.UTF8.GetString(Convert.FromBase64String(this.loaderReleases.release_changelog));
if (File.Exists("ccc.dll") && Encryption.MD5File("ccc.dll") == this.currentSelectedCore.checksum)
{
this.label2.ForeColor = Color.Green;
this.comboBox1.Enabled = true;
return;
}
this.DownloadCore();

leonx的主页 leonx | 初学一级 | 园豆:15
提问于:2019-12-20 05:25
< >
分享
所有回答(1)
0

做外包上猪八戒

花飘水流兮 | 园豆:13560 (专家六级) | 2019-12-20 23:08
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册