注册机来了,来自AI。
[C#] 纯文本查看 复制代码 using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using HarmonyLib;
// UnpackMe (VeilIL) 序列号计算器 —— .NET Framework 4.0 交互版
// 动态追踪 VM 的逐组比对,提取用户名派生的期望值 x1..x4,拼出合法序列号。
internal static class KeygenNet40
{
const string ExePath = @"UnpackMe.exe";
const string LYKK = "λυκκβχπζγλαχηξζεοκοα"; // VM: 逐组处理 k_i
const string HASH = "ηντυχψχπβγμμξιπψωθσι"; // VM: 变换/哈希
static readonly uint[] DUMMY = new uint[] { 0x11111111u, 0x22222222u, 0x33333333u, 0x44444444u };
static readonly string DummySerial = string.Join("-", Array.ConvertAll(DUMMY, d => d.ToString("X8")));
static readonly Dictionary<uint, int> Xmap = new Dictionary<uint, int>();
[ThreadStatic] static uint _pending;
[ThreadStatic] static int _hv;
[ThreadStatic] static bool _inHook;
static int ToInt(object o)
{
if (o is int) return (int)o;
if (o is uint) return unchecked((int)(uint)o);
if (o is short) return (short)o;
if (o is ushort) return unchecked((short)(ushort)o);
if (o is byte) return (byte)o;
return int.MinValue;
}
// 统一前缀:按方法名分别处理 λυκκ(k_i) 与 ηνυχ(值)
static void Pre(object[] __args, MethodBase __originalMethod)
{
if (_inHook || __args == null || __args.Length == 0) return;
_inHook = true;
try
{
string mn = __originalMethod.Name;
if (mn == LYKK)
{
uint ku = unchecked((uint)ToInt(__args[0]));
for (int i = 0; i < DUMMY.Length; i++) if (DUMMY[i] == ku) { _pending = ku; _hv = 0; break; }
}
else if (mn == HASH)
{
if (_pending != 0)
{
_hv++;
if (_hv == 2) { Xmap[_pending] = ToInt(__args[0]); _pending = 0; }
}
}
}
finally { _inHook = false; }
}
static void Main()
{
Console.ResetColor();
PrintHeader();
// 载入程序集 + 安装钩子(只做一次)
Assembly asm;
Type[] types;
try
{
asm = Assembly.LoadFrom(ExePath);
types = asm.GetTypes();
}
catch (ReflectionTypeLoadException ex) { types = ex.Types.Where(t => t != null).ToArray(); }
catch (Exception e) { Console.WriteLine("[!] 载入 UnpackMe.exe 失败: " + e.Message); Pause(); return; }
var pre = typeof(KeygenNet40).GetMethod("Pre", BindingFlags.NonPublic | BindingFlags.Static);
int patched = 0;
try
{
var harmony = new Harmony("unpackme.keygen.net40");
foreach (var tn in new string[] { "ξωμξβδομδψηζςπλνητβψ", "οιιψκφυεζκξφνενγυυθχ" })
{
var tp = types.FirstOrDefault(t => t.Name == tn);
if (tp == null) continue;
MethodInfo[] ms;
try { ms = tp.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly); }
catch { continue; }
foreach (var m in ms)
{
if (m.IsAbstract || m.IsGenericMethod) continue;
try { harmony.Patch(m, prefix: new HarmonyMethod(pre)); patched++; } catch { }
}
}
}
catch (Exception e) { Console.WriteLine("[!] 安装钩子失败: " + e.Message); Pause(); return; }
Console.WriteLine("[*] 已就绪(钩子 " + patched + " 个)。输入用户名计算序列号,留空用默认「挑战者」。");
Type formType = types.FirstOrDefault(t => typeof(Form).IsAssignableFrom(t) && !t.IsAbstract);
if (formType == null) { Console.WriteLine("[!] 未找到 ChallengeForm"); Pause(); return; }
// 连续输入循环(不自动退出)
while (true)
{
Console.WriteLine();
Console.Write("用户名 [挑战者]: ");
string name = Console.ReadLine();
if (name == null) break; // 输入流结束(重定向)才退出
name = name.Trim();
if (name.Length == 0) name = "挑战者";
if (name.Equals("exit", StringComparison.OrdinalIgnoreCase) || name.Equals("quit", StringComparison.OrdinalIgnoreCase))
{ Console.WriteLine("再见。"); break; }
//Console.WriteLine("计算中(用户名: " + name + ")...");
string serial = Compute(formType, name);
if (serial != null)
{
Console.ForegroundColor = ConsoleColor.Green;
//Console.WriteLine(" 用户名: " + name);
Console.WriteLine(" 序列号: " + serial);
Console.ResetColor();
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" [!] 提取失败,请重试。");
Console.ResetColor();
}
}
Pause();
}
static string Compute(Type formType, string name)
{
Xmap.Clear();
Exception err = null;
var t = new Thread(delegate()
{
try
{
var ctor = formType.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
.OrderBy(c => c.GetParameters().Length).First();
object form = ctor.Invoke(ctor.GetParameters()
.Select(p => p.ParameterType.IsValueType ? Activator.CreateInstance(p.ParameterType) : (object)null).ToArray());
FieldInfo F(string n) { return formType.GetField(n, BindingFlags.NonPublic | BindingFlags.Instance); }
((TextBox)F("nameInput").GetValue(form)).Text = name;
((TextBox)F("keyInput").GetValue(form)).Text = DummySerial;
var worker = (BackgroundWorker)F("worker").GetValue(form);
bool done = false;
RunWorkerCompletedEventHandler h = delegate { done = true; };
worker.RunWorkerCompleted += h;
formType.GetMethod("ζχξλαηβυςδχιβκξωξβγκ", BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(form, new object[] { form, EventArgs.Empty });
for (int i = 0; i < 200 && !done; i++) { Application.DoEvents(); Thread.Sleep(100); }
worker.RunWorkerCompleted -= h;
}
catch (Exception e) { err = e; }
});
t.SetApartmentState(ApartmentState.STA);
t.Start();
t.Join();
if (err != null) { string em = err.InnerException != null ? err.InnerException.Message : err.Message; Console.WriteLine(" [!] " + em); return null; }
if (Xmap.Count == 4 && DUMMY.All(d => Xmap.ContainsKey(d)))
return string.Join("-", Array.ConvertAll(DUMMY, d => unchecked((uint)Xmap[d]).ToString("X8")));
return null;
}
static void PrintHeader()
{
Console.WriteLine("=====================================================");
Console.WriteLine(" UnpackMe 序列号计算器 (.NET Framework 4.0)");
Console.WriteLine(" 目标: " + ExePath);
Console.WriteLine(" 默认用户名: 挑战者 退出: 输入 exit");
Console.WriteLine("=====================================================");
}
static void Pause()
{
Console.WriteLine();
Console.WriteLine("按回车键退出...");
try { Console.ReadLine(); } catch { }
}
}
|