This has happened several times before. No matter what I put inside of a Python file and use PyInstaller, it will be marked as a virus no matter what place you download it from. I want to be able to have my users download my file, but it will just be marked as a virus. What is going on and is there a way to fix it?
Example
since there are so many malware developers that use python
they make there python scripts a executable so people don't read the code which causes it to get detected
it could also be getting detected because it drops files when you use --onefile
and my advice is you either downgrade pyinstaller or you convert it to c# or you contact anti virus vendors
Related
I need to make a way to install my code, and set default programs depending on file type.
I've been trying to make my python program easy for people who know nothing about python or programming to use.
As an alternative to an exe I want to make a script to do everything, including putting a shortcut to the python code on the desktop and a start menu folder.
The thing is I need to make sure that .py files automatically hey opened by python, and not the software, psychopy, which the user will install.
Is there a way to use python to change the default program for a given file type?
I've already tried:
Py2exe: I get errors (see post history)
Pyinstaller: I get different errors.
The errors with py2exe seem almost irresolvable.
I've used pyinstaller before and it worked. It won't easily work with this code because it doesn't work with an updated library/package I need. I have library b which depends on library a being up to date. So I can't revert back to a setup that I know how to make work.
I have a question for you that is making me crazy.
I am working on my python package. I'm building my package using hatchling and pyproject.toml and I have also three GUI targets.
To make them I'm using the project.gui-scripts section in the project files and indeed, three exe files are included in the scripts directory after the package installation.
All of a sudden two out of three exe files are not starting at all. If you execute it from CMD, you don't get any error message, nothing. I said all of a sudden because in the past they all used to work.
The third one, instead is still working nicely.
Do you know if there is anything I can do to check what's going wrong? Can I debug those exe files?
Thanks in advance,
What happens when you turn a python file into an executable? Does it get encrypted? What happens to the imported files? Can you revert it back into a normal .py file?
So I have this python file, let's call this main.py. I also have another file, let's call it scrambler.py. The scrambler.py is an encryptor/decryptor file. So, I imported it to main.py. Then I will turn it into an executable file. Now, we don't want people to see the enryptor/decryptor file. So, can people who doesn't have the source code get the source code of the imported file? Because, from searching, I saw that some people can get the source code of the main code using pyinstxtractor.py. I haven't tried it yet, but can you also get the source code of the imported file? (also do comments get included? I mean they are useless to the program). So that's why, the ultimate question: What happens when you turn a python file into an executable?
The file that I use to turn a python file into an .exe is Pyinstaller and is it different for every converter?
I hope this is a valid question. Thanks in advance.
Pyinstaller essentially bundles a python interpreter along with your python code in a folder. This folder can be put into an installer (using something like inno setup) to be distributed so end users can use it like a normal exe program. It doesn't compile to another language or anything. So no, your code is not private and while you can make it difficult to find certain bits, it is not impossible.
As described here, it is possible to convert to C and to machine code, but pyinstaller won't do that by default for you. Also note that the python bytecode files, while not legible, are not completely uncrackable.
See: https://pyinstaller.readthedocs.io/en/stable/operating-mode.html
See here for more about the encryption option: PyInstaller Encryption --key
I have converted a python project into an exe file using pyinstaller. The basic functionality in the python project is to read files, parse the file contents, and write them into an excel document. The exe file works perfectly fine in my system as I have generated, but when I distribute this exe file to other systems, McAfee antivirus deletes the exe file by displaying the message as "Access denied".
How to handle this situation? I have tried both the commands for pyinstaller and also the auto-py-to-exe tool. But nothing works.
I have also informed the IT team, but they say, there is a potential threat in the exe file.
In issues on GitHub mentioning 'virus' in the PyInstaller repo htgoebel repeatedly states:
Please contact you anti-virus vendor. There is nothing we can do about this false positive.
If your anti-virus vendor considers one of the files included in the PyInstaller distribution or a file generated by PyInstaller to be malicious, there is nothing we can do about this. Even if we'd change our code, they'd change their pattern and the race starts again.
See this mailing-list thread and other tickets for his topic.
So when asking "How to handle this situation?", there isn't much you can do. Like htgoebel said, you can't control what anti-virus vendors match and changing what/how PyInstaller outputs will just be matched to be flagged again later.
You possibly could change to a different anti-virus vendor but that may be out of your control and you'll still have the issue when the package is distributed.
PyInstaller does seem to be the most popular choice for converting a python script into an exe, but there are other choices:
How do I convert a Python program to a runnable .exe Windows program?
When I wasn't able to get around this problem in PyInstaller, I looked for a different tool. I chose cx-freeze over py2exe simply because it had more recent commits on github. It worked great:
python -m pip install cx_Freeze
python -m cx_Freeze test.py
cd build\exe.win-amd64-3.10
test.exe
Output:
Hello world
In case the PyInstaller devs care, my anti virus is CrowdStrike Falcon.
Hi i want to build an install creator for my programs in Python.
I have made code for the information gathering, PATHS, FILES, PICS etc.
Now i need to:
Compress the files for the program.
make a config file with install paths ect.
make code for the INSTALLER (i have that to)
Finally i need to "pack" it all in an .exe file that will run the first window in my INSTALLER CODE, so that it will work as my own custom made installer.
Does anybody have any idea how to go about this EASY??
My biggest problem is to collect it all in ONE .exe file that will run my windows(TK code) and of course install my program when clicked...
I have a few ideas how to go about it, BUT in my head these ideas seem to be BIG and NOT EASY, so need ideas for easier solutions.
Update. If i have a program build in python(Tkinter) that will gather the information and save this info as a config file. Then i can build a program that can read this information and extract files ect. accordingly to the info. But how will i combine these configfiles/programs in ONE .exe file that when clicked will run MY program and then accordingly extract my files to the paths in config file. And last use my own icon for the single .exe
If you want to have everything in one exe file, its code needs to be aware of it's content and extract them. This is a problem that has been solved by various tools, eg. see this SO question and its answers.