鴻渊 发表于 2024-8-26 13:24

某专业起名程序,注册码java实现

本帖最后由 鴻渊 于 2024-8-26 13:27 编辑

这个月16号,喜得小龙女,最近在看取啥名,结果发现软件需要注册码,所以就找到了帖子:https://www.52pojie.cn/forum.php ... %C6%F0%C3%FB&page=1

奈何本人C#不过关,反射一直读取不到文件,最终自己又通过dnSpy,去翻看了下程序代码。磕磕碰碰之下,用java写了个注册机的代码,
用的是7.3.0版本的,其他版本没试过,官网最新的也没看到下载路径

代码没怎么去优化,就是随便写的,有些是复制反编译源码过来改的,所以命名挺乱的,代码如下:@Test
    void regCode() {
      // 机器码
      String pcCode = "09602-11802-62920-20730";
      // 有效时长 2029-12-28 超过这个的 不一定能注册成哈
      String regDate = "20291228";

      String text = pcCode.replace("-", "");
      if (text.length() > 10) {
            text = text.substring(0, 10) + text.substring(text.length() - 5);
      }
      String regCode = m4(SecureUtil.md5(m12(text)).toUpperCase());
      // 年份yyyy 后2位对应注册码 5-6位
      // 6,7,B=>1 对应1几年 8,9,C=>2 对应2几年
      String[] year3 = { "8", "9", "C" };
      // 年份第四位对照关系
      String[] year41 = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
      String[] year42 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K" };

      // 月份MM 对应注册码7-8位
      // 月份第一位, 6,7,B=>1 对应1 4,5,A=>0 对应0 月份第二位对照关系同年份第四位对照关系
      String[] month10 = { "4", "5", "A" };
      String[] month11 = { "6", "7", "B" };

      // 日dd对应注册码13,14位
      // 日dd第一位A,B,C=> 0,1,2 第二位0-8不用对应直接用
      Random rd = new Random();
      int i = rd.nextInt(3); // Random value between 0 and 2 (inclusive)

      // 注册码
      String y3 = regDate.substring(2, 3); // 年第三位
      String y4 = regDate.substring(3, 4); // 年第四位
      String m1 = regDate.substring(4, 5); // 月第一位
      String m2 = regDate.substring(5, 6); // 月第二位
      String d1 = regDate.substring(6, 7); // 日第一位
      String d2 = regDate.substring(7, 8); // 日第二位
      String[] month = month10;
      if ("1".equals(m1)) month = month11;

      // 注册码拼接
      String zccode = regCode.substring(0, 4) + year3 + year42
                + month + year42 + regCode.substring(4, 8)
                + year42 + d2 + "2"; // 固定1或2均可
      log.info("res req code --> {}", zccode);
    }

    int findIndex(String[] array, String value) {
      for (int index = 0; index < array.length; index++) {
            if (array.equals(value)) {
                return index;
            }
      }
      throw new IllegalArgumentException("Value not found in array: " + value);
    }

    String m12(String string_7) {
      int length = string_7.length();
      long num = 0L;
      if (length > 0) {
            for (int i = 0; i < length; i++) {
                int num3 = (int) string_7.charAt(i);
                int num4 = num3 + 7;
                int num5 = num3 * 5;
                num += smethod_8(num3, num4, num5);
                num += smethod_9(num3, num4, num5);
                num += smethod_10(num3, num4, num5);
                num *= smethod_11(num3, num4, num5) + 12L;
                if (num > 100000000L) {
                  num = Long.parseLong(Long.toString(num).substring(Math.max(0, Long.toString(num).length() - 7)));
                }
            }
            String text = Long.toString(num);
            if (text.length() >= 6) {
                return text.substring(text.length() - 6);
            } else {
                return Long.toString(num + 523109L).substring(Math.max(0, Long.toString(num + 523109L).length() - 6));
            }
      }
      return "";
    }
    String m4(String string_7) {
      String text2 = "";
      String text3 = "";

      // 构建 text2
      text2 = string_7.substring(10, 12) +
                string_7.substring(0, 2) +
                string_7.substring(14, 16) +
                string_7.substring(21, 23) +
                string_7.substring(6, 8) +
                string_7.substring(4, 6);

      // 处理 text2
      for (int num = 1; num <= 12; num++) {
            String charAtIndex = text2.substring(num - 1, num);
            if (isNumeric(charAtIndex)) {
                int numValue = Integer.parseInt(charAtIndex);
                text3 += Integer.toString(numValue ^ 5);
            } else {
                char charValue = (char) (charAtIndex.charAt(0) + 20 - num);
                String text4 = Character.toString(charValue);
                if (text4.equals("O")) {
                  text3 += "0";
                } else {
                  text3 += text4;
                }
            }
      }

      // 替换 "0" 为 "7"
      text3 = text3.replace("0", "7");

      // 重新排列 text3
      String result = text3.substring(8, 10) +
                text3.substring(4, 6) +
                text3.substring(10, 12) +
                text3.substring(6, 8);
      return result;
    }

    boolean isNumeric(String str) {
      return str.matches("\\d");
    }

    int smethod_8(int int_0, int int_1, int int_2) {
      return (int_0 << 2) | (int_1 & int_2);
    }

    int smethod_9(int int_0, int int_1, int int_2) {
      return int_0 & int_2 & ((int_1 << 3) | int_2);
    }

    int smethod_10(int int_0, int int_1, int int_2) {
      return (int_0 & (int_2 << 2)) | ((int_1 << 3) & int_2);
    }

    int smethod_11(int int_0, int int_1, int int_2) {
      return (int_0 << 4) & (int_2 << 2) & ((int_1 << 2) | int_2);
    }

