y8160000
发表于 2025-4-17 10:58:23
lov 发表于 2025-4-9 10:02
刚才试了下码还提示未插狗 有个想法 如果有狗 怎么复制狗呢 不知道有大佬能不能分享下哈感谢
你的这个想法是很不错,只是目前的软注册如果能够正常使用,再去考虑使用狗的分析
y8160000
发表于 2025-4-19 20:03:46
代码中好像注册码绑定的本机的MAC
using System;
using System.Globalization;
using Common.Utilities;
using Microsoft.Win32;
using ParkingManage.Common;
public static bool ResetLock(string mac, string tempendTimestr, bool useDateEnable, out string errorMsg)
{
errorMsg = "";
string keyPath = "";
string text = Security.DecryptDES(tempendTimestr, ShareData.Endkey);
string[] array = text.Split('@');
if (array.Length != 2 || (array.Length > 1 && array == "00163E88210C"))
{
if (array.Length == 1)
{
DateTime result = DateTime.Now;
if (DateTime.TryParse(array, out result))
{
RegistryKey localMachine = Registry.LocalMachine;
RegistryKey registryKey = localMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
registryKey.SetValue("ParkingRegTime", tempendTimestr);
errorMsg = "授权成功";
return true;
}
errorMsg = "无效的授权码";
return false;
}
if (array.Length == 2 && array == "00163E88210C" && mac == "00163E88210C")
{
try
{
string value = Security.EncryptDES(DateTime.ParseExact(array, "yyyyMMdd", CultureInfo.CurrentCulture).ToString("yyyy-MM-dd HH:mm:ss"), ShareData.Endkey);
RegistryKey localMachine2 = Registry.LocalMachine;
RegistryKey registryKey2 = localMachine2.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
registryKey2.SetValue("ParkingRegTime", value);
errorMsg = "授权成功";
return true;
}
catch
{
errorMsg = "无效的授权码";
return false;
}
}
errorMsg = "无效的授权码";
return false;
}
if (!CheckLockDog.IsExitLockDog(out keyPath))
{
errorMsg = "未找到加密狗";
return false;
}
if (array != mac)
{
errorMsg = "该授权码不适用本机";
return false;
}
DateTime dateTime;
try
{
dateTime = DateTime.ParseExact(array, "yyyyMMdd", CultureInfo.CurrentCulture);
}
catch
{
errorMsg = "无效的授权码";
return false;
}
string companyName = ShareData.CompanyName;
string encryptString = DateTime.Now.ToString("yyyyMMdd");
string encryptString2 = dateTime.ToString("yyyyMMdd");
string text2 = (useDateEnable ? "1" : "0");
int num = ((ShareData.DogInfo == null) ? 13 : ShareData.DogInfo.ChannelType);
companyName = Security.EncryptDES(companyName, ShareData.Compkey);
encryptString = Security.EncryptDES(encryptString, ShareData.Beginkey);
encryptString2 = Security.EncryptDES(encryptString2, ShareData.Endkey);
string text3 = companyName + ":" + encryptString + ":" + encryptString2 + ":" + text2 + ":" + num;
int length = text3.Length;
string errorMsg2 = "";
if (!CheckLockDog.WriteLockKey(text3, out errorMsg2))
{
errorMsg = errorMsg2;
return false;
}
return true;
}