声明:以下纯属个人兴趣,禁止商业行为
软件介绍:
HotKeycontrol是一个实用的基于Windows的PC,它允许用户创建键盘快捷键,这将帮助您轻松做你的每日任务的软件。
HotKeycontrol包括如打开文件,弹出光驱,重新启动电脑,打字经常使用的文本,控制活跃窗口,更改系统音量,控制笔记本电脑显示屏亮度等等。
此外,HotKeycontrol在屏幕上会显示或OSD功能,可以显示在透明的外观预设热键列表,可以帮助你不记得所有的热键。这将帮助你作为指南,如果你忘记了某个键。
未授权时
授权关键代码
编写算法注册机
代码使用了了des Key防止滥用。请自己动手寻找
效果:using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
namespace HotkeycontrolKeyGen
{
public struct Inform
{
public string strName;
public string serialNumber;
public string strType;
public string strId;
}
class Program
{
[DllImport("kernel32.dll", EntryPoint = "GetVolumeInformationA")]
private static extern int GetVolumeInformation(string lpRootPathName, StringBuilder lpVolumeNameBuffer, int nVolumeNameSize, ref uint lpVolumeSerialNumber, ref int lpMaximumComponentLength, ref int lpFileSystemFlags, StringBuilder lpFileSystemNameBuffer, int nFileSystemNameSize);
public static string GetRandomString(int length, bool useNum, bool useLow, bool useUpp, bool useSpe, string custom)
{
byte[] b = new byte[4];
new System.Security.Cryptography.RNGCryptoServiceProvider().GetBytes(b);
Random r = new Random(BitConverter.ToInt32(b, 0));
string s = null, str = custom;
if (useNum == true) { str += "0123456789"; }
if (useLow == true) { str += "abcdefghijklmnopqrstuvwxyz"; }
if (useUpp == true) { str += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
if (useSpe == true) { str += "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"; }
for (int i = 0; i < length; i++)
{
s += str.Substring(r.Next(0, str.Length - 1), 1);
}
return s;
}
public static string GetId(string Installpath)
{
StringBuilder lpVolumeNameBuffer = new StringBuilder(100);
StringBuilder lpFileSystemNameBuffer = new StringBuilder(100);
int num = 0;
int num2 = 0;
uint num3 = 0u;
string install = Installpath;
GetVolumeInformation(install.Substring(0, 3), lpVolumeNameBuffer, 100, ref num3, ref num, ref num2, lpFileSystemNameBuffer, 100);
num3 = (uint)(new DriveInfo(install.Substring(0, 1)).TotalSize / 1000000L) + num3;
return num3.ToString("###-###-###-###");
}
public static void MakeLic(string Name, string Installpath)
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Inform));
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
Inform info = new Inform();
DES des = DES.Create();
ASCIIEncoding asciiencoding = new ASCIIEncoding();
//请自己寻找
ICryptoTransform cryptoTransform = des.CreateEncryptor(asciiencoding.GetBytes("xxxxxx"), asciiencoding.GetBytes("xxxxx"));
StringWriter sw = new StringWriter();
info.strName = Name;
info.strId = GetId(Installpath);
info.serialNumber = GetRandomString(16,true,true,true,false,"");
info.strType = "www.trap0e.com";
ns.Add("", "");
XmlTextWriter tw = new XmlTextWriter("indata", asciiencoding);
tw.Formatting = Formatting.Indented;
xmlSerializer.Serialize(tw, info, ns);
tw.Close();
FileStream fileStream = new FileStream("indata", FileMode.Open, FileAccess.Read);
FileStream fileStreamcypt = new FileStream("indata.x64", FileMode.Create, FileAccess.Write);
CryptoStream cryptoStream = new CryptoStream(fileStreamcypt, cryptoTransform, CryptoStreamMode.Write);
byte[] inputbuffer = new byte[fileStream.Length];
fileStream.Read(inputbuffer, 0, (int)fileStream.Length);
cryptoStream.Write(inputbuffer, 0, inputbuffer.Length);
cryptoStream.FlushFinalBlock();
fileStreamcypt.Close();
cryptoStream.Close();
fileStream.Close();
cryptoTransform.Dispose();
File.Delete("indata");
}
static void Main(string[] args)
{
string Name="";
string Path = "";
Console.Write("Name:");
Name = Console.ReadLine();
Console.Write("InstallPath:");
Path = Console.ReadLine();
MakeLic(Name, Path);
}
}
}