bad marshal data (unknown type code)
$ python stegosaurus.py LOL.pyc -x
Traceback (most recent call last):
File "stegosaurus.py", line 251, in
higher python version have a different header size, it is not 12.
you can just try brute forcing the header size if you don't want to read every python version's source code and hard code the header size.
also note that you need a corresponding python version to unmarshal the code object. eg: for a python 3.12 pyc file, you need to run stegosaurus.py with a python 3.12 interpreter.
def _loadBytecode(carrier, logger):
try:
for i in range(12,200):
f = open(carrier, "rb")
try:
header = f.read(i)
code = marshal.load(f)
if type(code) is not types.CodeType:
logger.info("type(code) is %s, not CodeType, you need a higher python version", type(code))
logger.debug("Read header and bytecode from carrier,i=%d",i)
return (header, code)
except Exception as e:
pass
finally:
f.close()
else:
logger.critical("Failed to read carrier file after multiple attempts")
sys.exit(1)
finally:
pass