/// <summary> /// Constructor. /// </summary> public NewNtTokenCmdlet() { AuthenticationId = NtToken.LocalSystemAuthId; TokenType = TokenType.Primary; ExpirationTime = DateTime.Now.AddYears(10); Groups = new Sid[0]; Privileges = new TokenPrivilegeValue[0]; DefaultAcl = new Acl(); DefaultAcl.AddAccessAllowedAce(GenericAccessRights.GenericAll, AceFlags.None, "SY"); DefaultAcl.AddAccessAllowedAce(GenericAccessRights.GenericAll, AceFlags.None, "BA"); IntegrityLevel = TokenIntegrityLevel.System; SecurityQualityOfService = new SecurityQualityOfService(SecurityImpersonationLevel.Anonymous, SecurityContextTrackingMode.Static, false); }
public void AddPrivilege(TokenPrivilegeValue name, PrivilegeAttributes attributes) { Luid luid = new Luid((uint)name, 0); AddPrivilege(luid, attributes); }
/// <summary> /// Get SIDs associated with an account right. /// </summary> /// <param name="privilege">The account right privilege to query.</param> /// <returns>The list of SIDs assigned to the account right.</returns> public static IEnumerable <Sid> GetAccountRightSids(TokenPrivilegeValue privilege) { return(GetAccountRightSids(privilege, true).Result); }
/// <summary> /// Get SIDs associated with an account right. /// </summary> /// <param name="privilege">The account right privilege to query.</param> /// <param name="throw_on_error">True to throw on error.</param> /// <returns>The list of SIDs assigned to the account right.</returns> public static NtResult <IEnumerable <Sid> > GetAccountRightSids(TokenPrivilegeValue privilege, bool throw_on_error) { return(GetAccountRightSids(privilege.ToString(), throw_on_error)); }
/// <summary> /// Constructor /// </summary> /// <param name="value">The privilege value</param> /// <param name="attribute">The privilege attributes</param> public TokenPrivilege(TokenPrivilegeValue value, PrivilegeAttributes attribute) : this(new Luid((uint)value, 0), attribute) { }
private static extern NtStatus RtlAdjustPrivilege(TokenPrivilegeValue Privilege, bool bEnablePrivilege, bool IsThreadPrivilege, out bool PreviousValue);