Disguise the compressed file as a picture format file and convert the python file into an exe file (after testing, it is really effective)...

Hello, friends, I haven't updated my blog for another week, and today I bring something different to share


1. Convert files of other formats into files of other styles for camouflage,

  In a certain scene, we need to disguise, for example, a certain compressed file as a photo, all we need to do is to make it into a picture style for camouflage

  What needs to be prepared is a picture and a compressed file

 

The next step is to pack it and disguise it. The specific command is. In the directory path, enter the command copy /b a.jpg b.zip my.jpg (to convert other format files, just modify its name and suffix name ) and then return car, you will find that a my.jpg file has been generated. Click to open the file and you will find that the appearance is the same as a.jpg. If you don’t know how to use the cmd command line, it is no problem. You can save the above command in a new txt In the document (the name can be defined by yourself, such as xxx.txt), put it in the same directory as the compressed package and the picture, modify its suffix to xxx.bat, confirm to save, double-click the bat file, and the effect of executing the command is the same. If you choose to open it with WinRaR, you will find that it is the original file. That is, the application of Qt

2. Package the python file into an exe executable file

  The necessary scenario is that a python execution script on our side asks for a file and needs to be run on other people's machines, but in fact the environment on the other machine may be different from ours, and if the installation environment is troublesome, this We need to give the other party an exe file, so that we can complete the task very conveniently, 

  The specific method is as follows: 1. First, you need to write a python script, that is, you need to prepare a .py file. 2. The next thing to do is to install pyinstaller in the interpreter, that is, command  pip install pyinstaller 

3. The next thing to do is to place the written python file in a directory, then put an ico file in the same directory as the icon of the exe file, and finally execute pyinstaller -i xxx.ico in the cmd  terminal F xxx.py --noconsole ( the xxx in front refers to the file name of the ico icon, the function of --noconsole is to remove the black frame that appears when opening the exe file ) you will find that there are a few more files in the file directory to be placed folder.

 

The executable file xxx.exe is in the dist folder. Run the exe file directly and it will take effect. At this point, the python script becomes an exe file. 4. Package it and send it to the other party for execution. If you need to rely on For external files, put them in the same directory and package them and send them over.

Guess you like

Origin blog.csdn.net/bruce_van/article/details/100070268