[Python] How to prevent an exe file created with “Pyinstaller” from being falsely detected as a virus.

Python

Hello, this is HAL-JP.
By the way, do you guys use Pyinstaller to exe Python files? That is very useful, isn’t it? However, if you use Pyinstaller to convert a file to exe, the file will be falsely detected as a virus. So, this time, I will show you how to prevent false detection as a virus for an exe file created with “Pyinstaller”.

Comparison between normal execution and execution with improvement procedures

We compared which security software detects the exe file as a virus when it is run normally and when it is run with the improved procedure.

Executed normally

If performed with the improvement procedure

AVG, Avast, and Microsoft security software prevented false positives!

False positive prevention procedure

Now let’s get started on preventing false positives!

  • STEP.2
    Start Windows PowerShell

    Right click on the Windows symbol and click on Windows PowerShell (Administrator)

  • STEP.3
    Execute the command on the official Chocolatery website

    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString(‘https://community.chocolatey.org/install.ps1’))
  • STEP.4
    Execute command

    Execute the following command, and if version information appears afterward, the installation was successful.

    choco
  • STEP.5
    Execute the following command
    choco install -y python vcbuildtools
    
  • STEP.6
    Execute the following command at the command pronto
    git clone https://github.com/pyinstaller/pyinstaller
  • STEP.7
    Execute the following command
    cd pyinstaller/bootloader
  • STEP.8
    Execute the following command
    python ./waf all

    *The above command was corrected on 2023/2/16.

  • STEP.9
    Execute the following command
    (cd pyinstaller if you closed the command pronto)
    cd ../

    *The above command was modified on 12/17/2022.

  • STEP.10
    Execute the following command
    python setup.py install
    
  • STEP.11
    Run Pyinstaller

    Then run Pyinstaller as usual.

    pyinstaller filename.py

This is how to prevent exe files created with “Pyinstaller” from being falsely detected as viruses. But the following security software still recognizes it as a virus. Ad-Aware,ALYac,SecureAge APEX,Arcabit,BitDefender,Cynet,Emsisoft,eScan,FireEye,GData,MAX

The reason is that “Pyinstaller” is often used to create virus software, which makes it easy to detect. You can try it if you like.

If you are not sure how to do this properly, please feel free to contact us.
Contact Us

Comment

タイトルとURLをコピーしました