zrax / pycdc

C++ python bytecode disassembler and decompiler
GNU General Public License v3.0
3.38k stars 645 forks source link

Unsupported opcode: MAKE_CELL #510

Open yeqiu6080 opened 3 months ago

yeqiu6080 commented 3 months ago

pycdc V0.4.pyc

Source Generated with Decompyle++

File: V0.4.pyc (Python 3.11)

import requests from bs4 import BeautifulSoup import logging import re import time from requests.exceptions import RequestException import os import threading from queue import Queue from tqdm import tqdm from cn2an import transform MAX_THREADS = 2 logging.basicConfig(level = logging.INFO, format = '%(asctime)s - %(levelname)s - %(message)s')

def fix_publisher(text): text = re.sub('

', '', text) text = re.sub('<!--\?xml.?>', '', text) text = re.sub('<link .?/>', '', text) text = re.sub('<meta .?/>', '', text) text = re.sub('<h1 .?>', '', text) text = re.sub('
', '', text) text = re.sub('<!DOCTYPE html .?>', '', text) text = re.sub('<span .?>', '', text) text = re.sub('<html .*?>', '', text) return text

def chinese_to_number(chinese_num_str): string_num = transform(chinese_num_str) result_num = int(string_num) return result_num

def extract_chapter_number(filename): match = re.search('绗?Unsupported opcode: MAKE_CELL imageV0.4.zip

wilson0x4d commented 3 months ago

I have similar problems with multiple opcodes over different pycfiles, in one case the "Unsupported opcode" isn't even used in the pyc anywhere (confirmed in a hex editor), and it's always an opcode that is supported (exists in ASTree.cpp and should not be falling through into default: case which prints this message.)

This issue has actually rendered the pycdc tool itself unreliable for me (sometimes it works, sometimes it doesn't).

What is interesting is in every case this occurs the pycdas tool works correctly and does not emit any <INVALID> entries, as a result I have stopped using pycdc in favor of pycdas since the disassembler always works correctly.

Seems like a bug. I believe a similar report has been made by other users recently:

..because I can't publicly share any of my test inputs where I have observed this I have hesitated to file a bug, but it seems it's not just me running into whatever this is.

Seems like an AST bug.

wilson0x4d commented 3 months ago

https://github.com/zrax/pycdc/pull/511 should correct the error message users are seeing, but root cause is unimplemented opcodes which the PR does not address.

ghost commented 2 months ago

I have a script that fails with MAKE_CELL too. Here is a script in case anyone wanna take a look. it's based on Py 3.11 script.zip