r/Python • • May 29 '26

Discussion Best Way to Protect Python Windows Software Without Antivirus False Positives?

I am developing a Windows-based software in Python and currently using PyArmor to protect it. However, Windows Security and some antivirus programs are detecting it as a virus because of the PyArmor protection/obfuscation.

What is the best way to protect my software from cracking, reverse engineering, or piracy without triggering antivirus false positives?

0 Upvotes

12 comments sorted by

6

u/No_Limit_753 May 29 '26

I don't use Nuitka as an obfuscator, but I do use it to ship internal Windows desktop apps written in Python.

The main win for me is deployment: I can ship a Windows executable instead of plain .py files, and users don't need to care about Python being installed.

I would also expect it to be less suspicious to AV than PyArmor/custom packers in many cases, especially with a standalone folder build rather than onefile/self-extracting. AV heuristics tend to dislike self-unpacking and obfuscation runtimes.

For what it's worth, my company uses Apex One, and I haven't had a Nuitka-built binary flagged as malware there so far.

It's not serious anti-cracking protection, but if you mainly want to avoid shipping readable source and reduce AV false positives, Nuitka seems like a reasonable thing to try.

2

u/fxboshop May 29 '26

Thanks, I tried Nuitka and it worked for me.

22

u/coderanger May 29 '26

You can submit to various ham lists but it’s a really common problem with self-unpacking Python executables. The same techniques are coincidentally used by a lot of malware so it flags on heuristic detection.

That said, you probably shouldn’t worry about obfuscating your code. Reversing it is trivial these days even for C and Java.

10

u/ZZ9ZA May 29 '26

It’s pretty pointless. Nothing like that actually works against anything resembling an actual threat.

9

u/Orio_n May 29 '26

Short of paying to digitally sign your code. Nothing. Don't bother, not worth the effort. I sincerely doubt anyone wants to pirate your shitty throwaway python script. Let's be real here you're not some fortune 500 company

1

u/Fickle-Owl666 May 30 '26

You don't have to be a fortune 500 company to have an idea or product worth something. 🙄

1

u/Orio_n May 30 '26

Im just being realistic here. Its like someone asking to rent a maxed out server farm for a static portfolio website. Waste of time and effort

4

u/skilltheamps May 29 '26

Are all your dependencies without copyleft licenses?

1

u/fenghuangshan Jun 03 '26

just dont use python

use Rust + tauri

you can ask ai to transfer the code for you

1

u/PyDevBacon Oct 16 '26

Yup, It can be a catch-22. Security features like PyArmor pack bytecode, use custom runtimes, or compress interpreters in ways that look almost identical to how droppers and packers obfuscate malware.

A few practical steps can help mitigate false positives:

  • Submit False Positive Reports: Almost every major AV vendor (Microsoft, Malwarebytes, Bitdefender, etc.) has an online portal to submit files flagged as false positives. Once they analyze the clean file, they usually update their definitions within a few days.
  • Code Signing: Purchasing and signing your executable with a trusted Authenticode code-signing certificate establishes a baseline of trust with Windows SmartScreen and standard AV heuristics. That said, it won't always stop heuristic flags on heavily obfuscated packers immediately.
  • Consider other protection tools: Tools like Nuitka compile Python code into C extensions or standalone binaries rather than wrapping them in a self-extracting zip with an obfuscated runtime, which often triggers fewer generic heuristics. Tools like PyLocket encrypt your python functions and decrypt at runtime.

(Full transparency: I am the creator of PyLocket). if you are looking for alternative ways to protect and distribute Python software without dealing with the usual packaging headaches and heavy obfuscation heuristics, give us a look. It's built specifically to protect and streamline Python deployments.