Python for antivirus-free persistence shells

As we know, one of the finest techniques to evade antivirus software is to write custom exploits. If the exploit is written from scratch, there is very little chance for the antivirus engine to match the code signature against the known malicious signatures. In this section, we will write a custom shell that returns a reverse shell from the victim's machine and see how many AV engines can detect it.

Let's write a custom exploit, name it my_car.py, and place the following code in it:

If we observe the preceding code, we can see that it is an adaption of a Python code to spawn a reverse shell to an ...

Get Hands-On Penetration Testing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.