Exemple #1
0
        public static void SetProcessPrivilege(string privilege, bool enabled)
        {
            var hProc  = TMProcessHandle.GetCurrentProcessHandle();
            var hToken = AccessTokenHandle.FromProcessHandle(hProc, TokenAccess.TOKEN_ADJUST_PRIVILEGES);

            SetPrivilege(hToken, privilege, enabled);
        }
Exemple #2
0
        public static void EnableAllProcessPrivileges()
        {
            var hProc  = TMProcessHandle.GetCurrentProcessHandle();
            var hToken = AccessTokenHandle.FromProcessHandle(hProc);

            SetAllPrivileges(hToken, true);
        }
Exemple #3
0
        /// <summary>
        /// Return access token information regarding current process.
        /// </summary>
        /// <returns></returns>
        public static String WhoisProcess()
        {
            var hProc  = TMProcessHandle.GetCurrentProcessHandle();
            var hToken = AccessTokenHandle.FromProcessHandle(hProc);

            return(new AccessTokenInformation(hToken).ToOutputString());
        }
Exemple #4
0
        public void Execute()
        {
            TMProcessHandle hProcess;

            if (this.options.ProcessID.HasValue)
            {
                hProcess = TMProcessHandle.FromProcessId(this.options.ProcessID.Value, TokenManage.API.ProcessAccessFlags.QueryInformation);
            }
            else
            {
                hProcess = TMProcessHandle.GetCurrentProcessHandle();
            }

            var hToken = AccessTokenHandle.FromProcessHandle(hProcess, TokenAccess.TOKEN_QUERY);

            if (this.options.ShowUser || this.options.ShowAll)
            {
                ShowUser(hToken);
            }
            if (this.options.ShowGroups || this.options.ShowAll)
            {
                ShowGroups(hToken);
            }

            if (this.options.ShowPrivileges || this.options.ShowAll)
            {
                ShowPrivileges(hToken);
            }

            if (this.options.ShowLogonSid || this.options.ShowAll)
            {
                ShowLogonSid(hToken);
            }

            if (this.options.ShowOwner || this.options.ShowAll)
            {
                ShowOwner(hToken);
            }

            if (this.options.ShowPrimaryGroup || this.options.ShowAll)
            {
                ShowPrimaryGroup(hToken);
            }

            if (this.options.ShowSessionID || this.options.ShowAll)
            {
                ShowSessionID(hToken);
            }
        }