hongm 发表于 2024-8-28 12:38

## Python代码
import hashlib
import random

def m4(string_7):
    text2 = ""
    text3 = ""
    text2 += string_7 + string_7 + string_7
    text2 += string_7 + string_7 + string_7
    print(text2)
    for num in range(1,13):
      charAtIndex = text2
      if charAtIndex.isdigit():
            numValue = int(charAtIndex)
            text3 += str(numValue ^ 5)
      else:
            text4 = chr(ord(charAtIndex) + 20 - num)
            if text4 == "O":
                text3 += "0"
            else:
                text3 += text4
    text3 = text3.replace("0", "7")
    # 重新排列 text3
    result = text3 + text3 + text3 + text3
    return result

def m12(string_7):
    length = len(string_7)
    num = 0
    if length > 0:
      for i in range(length):
            num3 = ord(string_7)
            num4 = num3 + 7
            num5 = num3 * 5
            num += smethod_8(num3, num4, num5)
            num += smethod_9(num3, num4, num5)
            num += smethod_10(num3, num4, num5)
            num *= smethod_11(num3, num4, num5) + 12
            if num > 100000000:
                num = int(str(num))
      text = str(num)
      if len(text) >= 6:
            return text
      else:
            return str(num + 523109)
    else:
      return ""

def smethod_8(int_0, int_1, int_2):
    return (int_0 << 2) | (int_1 & int_2)

def smethod_9(int_0, int_1, int_2):
    return int_0 & int_2 & ((int_1 << 3) | int_2)
   
def smethod_10(int_0, int_1, int_2):
    return (int_0 & (int_2 << 2)) | ((int_1 << 3) & int_2)

def smethod_11(int_0, int_1, int_2):
    return (int_0 << 4) & (int_2 << 2) & ((int_1 << 2) | int_2)

def string_to_md5(string):
    return hashlib.md5(string.encode('utf8')).hexdigest().upper()


def main(pcCode, regDate="20291228"):
    text = pcCode.replace("-", "")
    if len(text) > 10:
      text = text + text
    regCode = m4(string_to_md5(m12(text)))
   
    # 年份yyyy 后2位对应注册码 5-6位
    # 6,7,B=>1 对应1几年 8,9,C=>2 对应2几年
    year3 = ["8", "9", "C"]
    # 年份第四位对照关系
    year41 = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
    year42 = ["A", "B", "C", "D", "E", "F", "G", "H", "J", "K"]
    # 月份MM 对应注册码7-8位
    # 月份第一位, 6,7,B=>1 对应1 4,5,A=>0 对应0 月份第二位对照关系同年份第四位对照关系
    month10 = ["4", "5", "A"]
    month11 = ["6", "7", "B"]
    # 日dd对应注册码13,14位
    # 第一位A,B,C=> 0,1,2 第二位0-8不用对应直接用
    i = random.randint(0,2)
    # 注册码
    y3 = regDate
    y4 = regDate
    m1 = regDate
    m2 = regDate
    d1 = regDate
    d2 = regDate
    month = month10[:] if m1=="0" else month11[:]
    # 注册码拼接
    zccode = regCode
    zccode += year3
    zccode += year42
    zccode += month
    zccode += year42
    zccode += regCode
    zccode += year42
    zccode += d2 + "2"
    return zccode

