【2026春节】解题领红包之四–TraeCN+GLM5免费干活直接秒!

admin 2026-03-09 02:31:03 网络安全文章 来源:ZONE.CI 全球网 0 阅读模式

文章总结: 作者分享利用国产AI大模型GLM-5辅助解决一道PyInstaller打包的Python逆向CrackMe题目。通过AI工具识别文件结构、解包提取字节码、分析XOR加密算法并暴力破解密钥,成功获取Flag并验证通过。文章展示了大模型在逆向工程辅助中的应用潜力,提供了具体的操作步骤与详细解题脚本,体现了AI赋能安全实战的价值。 综合评分: 84 文章分类: CTF,逆向分析,AI安全,实战经验


cover_image

【2026春节】解题领红包之四–Trae CN+GLM5免费干活直接秒!

原创

吾爱pojie 吾爱pojie

吾爱破解论坛

2026年3月6日 20:25 北京

作者坛账号:无爱灬殇

国产大模型真的也可以!

看到论坛公众号发文说,特别加入了python逆向的题目,让大家更早的接触用AI来解决实际问题。还有很多坛友没有关注到大模型的进化程度,我就抛砖引玉,说说我用IDE+大模型的解题步骤。

解题步骤

  1. 下载Trae CN(国内版,可免费使用),选用智谱的最新大模型GLM-5.

  2. 下载安装python(IDE也会自己下载),nodejs,pip源修改为国内源,powershell5升级到powershell7(支持管道符连接)

  3. 新建文件夹(工作目录),修改为英文名称(crackme.me,防止命令行内执行乱码),切换到solo coder模式。

  4. 输入提示词:这是个解谜程序#crackme.exe(#是引用上下文),请帮我找出正确的flag,并生成逆向报告。(记得点优化输入内容,可以让大模型更好的理解提示词

  5. 点击发送,大模型就开始干活了!(就是这么简单,就可以找到正确的flag了,好多坛友都用上claude code等别的大模型,没怎么尝试,国产的大模型真的进步很大,可以试试的)。

    CrackMe 逆向分析报告

概述

| 项目 | 信息 | | — | — | | 文件名 | crackme.exe | | 文件大小 | 9,221,532 bytes (约 8.8 MB) | | 文件类型 | Windows PE 可执行文件 | | 打包方式 | PyInstaller | | Python 版本 | 3.14 | | 目标 | 找出正确的 flag |


最终结果

正确的 Flag

 复制代码 隐藏代码
52p0j!3#2026*H4ppy-N3w-Y34r@@@

Flag 含义解析

| 部分 | 含义 | | — | — | | 52p0j!3# | “52pojie” 的 leetspeak 变体(吾爱破解) | | 2026 | 年份 | | H4ppy-N3w-Y34r | “Happy-New-Year” 的 leetspeak 变体 | | @@@ | 填充字符 |


详细分析过程

第一步:文件识别

1.1 文件基本信息

通过 Python 脚本读取文件头:

 复制代码 隐藏代码
data = open('crackme.exe', 'rb').read()
print(f'File size: {len(data)} bytes')
print(f'MZ header: {data[:2]}')

结果:

  • 文件大小:9,221,532 bytes
  • 文件头:MZ (Windows PE 可执行文件)
1.2 识别 PyInstaller 特征

通过字符串提取发现以下关键特征:

 复制代码 隐藏代码
pyi-python-flag
Failed to extract script from archive!
Failed to unmarshal codeobject for %s
PyRun_SimpleStringFlags

结论: 这是一个 PyInstaller 打包的 Python 程序。


第二步:解包 PyInstaller

2.1 使用 pyinstxtractor 解包

下载并执行 pyinstxtractor.py:

 复制代码 隐藏代码
python pyinstxtractor.py crackme.exe
2.2 解包结果
 复制代码 隐藏代码
[+]Processingcrackme.exe
[+]Pyinstallerversion: 2.1+
[+]Pythonversion: 3.14
[+]Lengthofpackage: 8875932bytes
[+]Found64filesinCArchive
[+]Possibleentrypoint: crackme_easy.pyc
[+]Successfullyextractedpyinstallerarchive
2.3 关键文件

