I have decompiled a .exe compiled.
I got a .pyz file and some other files:
Extracted them and got this:
How am I able to get the .py file from all those .pyc files?
You can decompile .pyc files yes - see these similar questions:
Is it possible to decompile a compiled .pyc file into a .py file?
https://reverseengineering.stackexchange.com/questions/1701/decompiling-pyc-files
The short of it is that you can use a tool to generate .py files from .pyc:
https://github.com/rocky/python-uncompyle6/
Related
I have recently downloaded some models for blender but when I unzipped it the file was in .py format I want to add them to my project but I cant I tried "open in" method but no results..... can anyone tell me how to fix it
You can simply change its format from .py to .blend
you can do this with help of notepad.
open .py file in notepad and save as .blend format.
Please specify what the content of the .py file is.
A .py file is a python script, and you can't just "convert" it in a blender file. They are two different things.
It might be the case that the .py file is just a text file (saved as a .py file) that contains the coordinates of a mesh. In this case, just change .py in .obj and import it in blender.
A rookie question here:
I have a PY code and compiled it to create a .pyc. I would want to use this pyc file instead of PY.
I am running the PY file using external program. When the PY exists in the folder everything works perfect. However when I remove the PY file and simply use the pyc I get error:
IOError: [Errno 2] No such file or directory: 'E:/data/test/tech.py'
Whereas I have a tech.pyc lying around in the same folder.Any ideas what could be the issue here?
Normally, python is not compiled. The .pyc files are only a performance optimization that improve loading times.
Python is looking for the .py file because it always checks that first. If a .pyc file is newer than its corresponding .py file, it will then use the .pyc file. If the .py file is newer it will create a new .pyc file.
My question is how decompile .pyc file to python code. In first place I had exe file, i extracted .pyz file from it. From .pyz file i extracted .pyc files with this http://www.pyinstaller.org/browser/project/PyInstaller/cliutils/archive_viewer.py
However when i try to decompile .pyc files I receive erro that magic number is invalid. I looked it up, and its 63 (hex) and 99 in decimal. I guess Pyinstaller makes some changes to pyc files, my question is how to decompile this .pyc file.
I have created some tools which will help in dealing with pyinstaller.
There are many ways you can go.
If you just want to extract the exe to get all the embedded files, including the ones inside the pyz use this script.
Afterwards use Easy Python Decompiler to decompile the pyc files.
If you want to dig deeper and recompile the exe then use Pyinstaller exe rebuilder tool.
I had a python program written which I converted to an exe binary using py2exe. I have all of the files generated in the dist folder but due to a system crash, I lost the source code.
Is there a way to get the .py source code file back from .exe or other supporting files generated by py2exe?
According to the following links, you can extract your .pyc files from library.zip and then use decompyle to obtain .py files similar to what you started with.
http://bytes.com/topic/python/answers/101743-py2exe-there-way-go-backwards-exe2py
http://sourceforge.net/projects/decompyle/
Hope it works, and I hope you use github or bitbucket next time.
I'm using cx_Freeze to freeze my python program. On running cx_Freeze, a bunch of PYD files are created, a whole bunch of PYC files are put into a archive named library.zip and a few DLL files are there too.
Could someone tell me the difference between the PYC and the PYD files?
What's the reason for the PYD files not in the library.zip?
Is it possible to put the PYD files into the archive as well?
Thanks.
Disclaimer: I haven't used cx_Freeze in awhile......
.PYD files are DLL machine-code files that contain specific python-required functions.
.PYC files are .py files that have been compiled into bytecode.
so PYDs are machine code and PYCs are bytecode
Now as for why the PYDs aren't in the .zip....I'd imagine it's because those .PYDs are needed by the python interpreter to run the program. What cx_Freeze does is basically this:
compile all .py files and throw the .pyc files in a zip
put all needed .pyd files in the zip
create a stub .py file and put it in the output directory
copy the python.exe and rename to myprogram.exe
copy all .pyd files needed to open the .zip and run the contents
So you're not actually compiling your python file, you're instead renaming the interpeter and freezing all the source files.
I hope this helps.