if __name__ == "__main__":
    regDate = "20291228"
    while True:
      pcCode = input("输入机器码:")
      if not pcCode or pcCode.lower() in ["q","e","quit","exit"]:
            break
      print(f"   注册码:{main(pcCode)}")

jun269 发表于 2024-8-26 13:32

楼主,既然是注册机,是不是给我们这些小白来个成品,代码我们看不懂也没发处理{:1_893:}

RAIPing 发表于 2026-3-2 16:17

少马石 发表于 2026-3-2 11:18
能不能发我一个,谢谢

通过网盘分享的文件:注册机.7z
链接: https://pan.baidu.com/s/1UZ-WcAVkRSNKmfIV9ObaTA?pwd=jzgo 提取码: jzgo
--来自百度网盘超级会员v8的分享

yys5161 发表于 2024-8-26 15:03

楼主厉害了,能发下成品就好了。

RAIPing 发表于 2025-10-9 16:35

本帖最后由 RAIPing 于 2025-10-9 16:46 编辑

RAIPing 发表于 2025-10-9 12:20
跑出来注册,提示成功,但还是提示过期
用AI生成了一个UI打包了一下。Python打包怎么这么大,十几K的东西,打包后10M{:1_907:}
通过网盘分享的文件:注册机.7z
链接: https://pan.baidu.com/s/1nK8h8MZxiJSFMRwm2GtBwQ?pwd=jzgo 提取码: jzgo

三点半源码 发表于 2024-8-27 14:34

本帖最后由 三点半源码 于 2024-8-27 14:38 编辑

//已转C#控制台
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

class Program
{
    static void Main()
    {
      // 机器码
      string pcCode = "92132-11802-62920-20730";
      // 有效时长 2029-12-28 超过这个的 不一定能注册成哈
      string regDate = "20291228";

      string text = pcCode.Replace("-", "");
      if (text.Length > 10)
      {
            text = text.Substring(0, 10) + text.Substring(text.Length - 5);
      }

      string regCode = m4(MD5Hex(m12(text)).ToUpper());

      // 年份yyyy 后2位对应注册码 5-6位
      string[] year3 = { "8", "9", "C" };
      // 年份第四位对照关系
      string[] year41 = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
      string[] year42 = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K" };

      // 月份MM 对应注册码7-8位
      string[] month10 = { "4", "5", "A" };
      string[] month11 = { "6", "7", "B" };

      Random rd = new Random();
      int i = rd.Next(0, 3); // Random value between 0 and 2 (inclusive)

      // 注册码
      string y3 = regDate.Substring(2, 1); // 年第三位
      string y4 = regDate.Substring(3, 1); // 年第四位
      string m1 = regDate.Substring(4, 1); // 月第一位
      string m2 = regDate.Substring(5, 1); // 月第二位
      string d1 = regDate.Substring(6, 1); // 日第一位
      string d2 = regDate.Substring(7, 1); // 日第二位
      string[] month = month10;
      if (m1 == "1") month = month11;

      // 注册码拼接
      string zccode = regCode.Substring(0, 4) + year3 + year42
                + month + year42 + regCode.Substring(4, 4)
                + year42 + d2 + "2"; // 固定1或2均可

      Console.WriteLine($"Generated Registration Code: {zccode}");
      Console.ReadKey();
    }

    static string MD5Hex(string input)
    {
      using (var md5 = MD5.Create())
      {
            byte[] inputBytes = Encoding.UTF8.GetBytes(input);
            byte[] hashBytes = md5.ComputeHash(inputBytes);
            StringBuilder sb = new StringBuilder();
            foreach (byte b in hashBytes)
            {
                sb.Append(b.ToString("x2"));
            }
            return sb.ToString();
      }
    }