| 文件名 | 说明 | | — | — | | crackme_easy.pyc | 主程序字节码(关键文件) | | python314.dll | Python 3.14 运行时 | | base_library.zip | 基础库 | | PYZ.pyz | 依赖包压缩文件 |


第三步:字节码分析

3.1 使用 xdis 加载字节码
 复制代码 隐藏代码
from xdis import load_module

version, timestamp, magic_int, code, is_pypy, source_size, sip_hash = load_module('crackme_easy.pyc')
print(f'Python version: {version}')  # (3, 14)
3.2 程序结构分析

程序包含以下函数:

| 函数名 | 行号 | 参数 | 功能 | | — | — | — | — | | xor_decrypt | 8 | (data, key) | XOR 解密函数 | | get_encrypted_flag | 15 | () | 获取加密的 flag | | generate_flag | 21 | () | 动态生成 flag | | calculate_checksum | 32 | (s,) | 计算校验和 | | hash_string | 39 | (s,) | 计算字符串哈希 | | verify_flag | 43 | (user_input,) | 验证用户输入 | | fake_check_1 | 57 | (user_input,) | 假检查 1(干扰项) | | fake_check_2 | 62 | (user_input,) | 假检查 2(干扰项) | | main | 67 | () | 主函数 |

3.3 关键常量提取

get_encrypted_flag 函数:

 复制代码 隐藏代码
# 常量
encrypted_flag_b64 = 'e3w+fiRvfW18fnx4ZAZ6Pj43YwB9OWMXfXo8Dg4O'

main 函数提示信息:

 复制代码 隐藏代码
'CrackMe Challenge - Python Edition'
'Keywords: 52pojie, 2026, Happy New Year'
'Hint: Decompile me if you can!'

fake_check_1 假哈希:

 复制代码 隐藏代码
'a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890'

fake_check_2 假哈希:

 复制代码 隐藏代码
'1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'

第四步:加密算法分析

4.1 XOR 加密原理

程序使用简单的 XOR 加密:

 复制代码 隐藏代码
defxor_decrypt(data, key):
    result = bytearray()
    for i, byte inenumerate(data):
        result.append(byte ^ key[i % len(key)])
    return result
4.2 加密数据分析
 复制代码 隐藏代码
import base64

encrypted_flag_b64 = 'e3w+fiRvfW18fnx4ZAZ6Pj43YwB9OWMXfXo8Dg4O'
encrypted_flag = base64.b64decode(encrypted_flag_b64)

print(f'Encrypted bytes: {list(encrypted_flag)}')
# [123, 124, 62, 126, 36, 111, 125, 109, 124, 126, 124, 120, 100, 6, 122, 62, 62, 55, 99, 0, 125, 57, 99, 23, 125, 122, 60, 14, 14, 14]
print(f'Length: {len(encrypted_flag)}')
# 30

第五步:破解 XOR 密钥

5.1 单字节 XOR 暴力破解
 复制代码 隐藏代码
defxor_decrypt(data, key):
    result = bytearray()
    for i, byte inenumerate(data):
        result.append(byte ^ key[i % len(key)])
    return result

defis_printable(data):
&nbsp; &nbsp;&nbsp;returnall(32&nbsp;<= b <&nbsp;127for&nbsp;b&nbsp;in&nbsp;data)

# 暴力破解单字节密钥
for&nbsp;i&nbsp;inrange(256):
&nbsp; &nbsp; test_key =&nbsp;bytes([i])
&nbsp; &nbsp; dec = xor_decrypt(encrypted_flag, test_key)
&nbsp; &nbsp;&nbsp;if&nbsp;is_printable(dec):
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;print(f'Single byte key&nbsp;{i}:&nbsp;{dec.decode()}')
5.2 破解结果

密钥 = 78 (ASCII: ‘N’)

解密结果:

&nbsp;复制代码&nbsp;隐藏代码
52p0j!3#2026*H4ppy-N3w-Y34r@@@
5.3 验证
&nbsp;复制代码&nbsp;隐藏代码
key =&nbsp;bytes([78])
test_content =&nbsp;'52p0j!3#2026*H4ppy-N3w-Y34r@@@'
test_bytes = test_content.encode('latin-1')
re_encrypted = xor_decrypt(test_bytes, key)

print(f'Original encrypted:&nbsp;{encrypted_flag.hex()}')
# 7b7c3e7e246f7d6d7c7e7c7864067a3e3e3763007d3963177d7a3c0e0e0e
print(f'Re-encrypted: &nbsp; &nbsp; &nbsp; &nbsp;{re_encrypted.hex()}')
# 7b7c3e7e246f7d6d7c7e7c7864067a3e3e3763007d3963177d7a3c0e0e0e
print(f'Match:&nbsp;{re_encrypted == encrypted_flag}')
# True
5.4 验证截图
&nbsp;复制代码&nbsp;隐藏代码
==================================================
&nbsp; &nbsp;CrackMe Challenge - Python Edition
==================================================
Keywords:&nbsp;52pojie,&nbsp;2026, Happy New Year
Hint: Decompile me&nbsp;if&nbsp;you can!
--------------------------------------------------

[?] Enter the password:&nbsp;52p0j!3#2026*H4ppy-N3w-Y34r@@@

==================================================
&nbsp; &nbsp; &nbsp; &nbsp; *** SUCCESS! ***
==================================================
[+] Congratulations! You cracked it!
[+] Correct flag:&nbsp;52p0j!3#2026*H4ppy-N3w-Y34r@@@

Press Enter to&nbsp;exit...

程序流程图

&nbsp;复制代码&nbsp;隐藏代码
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;程序启动 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;│
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; 显示欢迎信息和提示 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
│ &nbsp;"Keywords: 52pojie, 2026, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;│
│ &nbsp; Happy New Year"&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;│
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; 要求用户输入密码 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
│ &nbsp; &nbsp;&nbsp;"[?] Enter the password:"&nbsp; &nbsp; &nbsp; &nbsp;│
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; 执行 fake_check_1 (假检查) &nbsp; &nbsp; &nbsp; │
│ &nbsp; &nbsp; 比较用户输入的 SHA256 哈希 &nbsp; &nbsp; &nbsp; │
│ &nbsp; &nbsp; 与预设假哈希 (干扰项) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;│
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; 执行 fake_check_2 (假检查) &nbsp; &nbsp; &nbsp; │
│ &nbsp; &nbsp; 另一个假哈希比较 (干扰项) &nbsp; &nbsp; &nbsp; &nbsp; │
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; 调用 generate_flag() &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;│
│ &nbsp; &nbsp; 1. 获取 Base64 编码的加密数据 &nbsp; &nbsp;│
│ &nbsp; &nbsp; 2. 解码 Base64 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;│
│ &nbsp; &nbsp; 3. XOR 解密 (密钥未知) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
│ &nbsp; &nbsp; 4. 返回真正的 flag &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; │
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌─────────────────────────────────────┐
│ &nbsp; &nbsp; 调用 verify_flag(user_input) &nbsp; &nbsp;│
│ &nbsp; &nbsp; 逐字符比较用户输入与正确 flag &nbsp; &nbsp;│
└─────────────────┬───────────────────┘
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;┌────────┴────────┐
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;▼ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ▼
┌──────────────┐ &nbsp; ┌──────────────┐
│ &nbsp; 验证成功 &nbsp; &nbsp;│ &nbsp; │ &nbsp; 验证失败 &nbsp; &nbsp;│
│ &nbsp;显示 flag &nbsp; &nbsp;│ &nbsp; │ &nbsp;显示错误 &nbsp; &nbsp;│
└──────────────┘ &nbsp; └──────────────┘

关键技术点

1. PyInstaller 打包识别

PyInstaller 打包的程序通常具有以下特征:

  • 文件较大(包含 Python 解释器和依赖库)
  • 包含 pyi- 前缀的字符串
  • 包含 Failed to extract 等错误信息字符串
  • 使用 pyinstxtractor 可以解包

