- UID
- 66309
注册时间2010-5-1
阅读权限95
最后登录1970-1-1
超级版主
TA的每日心情 | 开心 2019-3-25 14:18 |
---|
签到天数: 881 天 [LV.10]以坛为家III
|
本帖最后由 GeekCat 于 2015-8-29 14:04 编辑
【文章标题】: Universal Viewer V6.5.6.2 注册机源代码【文章作者】: geekcat
【作者邮箱】: 【作者主页】:
【软件名称】: Universal Viewer V6.5.6.2 【软件大小】: 【加壳方式】: 无 【保护方式】: 注册码
【编写语言】: Borland Delphi
【使用工具】: OD、PEID
【操作平台】: XP SP3 【下载地址】:百度找 【软件介绍】: 【 破解声明】:技术交流、学习,请不要用于商业用途! --------------------------------------------------------------------------------------------------------------------------------
KeyFile注册类型的软件 找不到软件输入注册信息的地方折腾了很久,经GG大神提示是KeyFile注册类型的软件 伪造KeyFile文件接着又折腾了很久还是跟不出信息 猜是KeyFile里内容是有格式的,只有格式正确才能读取出来,就跟GG要了一个KeyFile格式来伪造注册信息 接下来就是春天来了~~~~~
切入方式: 1、API断点; 2、字符串查找;
算法总结: 1、注册名要大于等于2位并且以下字符不计算在内: “_”, ".", ",", ";", "-", "/", "\", """, "'", "(", ")", “[”, "]" 2、取注册名:,一共计算出4位:如果所的位是小写字母就转成大写字母 第1位、长度除2后整数对位、长度除2后整数+1对应位、注册名的最后一位 3、注册码分四段,中间用”-“分开每段注册码为4位,第2步中取得的这四位来对应: 注册码第一段第2位、注册码第二段第1位、注册码第三段第1位、注册码第四段第1位 4、注册码的第一位是字符中“BUS”中某1位,分别控制三个版本: 个人版:"U"---Personal license (max. 2 computers) 商业版:"B"---Business license (max. 7 computers) 无限制版:"S"---Site license (unlimited num. of computers) 5、注册码第一段4位AS值累加和跟0x14取余数要等于0xE 6、注册码第二段4位AS值累加和跟0x28取余数要等于0xF 7、注册码第三段4位AS值累加和跟0x28取余数要等于0x11 8、注册码第四段4位AS值累加和跟0x28取余数要等于0x14
注册机代码:
[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Universal_Viewer_Pro_V6._5._6._2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnKeygen_Click(object sender, EventArgs e)
{
string regNam = "";
if (txtName.Text.Length >= 2)
{
regNam = FilterChars(txtName.Text).ToUpper();
}
string key = "";
if (regNam.Length >= 2) //用户名长度大于等于2
{
//软件版本的选择:1、个人版;2、商业版;3、无限版
string VersionChar = "";
if (rbPersonal.Checked)
{
VersionChar = "U";
}
else if (rbBusiness.Checked)
{
VersionChar = "B";
}
else
{
VersionChar = "S";
}
string firstCheck = regNam.Substring(0, 1);
string secondCheck = regNam.Substring(regNam.Length / 2 - 1, 1);
string threeCheck = regNam.Substring(regNam.Length / 2, 1);
string fourthCheck = regNam.Substring(regNam.Length - 1, 1);
//第一段注册码
Random randomKey = new Random();
int oneKey_fourBaseNum = randomKey.Next(2, 6);//注册码第一段最后一位基数
string oneKey_ThreeChar = System.Guid.NewGuid().ToString().Substring(0, 1); //注册码第一段第3位,随机生成1位即包含字符又包含数字的字符串
string oneKey_Three = VersionChar + firstCheck + oneKey_ThreeChar;
char oneKey_fourChar = GetKey(oneKey_Three, 20, oneKey_fourBaseNum, 14);
string oneKey = oneKey_Three + oneKey_fourChar;
//第二段注册码
int twoKey_fourBaseNum = randomKey.Next(1, 3);
string twoKey_TwoChar = System.Guid.NewGuid().ToString().Substring(0, 2);//第二段注册的2,3位两位
string twoKey_Three = secondCheck + twoKey_TwoChar;
char twoKey_fourChar = GetKey(twoKey_Three, 40, twoKey_fourBaseNum, 15);
string twoKey = twoKey_Three + twoKey_fourChar;
//第三段注册码
int threeKey_fourBaseNum = randomKey.Next(1, 3);
string threeKey_TwoChar = System.Guid.NewGuid().ToString().Substring(0, 2);//第三段注册的2,3位两位
string threeKey_Three = threeCheck + threeKey_TwoChar;
char threeKey_fourChar = GetKey(threeKey_Three, 40, threeKey_fourBaseNum, 17);
string threeKey = threeKey_Three + threeKey_fourChar;
//第四段注册码
int fourKey_fourBaseNum = randomKey.Next(1, 3);
string fourKey_TwoChar = System.Guid.NewGuid().ToString().Substring(0, 2);//第二段注册的2,3位两位
string fourKey_Three = fourthCheck + fourKey_TwoChar;
char fourKey_fourChar = GetKey(fourKey_Three, 40, fourKey_fourBaseNum, 20);
string fourKey = fourKey_Three + fourKey_fourChar;
key = oneKey + "-" + twoKey + "-" + threeKey + "-" + fourKey;
txtKey.Text = key;
//生成Key文件
//System.IO.File.WriteAllText("key.txt", key);//成生指定文件名的文件并把内容写入(只一行)
string Path = System.Windows.Forms.Application.StartupPath;
string filePath = Path + "\\Key.txt";
if (File.Exists(filePath))
{
if (MessageBox.Show("Key文件已存在,是否覆盖", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
//生成指定文件名的文件并写入多行内容
//using (StreamWriter sw = File.AppendText("Key.txt")) //如果文件不存在就创建,如果存在就把新的内容追加到之前的后面
using (StreamWriter sw = File.CreateText("Key.txt")) //如果文件不存在就创建,如果存在直接覆盖文件且不提示
{
sw.WriteLine("[key]");
sw.WriteLine("name=" + txtName.Text);
sw.WriteLine("key=" + txtKey.Text);
sw.Close();
labCopy.Visible = true;
labCopy.Text = "文件已覆盖";
}
}
}
else
{
using (StreamWriter sw = File.CreateText("Key.txt")) //如果文件不存在就创建,如果存在直接覆盖文件且不提示
{
sw.WriteLine("[key]");
sw.WriteLine("name=" + txtName.Text);
sw.WriteLine("key=" + txtKey.Text);
sw.Close();
labCopy.Visible = true;
labCopy.Text = "文件已生成请复制到安装目录下";
}
}
if (txtKey.Text != "")
{
labCopy.Visible = true;
labCopy.Text = "Key文件已生成请复制到安装目录下";
}
else
{
MessageBox.Show("注册名长度小于两位,请输入注册名", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
/// <summary>
/// 计算每段注册码最后一位
/// </summary>
/// <param name="pwdchars"></param>
/// <param name="pwdlen"></param>
/// <returns></returns>
public static char GetKey(string keyChars, int mod, int randomNum, int result)//前三位字符,跟谁取余数,随机数做倍数,四位字符串取余数后的结果
{
int total = 0;
int fourMod = 0;
int Key_fourNum = 0;
char Key_fourChar;
for (int i = 0; i < keyChars.Length; i++)
{
total += keyChars[i];
}
fourMod = total % mod;
if (fourMod == result)
{
Key_fourNum = mod * randomNum;
Key_fourChar = (char)Key_fourNum;//十进制数值直接转对应字符
}
else if (fourMod < result)
{
Key_fourNum = result - fourMod + mod * randomNum;
Key_fourChar = (char)Key_fourNum;
}
else
{
Key_fourNum = mod - fourMod + result + mod * randomNum;
Key_fourChar = (char)Key_fourNum;
}
return Key_fourChar;
}
/// <summary>
/// 去掉字符串指定的字符
/// </summary>
/// <param name="strHtml"></param>
/// <returns></returns>
public string FilterChars(string newStr)
{
if (string.Empty == newStr)
{
return newStr;
}
string[] aryReg = {" ","\"", ".", ",", ";", "-", "/", "\\", "\"", "'", "(", ")", "[", "]"};//指定要去掉的字符
for (int i = 0; i < aryReg.Length; i++)
{
newStr = newStr.Replace(aryReg[i], string.Empty);
}
return newStr;
}
private void Form1_Load(object sender, EventArgs e)
{
labCopy.Visible = false;
labNameCopy.Visible = false;
}
private void txtName_TextChanged(object sender, EventArgs e)
{
txtKey.Text = "";
labNameCopy.Visible = false;
}
private void btnKeygen_MouseLeave(object sender, EventArgs e)
{
labCopy.Visible = false;
}
private void txtName_MouseLeave(object sender, EventArgs e)
{
labNameCopy.Visible = false;
}
private void txtName_MouseEnter(object sender, EventArgs e)
{
if (txtKey.Text != "")
{
Clipboard.SetText(txtName.Text);
labNameCopy.Visible = true;
labNameCopy.Text = "注册名复制成功";
}
}
private void linkPYG_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.chinapyg.com");
}
}
}
|
评分
-
查看全部评分
|