当前位置:网站首页>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 :
边栏推荐
- 去除router-link中的下划线
- 请问怎么在oracle视图中使用stustr函数
- Recommended practice sharing of Zhilian recruitment based on Nebula graph
- Postgressql stream replication active / standby switchover primary database no read / write downtime scenario
- 【5G NR】RRC连接释放
- (practice C language every day) the sum of the nearest three numbers
- 纪念成为首个 DAYU200 三方 demo 贡献者
- Source code look me
- Solve the problem of base64encoder error
- Mobile web development learning notes - Layout
猜你喜欢

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

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

Experiment collection of University "Fundamentals of circuit analysis". Experiment 4 - Research on linear circuit characteristics

又是一年毕业季

2020.4.12 byte written test questions B DP D monotone stack

After the win10 system is upgraded for a period of time, the memory occupation is too high

Xpt2046 four wire resistive touch screen

Huawei ECS installs mysqlb for mysqld service failed because the control process exited with error code. See “sys

图数据库|Nebula Graph v3.1.0 性能报告

微信v3native支付设置的结束时间处理办法
随机推荐
Traversal before, during and after binary tree
Register as a harmonios developer and install deveco studio 3.0 beta2 for harmonios
JS learning notes - process control
Maui学习之路(三)--Winui3深入探讨
2022最新最详细必成功的在Vscode中设置背景图、同时解决不受支持的问题
day4
结构体的内存对齐
构建多架构镜像的最佳实践
愛可可AI前沿推介(7.2)
Xpt2046 four wire resistive touch screen
MySQL calculates the data within the longitude and latitude range
【5G NR】RRC连接释放
Song of cactus - throwing stones to ask the way (3)
Comment réaliser un graphique Nebula d'importation CSV hors ligne de niveau milliard
Astra: could not open "2bc5/ [email protected] /6“: Failed to set USB interface
[solution] educational codeforces round 82
原神2.6服务端下载以及搭建安装教程
Lseek error
[fluent] dart language (DART language features | JIT instant compilation | AOT static compilation)
潘多拉 IOT 开发板学习(RT-Thread)—— 实验2 RGB LED 实验(学习笔记)
