当前位置:网站首页>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 :
边栏推荐
- Boot transaction usage
- Construction and business practice of Zhongke brain knowledge map platform
- 愛可可AI前沿推介(7.2)
- 【5G NR】RRC连接释放
- Crawl the information of national colleges and universities in 1 minute and make it into a large screen for visualization!
- Postgressql stream replication active / standby switchover primary database no read / write downtime scenario
- Floyed "suggestions collection"
- Introduction to Dynamic Planning II (5.647.62)
- 原神2.6服务端下载以及搭建安装教程
- Comparison between rstan Bayesian regression model and standard linear regression model of R language MCMC
猜你喜欢

2022 the latest and most detailed will successfully set the background image in vscade and solve unsupported problems at the same time

JS learning notes - process control

2020.4.12 byte written test questions B DP D monotone stack

Experiment collection of University Course "Fundamentals of circuit analysis". Experiment 5 - Research on equivalent circuit of linear active two terminal network

Application of visualization technology in Nebula graph

Mobile web development learning notes - Layout

Crawl the information of national colleges and universities in 1 minute and make it into a large screen for visualization!

Memory alignment of structure

MySQL calculates the data within the longitude and latitude range

Huawei ECS installs mysqlb for mysqld service failed because the control process exited with error code. See “sys
随机推荐
[solution] educational codeforces round 82
/Bin/ld: cannot find -lpam
全方位解读服务网格(Service Mesh)的背景和概念
The difference and usage of calloc, malloc and realloc functions
Ant group's large-scale map computing system tugraph passed the national evaluation
By asp Net core downloads files according to the path exception
Nebula Graph & 数仓血缘关系数据的存储与读写
Floyed "suggestions collection"
SQL modification statement
Application of visualization technology in Nebula graph
Target detection - make your own deep learning target detection data set with labelimg
Analysis of the difference between array and linked list
基于 Nebula Graph 构建百亿关系知识图谱实践
愛可可AI前沿推介(7.2)
The sea of stars hidden behind the nebula graph
How to import a billion level offline CSV into Nepal graph
Pyinstaller's method of packaging pictures attached to exe
Flink real-time data warehouse (7): Flink realizes the full pull module to extract data in MySQL
【题解】Educational Codeforces Round 82
去除router-link中的下划线
