Menu

#3 PE creates invalid pyc files

1.0
closed
nobody
None
2016-01-19
2016-01-19
No

When extracting compiled python files from the *.pyz (inside some pyinstaller *.exe) these *.pyc are corrupted. They don't run and even made the decompiler crashing.
First I thought it's a just a bug in Decompyle++ however it turned out, that both need some tiny improvements.
It's an issue for Python 3.3 and above files
All details are here:
https://github.com/zrax/pycdc/issues/73

Discussion

  • Daniello Alto

    Daniello Alto - 2016-01-19

    Quick fixed the issue by adding these two lines:

                with open(os.path.join(dirName, fileName + '.pyc'), 'wb') as pycFile:
                    pycFile.write(pycHeader)    # Write pyc magic
                    pycFile.write(b'TIME')      # Write timestamp
    
                    isAbovePython3_3 = (self.pyver<=33)
                    if isAbovePython3_3:
                        pycFile.write(b'SIZE')     # Size parameter added in Python 3.3
    
                    pycFile.write(data)
    
     
  • ExtremeCoders

    ExtremeCoders - 2016-01-19

    Thanks. Issue has been fixed in version 1.4.

     
  • ExtremeCoders

    ExtremeCoders - 2016-01-19
    • status: accepted --> closed
     

Log in to post a comment.