0

for the thesis work on forensic analysis I should try to automatically delete a file created and placed in the "system32" folder.

This is the code I ran:

os.system("C://Windows//System32//update.exe")
os.chmod("C://Windows//System32//update.exe", stat.S_IRWXU)
os.remove("C://Windows//System32//update.exe")

The error is as follows:

Traceback (most recent call last): File "C:\Users\xxxx\PycharmProjects\Tesi\main.py", line 5, in <module> os.chmod("C://Windows//System32//update.exe", stat.S_IRWXU) PermissionError: [WinError 5] Accesso negato: 'C://Windows//System32//update.exe'

How can I run it with the right permissions?

Tizzi
  • 1
  • 1

1 Answers1

1

Depends on how you are running the Python interpreter. If you are using Powershell, you can Right-click the Powershell icon and run it as Administrator. After this, any Python script you run from that shell will also run with admin rights.

Leo
  • 1,273
  • 9
  • 14