    static string m12(string string_7)
    {
      long num = 0;
      if (string_7.Length > 0)
      {
            foreach (char c in string_7)
            {
                int num3 = (int)c;
                int num4 = num3 + 7;
                int num5 = num3 * 5;

                num += smethod_8(num3, num4, num5);
                num += smethod_9(num3, num4, num5);
                num += smethod_10(num3, num4, num5);
                num = num * (smethod_11(num3, num4, num5) + 12);

                if (num > 100000000L)
                {
                  num = long.Parse(num.ToString().Substring(Math.Max(0, num.ToString().Length - 7)));
                }
            }
            string text = num.ToString();
            if (text.Length >= 6)
            {
                return text.Substring(text.Length - 6);
            }
            else
            {
                return (num + 523109L).ToString().Substring(Math.Max(0, (num + 523109L).ToString().Length - 6));
            }
      }
      return "";
    }

    static string m4(string string_7)
    {
      string text2 = string_7.Substring(10, 2) +
                        string_7.Substring(0, 2) +
                        string_7.Substring(14, 2) +
                        string_7.Substring(21, 2) +
                        string_7.Substring(6, 2) +
                        string_7.Substring(4, 2);

      string text3 = "";
      for (int num = 1; num <= 12; num++)
      {
            string charAtIndex = text2.Substring(num - 1, 1);
            if (isNumeric(charAtIndex))
            {
                int numValue = int.Parse(charAtIndex);
                text3 += (numValue ^ 5).ToString();
            }
            else
            {
                char charValue = (char)(charAtIndex + 20 - num);
                string text4 = charValue.ToString();
                if (text4.Equals("O"))
                {
                  text3 += "0";
                }
                else
                {
                  text3 += text4;
                }
            }
      }

      // 替换 "0" 为 "7"
      text3 = text3.Replace("0", "7");

      // 重新排列 text3
      string result = text3.Substring(8, 2) +
                        text3.Substring(4, 2) +
                        text3.Substring(10, 2) +
                        text3.Substring(6, 2);
      return result;
    }

    static bool isNumeric(string str)
    {
      return str.All(char.IsDigit);
    }

    static int FindIndex(string[] array, string value)
    {
      for (int index = 0; index < array.Length; index++)
      {
            if (array.Equals(value))
            {
                return index;
            }
      }
      throw new ArgumentException("Value not found in array: " + value);
    }

    static int smethod_8(int int_0, int int_1, int int_2)
    {
      return (int_0 << 2) | (int_1 & int_2);
    }

    static int smethod_9(int int_0, int int_1, int int_2)
    {
      return int_0 & int_2 & ((int_1 << 3) | int_2);
    }

    static int smethod_10(int int_0, int int_1, int int_2)
    {
      return (int_0 & (int_2 << 2)) | ((int_1 << 3) & int_2);
    }

    static int smethod_11(int int_0, int int_1, int int_2)
    {
      return (int_0 << 4) & (int_2 << 2) & ((int_1 << 2) | int_2);
    }
}

jianping520 发表于 2024-8-26 14:04

搞个成品,发网盘。

鴻渊 发表于 2024-8-27 17:13

gxg163 发表于 2024-8-27 00:05
大神能不能给跑一下98761-48153-62920-20730

12679J7C5K3SC82
试试

奔跑的小虎 发表于 2025-2-26 10:19

港湾999 发表于 2025-2-26 07:53
大神就是大神,纯粹的小白啥都看不懂

发出来你的注册码 我帮你跑一下

kennygui 发表于 2024-8-26 14:02

厉害,不过我也是想求注册机,哈哈

yjn866y 发表于 2024-8-26 13:56

厉害厉害。谢谢分享

博爵 发表于 2024-8-26 14:25

感谢分享,注册成功了

donkey12 发表于 2024-8-26 14:49

感谢分享

gys19830912 发表于 2024-8-26 14:50

感谢分享啊

开创者 发表于 2024-8-26 15:45

很不错哈,虽然看不懂也用不来,但根据你这个我成功注册了一下
页: [1] 2 3 4 5 6 7 8 9 10
查看完整版本: 某专业起名程序,注册码java实现