本帖最后由 wtujoxk 于 2023-11-15 08:53 编辑
测试程序地址
https://www.52pojie.cn/thread-1856959-1-1.html
软件界面
验证状态:
public enum SerialState
{
Success = 0x0,
Corrupted = 0x1,
Invalid = 0x2,
Blacklisted = 0x4,
DateExpired = 0x8,
RunningTimeOver = 0x10,
BadHwid = 0x20,
MaxBuildExpired = 0x40
}
源码
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using VMProtect.KeyGen;
namespace VMP_KeyGenNet
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
Generator generator;
string path = AppDomain.CurrentDomain.BaseDirectory + "SecretKey.txt"; // 保存密钥数据
Dictionary<Control, Control> dicRegData = new Dictionary<Control, Control>();
//默认生成一个密钥数据
string initData = @"PHZtcC1sbS1wcm9kdWN0IGFsZ29yaXRobT0iUlNBIiBiaXRzPSIyMDQ4IiBleHA9InBDdjJ1Z2xm
eWNqTXd1MmozTHhxQ0VOeGVzNzZjMjVQNVcvNC9JUmlxN251ZU9BMk9sbWlVMWlFR0FWYTNaTnRz
K1JkRU5HTHVJSkVYa2czdzBxNWpNSi93TDhpRFhDV3VZMVhmUkxiWmFPUXZXZWZIYWl3SEtMdHNH
YWVRNDU3K1RjdncxanJQQVl6b0l1SjY1Y2JXUXl0RUhiLzJtOVk0MXB6cmJYRU9Idk5mN2RwK3I0
aGQxUWEyMFZQWGpBODQ4ekxCSlVxMW1Ld3RxenVOOHpwTk9OUGNEcTZLRWE0anZTY2VQR3VrUUFr
ZU95UHJiY203VVZhd0lEOHYyVmRWWENsMEdTM1JGZGYzWi80RnpDNDQ3cThJTFEzZi9kajhXaXl1
OXdXS1JrVjh1SUpVZnovYnM2RnFKK3RVWWpMR29wSitvV0FiR1g3eFdMTmlQWE5FUT09IiBtb2Q9
IjBkMUN1S3pjQ3lYc0lBSnVRL045am4rRTlHWFBvdU14NUhuVWoyVjdMVTJITEt5USt2SXVoZXFW
N0c3b09lb2dIU3Z0SzhGRUdZNVYyVVk4cURCbVlhYUtsNWZWRkhJd2JTZkZ1cjVqdGNYOUt5b2JU
MlRCU2pkMVBhMzdkUGZvakxWNzNqK01heENpMjRFWjBrUVFkWHZ0RFFYa3phU1QraHJDZG1qelJL
ZndxeG9qYzJtSkNkYldFUHNFQkhKaHoxM0cwYndrUnFLSGRYUjVTanhzWkRxb3ZXSVFubWwzOUtU
TE00VHA1bzRUSHRVMkNZWm1sbThGS1ZCWE8vZTFRb2VTbHl0YndRcFBNZzVvYy9aV1NOZWt4Mm5K
a1VzMkdxN3dFWTBYeE5kSkllWmpESmhSQkdHbk1OWnZldllkdXdjTk9aWUNPN3BnT3AyUFdhMnNL
UT09IiBwcm9kdWN0PSJQUUo0ZVR2VDN2Yz0iLz4=";
private void MainForm_Load(object sender, EventArgs e)
{
//本机硬件ID
textBoxHWID.Text = VMProtect.SDK.GetCurrentHWID();
//判断SecretKey.txt文件是否存在,不存在就写一个默认值
if (!File.Exists(path)) File.WriteAllText(path, initData);
else initData = File.ReadAllText(path);
generator = new Generator(initData);
dicRegData.Add(checkBoxUserName,textBoxUserName);
dicRegData.Add(checkBoxEMail,textBoxEMail);
dicRegData.Add(checkBoxHardwareID,textBoxHardwareID);
dicRegData.Add(checkBox4ExpirationDate,dateTimePickerExpirationDate);
dicRegData.Add(checkBoxRunningTimeLimit,textBoxRunningTimeLimit);
dicRegData.Add(checkBoxMaxBuildDate,dateTimePickerMaxBuildDate);
dicRegData.Add(checkBoxUserData,textBoxUserData);
//控件初状态为关闭
foreach (var value in dicRegData.Values)
{
value.Enabled = false;
}
}
private void checkBox_CheckedChanged(object sender, EventArgs e)
{
//CheckBox勾选后,后面的控件打开
foreach (var key in dicRegData.Keys)
{
if(((CheckBox)key).Checked) dicRegData[key].Enabled = true;
else dicRegData[key].Enabled = false;
}
}
/// <summary>
/// 生成注册码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonGenerate_Click(object sender, EventArgs e)
{
textBoxRegCode.Text = string.Empty;
generator.UserName = textBoxUserName.Text;
generator.EMail = textBoxEMail.Text;
generator.HardwareID = textBoxHardwareID.Text;
generator.ExpirationDate = dateTimePickerExpirationDate.Value;
if (!string.IsNullOrEmpty(textBoxRunningTimeLimit.Text))
generator.RunningTimeLimit = Convert.ToInt32(textBoxRunningTimeLimit.Text);
generator.MaxBuildDate = dateTimePickerMaxBuildDate.Value;
if (!string.IsNullOrEmpty(textBoxUserData.Text))
generator.UserData = Encoding.Default.GetBytes(textBoxUserData.Text);
textBoxRegCode.Text = generator.Generate();
}
/// <summary>
/// 复制注册码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCopy_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxRegCode.Text)) return;
Clipboard.SetDataObject(textBoxRegCode.Text);
}
/// <summary>
/// 保存注册码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonSave_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxRegCode.Text)) return;
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Title = "保存注册码";
saveDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
saveDialog.Filter = "文本文件| *.txt";
if (saveDialog.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(saveDialog.FileName, textBoxRegCode.Text);
MessageBox.Show(Path.GetFileName(saveDialog.FileName) + "保存成功", "提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
/// <summary>
/// 验证注册码,这里的功能必须使用VMP将注册机也要加壳才有用
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonVerify_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBoxRegCode.Text)) return;
VMProtect.SDK.SetSerialNumber(textBoxRegCode.Text);
VMProtect.SDK.GetSerialNumberState();
VMProtect.SerialNumberData sd;
var res = VMProtect.SDK.GetSerialNumberData(out sd);
if (res)
{
MessageBox.Show("状态 : " + sd.State + Environment.NewLine +
"用户名 : " + sd.UserName + Environment.NewLine +
"邮箱 : " + sd.EMail + Environment.NewLine +
"到期日期 : " + sd.Expires + Environment.NewLine +
"最大创建时间 : " + sd.MaxBuild + Environment.NewLine +
"运行时间限制 : " + sd.RunningTime + Environment.NewLine +
"用户数据 : " + Encoding.Default.GetString(sd.UserData) + Environment.NewLine , "提示", MessageBoxButtons.OK);
}
}
}
}
程序需要在VMP软件里导出密钥对:菜单->项目->导出密钥对->导出格式(.Net/PayPro Global的参数),并将其复制到目录SecretKey.txt里,如果目录里,没有SecretKey.txt文件,运行一次本程序即可自动生成一个。
软件下载:
想验证的请使用未加壳版自己加壳后进行验证
VMP 3.x 通用注册机.zip
(286.51 KB, 下载次数: 1666)
VMP 3.x 通用注册机未加壳版.zip
(61.59 KB, 下载次数: 288)
|