吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1366|回复: 6
收起左侧

[求助] 拜托大神帮忙写下算号程序

[复制链接]
zyjsuper 发表于 2021-8-2 22:27
本帖最后由 zyjsuper 于 2021-8-2 22:34 编辑

C#源码:
[C#] 纯文本查看 复制代码
internal static class Class1
{
        // Token: 0x06000072 RID: 114 RVA: 0x0000A274 File Offset: 0x00008474
        public static string smethod_0(string string_0)
        {
                if (string_0.IndexOf('-') < 0)
                {
                        return string_0;
                }
                string str = "DBV";
                string_0 = string_0.Replace("-", string.Empty);
                string_0 = string_0.Replace('Q', '4');
                string_0 = string_0.Replace('G', '4');
                string_0 = string_0.Replace('V', '0');
                string_0 = string_0.Replace('N', '3');
                str + string_0;
                byte[] array = new byte[string_0.Length / 2];
                for (int i = 0; i < string_0.Length; i += 2)
                {
                        byte b;
                        byte.TryParse(new string(new char[]
                        {
                                string_0[i],
                                string_0[i + 1]
                        }), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out b);
                        array[i / 2] = b;
                }
                string text = Encoding.ASCII.GetString(array);
                text = text.Insert(1, ":");
                text = text.Insert(5, ":");
                text = text.Insert(9, ":");
                if (text.Length > 13)
                {
                        text = text.Insert(13, ":");
                }
                return text;
        }

        // Token: 0x06000073 RID: 115 RVA: 0x0000A384 File Offset: 0x00008584
        public static bool smethod_1(string string_0)
        {
                bool flag = true;
                string a = string_0.Substring(4, 5);
                if (a == "IALV")
                {
                        flag = false;
                }
                if (string_0[0] != 'F')
                {
                        flag = false;
                }
                int num = int.Parse(string_0[2].ToString(), NumberStyles.HexNumber);
                if (num > 16)
                {
                        flag = false;
                }
                if (a != "I:ALV")
                {
                        flag = false;
                }
                num = int.Parse(string_0[3].ToString(), NumberStyles.HexNumber);
                if (num > 16)
                {
                        flag = false;
                }
                if (!int.TryParse(string_0.Substring(10, 3), out num))
                {
                        flag = false;
                }
                if (string_0.Length <= 14)
                {
                        throw new ApplicationException("Invalid Unlock Code");
                }
                int num2 = int.Parse(string_0.Substring(15, 1));
                if (num2 != 2 && num2 != 3)
                {
                        throw new ApplicationException("Incorrect Code for Version");
                }
                string s = string_0.Substring(0, 16);
                string b = string_0.Substring(16);
                int num3 = 0;
                byte[] bytes = Encoding.ASCII.GetBytes(s);
                for (int i = 0; i < bytes.Length; i++)
                {
                        if (bytes[i] % 2 == 0)
                        {
                                num3++;
                        }
                }
                return !(num3.ToString("00") != b) && flag;
        }
}


自己整理的python代码,只是按照源码转义,不具备算号能力
[Python] 纯文本查看 复制代码
class generate_unlockcode:

    def smethod_0(self,string_0):
        if string_0.count('-') < 0:
            return string_0

        #str_pre = 'DBV'
        string_0 = string_0.replace("-", "")
        string_0 = string_0.replace('Q', '4')
        string_0 = string_0.replace('G', '4')
        string_0 = string_0.replace('V', '0')
        string_0 = string_0.replace('N', '3')
        #string_0 = str_pre + string_0

        b = []
        for i in range(0, len(string_0), 2):
            b.append(string_0[i:i + 2])
        #print(b)
        try:
            result = [chr(int(i,16)) for i in b]
            result.insert(1,':')
            result.insert(5,':')
            result.insert(9,':')
            if len(result)> 13:
                result.insert(13,':')

            result = ''.join(result)
            return result
        except:
            pass

    def smethod_1(self):

        string_0 = self.smethod_0('46363449414C56-39343434333132')
        flag = True
        a = string_0[4:9]
        if a == "IALV":
            flag = False
            return flag
        if string_0[0] != 'F':
            flag = False
            return flag
        num = int(str(string_0[2]),16)
        if num > 16:
            flag = False
            return flag
        if a != "I:ALV":
            flag = False
            return flag
        num1 = int(str(string_0[3]), 16)
        if num1 > 16:
            flag = False
            return flag
        str1 = string_0[10:13]
        #print(str1.isdecimal())
        if str1.isdecimal() == False:
            flag = False
            return flag

        if len(string_0) <= 14:
            print("Invalid Unlock Code")
            flag = False
            return flag

        num2 = int(string_0[15])
        if num2 != 2 and num2 != 3:
            print("Incorrect Code for Version")
            flag = False
            return flag
        result = []
        s = string_0[0:16]
        b = string_0[16:]
        num3 = 0
        for i in s:
            if i.isdecimal() != True:
                result.append(ord(i))
            else:
                result.append(int(i,16))

        for i in range(0,len(result)):
            if result[i] %2 == 0:
                num3 += 1

        if int(num3) != int(b):
            flag = False
        print(flag)
        return flag

if __name__ == '__main__':
    obj = generate_unlockcode()
    obj.smethod_1()   

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
为之奈何? + 1 + 1 我很赞同!

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

zeco 发表于 2021-8-2 22:48
支持一下不会C语言
E式丶男孩 发表于 2021-8-2 23:31
fdtemp 发表于 2021-8-3 00:25
温柔 发表于 2021-8-3 00:35
你转义的怎么多出来一组字串?
laos 发表于 2021-8-3 02:17
免費勞力啊   什麽程序 發出來玩
ofo 发表于 2021-8-3 08:24
这些个计算和机器码长度也有关系的,这些参数没有,人家帮你写也和你给出来的代码一样,只能修复中间那一个错 误罢了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-26 00:56

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表