Persistence
In this section, we will learn how to run our Python script when starting up Windows. Let's create a new project. You can also modify the victim program that we developed earlier in Chapter 6, Malware Development, and Chapter 7, Advanced Malware. To add persistence to our program, we need to know exactly the name of the executable we are running. Once we know the executable, we can make a copy of this executable somewhere else and run it from there every time the system boots. This sounds complicated, so let's take a look at it bit by bit. First, we will need to know the name of the executable. To find this out, let's write the following code:
import sys curr_executable = sys.executable print("Current executable : ", curr_executable)
The output of the aforementioned program if you run it as a Python script would be as follows:
This only tells us the name of the Python interpreter...