好友
阅读权限10
听众
最后登录1970-1-1
|
本帖最后由 luyutao 于 2026-6-18 15:12 编辑
前几天笔者的好朋友买了款纳西妲桌宠,我也受他推荐买了款可莉桌宠。
桌宠下载后打开发现有验证要求。看到左边那根小羽毛感觉是python程序。输入激活码后可以用。本着想让虚拟机也能用的想法(硬件不同,激活码不通用),我准备拿它练练手。
先查一下壳,验证了开始想法,本软件为使用PyInstaller打包的Python文件。
准备PyInstaller脱壳工具pyinstxtractor-ng,我用的是网页版PyInstaller Extractor WEB
将下载好的压缩包解压,发现了一个gsi.exe。我用winrar打开发现是一个自解压程序,判断这是桌宠本体。(本体内容后面会写,暂时不管他)
观察可得核心文件为encoderGod.pyc,接下来就可以使用pyc反编译工具得到源代码。该软件验证部分是python3.13写的。我用pycdc失败了,后用了在线的反编译工具pylingual,但是出现了compilation error
反正大部分可以看了,先保存下来吧。
我让ai改了下错误,获得下面的部分代码
def get_machine_code():
cpu_info = str(platform.processor()) + str(psutil.cpu_count(logical=False)) + str(psutil.cpu_count(logical=True))
mainboard_serial_number = get_mainboard_serial_number()
machine_code = cpu_info + mainboard_serial_number
return machine_code
def generate_user(machine_code):
pre_key = 'hy'
end_key = 'a'
machine_code = pre_key + machine_code + end_key
return hashlib.md5(machine_code.encode()).hexdigest()
def generate_key(machine_code):
no_key = '可莉112'
machine_code = machine_code + no_key
return hashlib.md5(machine_code.encode()).hexdigest()
原理不复杂,先把cpu型号,物理核心数,逻辑核心数转为字符串加在一起,然后获得主板序列号,拼在最后面生成机器码
机器码前面拼接hy,后面拼接a,做md5,生成验证用码
验证用码加盐再md5就是激活码。(盐是每个型号桌宠名字和序号)
def verify_key(auto=False):
user_key = key_entry.get()
machine_code = get_machine_code()
machine_code = generate_user(machine_code)
current_key = generate_key(machine_code)
if user_key == current_key:
messagebox.showinfo('激活成功', '点击确认启动,感谢支持') or auto
save_data()
app.withdraw()
try:
current_dir = os.path.dirname(__file__)
exe_path = os.path.join(current_dir, 'gsl.exe')
subprocess.run([exe_path], check=True, cwd=os.path.dirname(sys.executable), shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
app.destroy()
sys.exit()
except subprocess.CalledProcessError as e:
print(f'Error running gsl.exe: {e}')
except FileNotFoundError:
print('gsl.exe not found.')
else:
messagebox.showerror(current_key, '激活码错误,请重试') if not auto else None
这是判断部分代码,如果激活码正确就启动自解压主程序,然后退出激活程序,错误就弹窗通知
代码分析结束,可以写出keygen
import hashlib
user_id = input("youruserid")
key = hashlib.md5((user_id + '可莉112').encode()).hexdigest()
print(f'用户ID: {user_id}')
print(f'激活码: {key}')
测试成功,软件根目录生成了存放注册码的txt,删除该文件后,软件重回未注册状态。
总结:本次简单的展示了通过逆向软件内置算法计算注册码的分析流程,得益于软件能够轻松被脱壳和逆向,我们很容易就能看到软件的源代码,从而解析出其自带的授权码算法。其实脱壳后拿到自解压本体程序就足够用了(可以解压到c盘,不用每次运行在临时目录中)。购买后一开始如果不知道激活码算法可以分析其授权文件来猜测
附录:桌宠本体是开源软件bongo cat,加上可莉live2d模型
bongocat官网https://bongocat.com.cn/
这个桌宠为付费软件(live2d模型为作者制作)
下载链接:https://wwbah.lanzoul.com/iP3rh3sa9zcd密码:bnkd
|
免费评分
-
查看全部评分
|
发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。 |
|
|
|
|
|