示例#1
0
        private void ShowGroups(AccessTokenHandle hToken)
        {
            var groups = AccessTokenGroups.FromTokenHandle(hToken);

            console.WriteLine("[GROUPS]");
            console.WriteLine("");
            console.WriteLine(groups.ToOutputString());
            console.WriteLine("");
        }
示例#2
0
 public AccessTokenInformation(AccessTokenHandle handle)
 {
     try
     {
         this._groups = AccessTokenGroups.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._logonSid = AccessTokenLogonSid.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._owner = AccessTokenOwner.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._primaryGroup = AccessTokenPrimaryGroup.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._primaryGroup = AccessTokenPrimaryGroup.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._privileges = AccessTokenPrivileges.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._sessionId = AccessTokenSessionId.FromTokenHandle(handle);
     }
     catch { }
     try
     {
         this._user = AccessTokenUser.FromTokenHandle(handle);
     }
     catch { }
 }
示例#3
0
文件: PS.cs 项目: radtek/TokenManage
        private static string GetAccessTokenInfo(AccessTokenHandle hToken)
        {
            StringBuilder info       = new StringBuilder();
            var           user       = AccessTokenUser.FromTokenHandle(hToken);
            var           groups     = AccessTokenGroups.FromTokenHandle(hToken);
            var           privileges = AccessTokenPrivileges.FromTokenHandle(hToken);

            info.Append("[USERNAME]\n");
            info.Append("\n");
            info.Append($"{user.Domain}\\{user.Username}\n");
            info.Append("\n");
            info.Append("[GROUPS]");
            info.Append("\n");
            foreach (var group in groups.GetGroupEnumerator())
            {
                info.Append($"{group.Domain}\\{group.Name}\n");
            }
            info.Append("\n");
            info.Append("[PRIVILEGES]");
            info.Append("\n");
            info.Append(privileges.ToOutputString());
            info.Append("\n");
            return(info.ToString());
        }