当前位置:网站首页>PyC file decompile
PyC file decompile
2022-07-02 16:09:00 【1ens】
pyc File structure
File format :

03f3 0d0a magic Express python Version information for , here 03f30d0a yes python2.7 The logo of ;
6206 b160 Time stamp , Compiled time information
63 Blockde The beginning of
after 4 byte 0000 0000 :argcount Number of parameters
after 4 byte 0000 0000: nlocals Number of local variables
after 4 byte 1b00 0000: stacksize Stack space size
after 4 byte 4000 0000:flags
73: type string
3501 0000 bytes ( The small end model )
After that is opcode
Reference resources :PYC File format analysis
At present, we pay more attention to byte length , Because if you modify its source code , Then the length must change , Therefore, this value should also be modified , And note that it is a small end sequence storage .
Source code mixed dishes :
It can be decompiled , But decompiled is difficult for people to understand . Well known are AST Grammar tree .
pyc Mixed dishes
For executable pyc, We can use pycdump Tool to dump , Check its bytecode form .
Corresponding pyc The file is kept in pycdump Under the folder , function python dump.py test.py

This is a direct jump mixed dish :
The first three jump There is no problem in operation logic , But it will cause decompilation failure Its bytecode is 0x71 0x**
We can insert many such instructions , Arbitrary illegal instructions ( In fact, random data can ), Then use some JUMP Instructions to skip such illegal instructions , The purpose of making mixed dishes , And does not affect the normal operation of the program .
Treatment method : We delete these three instructions , And will code_string Reduce the length of 6 Bytes . That's the top
3501 0000 bytes ( The small end model ), Then save . Final use uncompyle6 Decompile , Analyze .
Overlapping instructions :
# example 1 Python Single overlap instruction
0 JUMP_ABSOLUTE [71 05 00] 5
3 PRINT_ITEM [47 -- --]
4 LOAD_CONST [64 64 01] 356
7 STOP_CODE [00 -- --]
# example 1 Actually implement
0 JUMP_ABSOLUTE [71 05 00] 5
5 LOAD_CONST [64 01 00] 1Here we jump to the third line , But not all the code in the third line is executed , Instead, his operands are regarded as code execution .
uncompyle6 -o total.py .\test.pyc
Reference resources :
边栏推荐
- QVariant与Json的各种纠葛——Qt
- Solve the problem of base64encoder error
- 去除router-link中的下划线
- Armv8-a programming guide MMU (4)
- Solve * * warning * *: your ApplicationContext is unlikely to start due to a @componentscan of the defau
- Idea jar package conflict troubleshooting
- Experiment collection of University Course "Fundamentals of circuit analysis". Experiment 5 - Research on equivalent circuit of linear active two terminal network
- Wavedec2 in MATLAB, talk about the wavedec2 function [easy to understand]
- Postgressql stream replication active / standby switchover primary database no read / write downtime scenario
- Boot transaction usage
猜你喜欢

Storage, reading and writing of blood relationship data of Nepal Graph & Data Warehouse

Introduction to dynamic planning I, BFS of queue (70.121.279.200)

End time processing method of wechat v3native payment settings

Dimension table and fact table in data warehouse

微信v3native支付设置的结束时间处理办法

关于mysql安装的一些问题

结构体的内存对齐

Nebula Graph & 数仓血缘关系数据的存储与读写

How to import a billion level offline CSV into Nepal graph

注册成为harmonyos开发者并安装DevEco Studio 3.0 Beta2 for HarmonyOS
随机推荐
Source code look me
Flink real-time data warehouse (7): Flink realizes the full pull module to extract data in MySQL
Ssh/scp does not prompt all activities are monitored and reported
Memory alignment of structure
图数据库|Nebula Graph v3.1.0 性能报告
Maui学习之路(三)--Winui3深入探讨
Compress words (kmp/ string hash, double hash)
Remove the underline in router link
Why does the system convert the temp environment variable to a short file name?
/Bin/ld: cannot find -lssl
Bean configuration override in boot
Teach you how to build virtual machines locally and deploy microservices
How to import a billion level offline CSV into Nepal graph
愛可可AI前沿推介(7.2)
Group by的用法
Astra: could not open "2bc5/ [email protected] /6“: Failed to set USB interface
Invalid bound statement (not found)解决方法总结
Introduction to database system Chapter 1 short answer questions - how was the final exam?
如何實現十億級離線 CSV 導入 Nebula Graph
Lseek error
