附带程序
www.809108233.com/www.rarpublic class FrmRegister : Form
{
// Fields
private Button btnGenerate;
private Button btnOK;
private IContainer components;
private Label label1;
private Label label2;
private string RegisterCode;
private static string rootpath;
private TextBox txtCode;
private TextBox txtSN;
// Methods
static FrmRegister();
public FrmRegister();
private void btnGenerate_Click(object sender, EventArgs e);
private void btnOK_Click(object sender, EventArgs e);
public static bool CheckRegisterCode(string code);
protected override void Dispose(bool disposing);
private void FrmRegister_Load(object sender, EventArgs e);
private void InitializeComponent();
public static string ShowFrmRegister();
public static string ShowFrmRegisterMachine();
}
Expand Methods
求教C# 反编印以后
private void btnOK_Click(object sender, EventArgs e)
{
try
{
if (this.txtSN.get_Text() != RegisterMachine.EncryptCode(RegisterMachine.DecryptCode(this.txtCode.get_Text().Trim(), RegisterMachine.KEY_SECOND), RegisterMachine.KEY_FIRST))
{
this.RegisterCode = "";
MessageBox.Show("注册码不正确!");
}
else
{
this.RegisterCode = this.txtCode.get_Text().Trim();
if (CheckRegisterCode(this.RegisterCode))
{
base.Close();
}
}
}
catch (Exception)
{
this.RegisterCode = "";
MessageBox.Show("注册码错误!");
}
}
private void btnGenerate_Click(object sender, EventArgs e)
{
try
{
this.RegisterCode = RegisterMachine.EncryptCode(RegisterMachine.DecryptCode(this.txtSN.get_Text().Trim(), RegisterMachine.KEY_FIRST), RegisterMachine.KEY_SECOND);
}
catch (Exception)
{
this.RegisterCode = "";
MessageBox.Show("生成注册码失败,请检查!");
}
this.txtCode.set_Text(this.RegisterCode);
}
下这些代码应该是登陆截面
private void InitializeComponent()
{
this.label1 = new Label();
this.label2 = new Label();
this.btnOK = new Button();
this.btnGenerate = new Button();
this.txtCode = new TextBox();
this.txtSN = new TextBox();
base.SuspendLayout();
this.label1.set_AutoSize(true);
this.label1.set_Location(new Point(12, 9));
this.label1.set_Name("label1");
this.label1.set_Size(new Size(0x17, 12));
this.label1.set_TabIndex(0);
this.label1.set_Text("S/N");
this.label2.set_AutoSize(true);
this.label2.set_Location(new Point(12, 0x24));
this.label2.set_Name("label2");
this.label2.set_Size(new Size(0x1d, 12));
this.label2.set_TabIndex(2);
this.label2.set_Text("Code");
this.btnOK.set_Location(new Point(160, 70));
this.btnOK.set_Name("btnOK");
this.btnOK.set_Size(new Size(0x4b, 0x17));
this.btnOK.set_TabIndex(4);
this.btnOK.set_Text("确定");
this.btnOK.set_UseVisualStyleBackColor(true);
this.btnOK.add_Click(new EventHandler(this, this.btnOK_Click));
this.btnGenerate.set_Location(new Point(0x45, 0x45));
this.btnGenerate.set_Name("btnGenerate");
this.btnGenerate.set_Size(new Size(0x4b, 0x17));
this.btnGenerate.set_TabIndex(5);
this.btnGenerate.set_Text("生成");
this.btnGenerate.set_UseVisualStyleBackColor(true);
this.btnGenerate.add_Click(new EventHandler(this, this.btnGenerate_Click));
this.txtCode.set_Location(new Point(0x3b, 0x21));
this.txtCode.set_MaxLength(8);
this.txtCode.set_Name("txtCode");
this.txtCode.set_Size(new Size(0xb0, 0x15));
this.txtCode.set_TabIndex(7);
this.txtSN.set_Location(new Point(0x3b, 6));
this.txtSN.set_MaxLength(8);
this.txtSN.set_Name("txtSN");
this.txtSN.set_Size(new Size(0xb0, 0x15));
this.txtSN.set_TabIndex(8);
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
base.set_AutoScaleMode(1);
base.set_ClientSize(new Size(0xfd, 0x6a));
base.get_Controls().Add(this.txtSN);
base.get_Controls().Add(this.txtCode);
base.get_Controls().Add(this.btnGenerate);
base.get_Controls().Add(this.btnOK);
base.get_Controls().Add(this.label2);
base.get_Controls().Add(this.label1);
base.set_Name("FrmRegister");
base.set_StartPosition(4);
this.set_Text("请输入注册码");
base.add_Load(new EventHandler(this, this.FrmRegister_Load));
base.ResumeLayout(false);
base.PerformLayout();
}
这个代表什么
static RegisterMachine()
{
KEY_FIRST = "82225788";
KEY_SECOND = "ABCDEFAB";
}
下面是不是注册算法
public static string ConverseString(string src)
{
string str = "";
string str2 = src;
for (int i = 0; i < str2.get_Length(); i++)
{
str = str2.get_Chars(i) + str;
}
return str;
}
public static string DecryptCode(string strSNCode, string strKey)
{
if (strSNCode.get_Length() != strKey.get_Length())
{
throw new ArgumentException("参数字符串长度不相等,导致无法解出密钥!");
}
return EncryptCode(ConverseString(strSNCode), strKey);
}
public static string EncryptCode(string strSN, string strKey)
{
if (strSN.get_Length() != strKey.get_Length())
{
throw new ArgumentException("参数字符串长度不相等,导致无法生成密钥!");
}
string src = "";
for (int i = 0; i < strSN.get_Length(); i++)
{
src = src + ((Convert.ToByte(strSN.get_Chars(i).ToString(), 0x10) ^ Convert.ToByte(strKey.get_Chars(i).ToString(), 0x10))).ToString("X");
}
return ConverseString(src);
}
[DllImport("kernel32.dll")]
public static extern int GetLastError();
应该是这个吧public static string GetSysDriveSN(string lpRootPathName)
{
string lpVolumeNameBuffer = null;
uint nVolumeNameSize = 0xff;
uint lpVolumeSerialNumber = 0;
uint lpMaximumComponentLength = 0xff;
uint lpFileSystemFlags = 0;
string lpFileSystemNameBuffer = null;
uint nFileSystemNameSize = 0xff;
if (GetVolumeInformation(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, ref lpVolumeSerialNumber, ref lpMaximumComponentLength, ref lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize))
{
return string.Format("{0:X8}", lpVolumeSerialNumber);
}
GetLastError();
return "";
}
[招生]系统0day安全班,企业级设备固件漏洞挖掘,Linux平台漏洞挖掘!