The process of enabling new privileges is simple. We will discuss briefly the concepts and the code necessary to enable privileges, but for an in-depth discussion of privileges, refer to the Microsoft Windows NT Security documentation.
You use the
module to gain access to the necessary functions. The process for enabling a
Obtain the current access token using the
Obtain the ID for the privilege using
Enable the privilege using
When you’ve performed the operation, you need to disable the
privilege again. The same process is used:
win32security.AdjustTokenPrivileges() supports a
flag that allows you to enable or disable the privilege. An example
of this code is presented in the next section.