2. Python 字节码分析

由于 Python 3.14 较新,常规反编译工具(如 uncompyle6、decompyle3)不支持。解决方案:

  • 使用 xdis 库加载和分析字节码
  • 提取常量、变量名、函数名等信息
  • 通过字节码推断程序逻辑

3. XOR 加密破解

XOR 加密的特点:

  • 简单但有效
  • 单字节 XOR 可以通过暴力破解
  • 已知明文攻击:如果知道部分明文,可以推导密钥

4. 干扰项识别

程序中的 fake_check_1 和 fake_check_2 是干扰项:

  • 它们比较用户输入的 SHA256 哈希与预设假哈希
  • 真正的验证在 verify_flag 函数中
  • 通过分析字节码可以识别这些假检查

工具清单

| 工具 | 用途 | | — | — | | Python 3.x | 脚本执行环境 | | pyinstxtractor | PyInstaller 解包 | | xdis | Python 字节码分析 | | base64 | Base64 解码 |


解题脚本

完整的解题脚本:

&nbsp;复制代码&nbsp;隐藏代码
import&nbsp;base64

# 加密的 flag (Base64 编码)
encrypted_flag_b64 =&nbsp;'e3w+fiRvfW18fnx4ZAZ6Pj43YwB9OWMXfXo8Dg4O'
encrypted_flag = base64.b64decode(encrypted_flag_b64)

# XOR 解密函数
defxor_decrypt(data, key):
&nbsp; &nbsp; result =&nbsp;bytearray()
&nbsp; &nbsp;&nbsp;for&nbsp;i, byte&nbsp;inenumerate(data):
&nbsp; &nbsp; &nbsp; &nbsp; result.append(byte ^ key[i %&nbsp;len(key)])
&nbsp; &nbsp;&nbsp;return&nbsp;result

# XOR 密钥 (通过暴力破解获得)
key =&nbsp;bytes([78]) &nbsp;# ASCII: 'N'

# 解密
decrypted = xor_decrypt(encrypted_flag, key)
flag_content = decrypted.decode('latin-1')

# 输出结果
print(f'Decrypted:&nbsp;{flag_content}')
print(f'Full flag: flag{{{flag_content}}}')

输出:

&nbsp;复制代码&nbsp;隐藏代码
Decrypted:&nbsp;52p0j!3#2026*H4ppy-N3w-Y34r@@@
Full flag: flag{52p0j!3#2026*H4ppy-N3w-Y34r@@@}

总结

本题是一个典型的 PyInstaller 打包的 Python CrackMe 题目,主要考察:

  1. 文件识别能力
  • 识别 PyInstaller 打包特征
  1. 解包技术
  • 使用 pyinstxtractor 解包
  1. 字节码分析
  • 分析 Python 字节码理解程序逻辑
  1. 密码学基础
  • 理解 XOR 加密并破解
  1. 逆向思维
  • 识别干扰项,找到真正的验证逻辑

参考资料

  • PyInstaller Official Documentation
  • pyinstxtractor GitHub
  • xdis Python Library
  • XOR Cipher – Wikipedia

报告生成时间: 2026-02-27

-官方论坛

www.52pojie.cn

👆👆👆

公众号设置“星标”,不会错过新的消息通知

开放注册、精华文章和周边活动等公告


免责声明:

本文所载程序、技术方法仅面向合法合规的安全研究与教学场景,旨在提升网络安全防护能力,具有明确的技术研究属性。

任何单位或个人未经授权,将本文内容用于攻击、破坏等非法用途的,由此引发的全部法律责任、民事赔偿及连带责任,均由行为人独立承担,本站不承担任何连带责任。

本站内容均为技术交流与知识分享目的发布,若存在版权侵权或其他异议,请通过邮件联系处理,具体联系方式可点击页面上方的联系我

本文转载自:吾爱破解论坛 吾爱pojie 吾爱pojie《【2026春节】解题领红包之四–Trae CN+GLM5免费干活直接秒!》

评论:0   参与:  0