-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Asserts to LocalGroupProcessorTest.cs and added error testing f…
…or CertAbuseProcessorTest.cs and UserRightsAssignmentProcessorTest.cs
- Loading branch information
Showing
5 changed files
with
165 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
test/unit/Facades/LSAMocks/ErrorCaseMocks/MockFailLSAPolicy_GetLocalDomainInformation.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Security.Principal; | ||
using SharpHoundRPC; | ||
using SharpHoundRPC.Shared; | ||
using SharpHoundRPC.Wrappers; | ||
|
||
namespace CommonLibTest.Facades.LSAMocks.WorkstationMocks | ||
{ | ||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] | ||
public class MockFailLSAPolicy_GetLocalDomainInformation : ILSAPolicy | ||
{ | ||
public Result<(string Name, string Sid)> GetLocalDomainInformation() | ||
{ | ||
return NtStatus.StatusAccessDenied; | ||
} | ||
|
||
public Result<IEnumerable<SecurityIdentifier>> GetPrincipalsWithPrivilege(string userRight) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Result<IEnumerable<(SecurityIdentifier sid, string Name, SharedEnums.SidNameUse Use, string Domain)>> | ||
GetResolvedPrincipalsWithPrivilege(string userRight) | ||
{ | ||
return new List<(SecurityIdentifier sid, string Name, SharedEnums.SidNameUse Use, string Domain)> | ||
{ | ||
(new SecurityIdentifier("S-1-5-32-555"), "Remote Desktop Users", SharedEnums.SidNameUse.Alias, "abc"), | ||
(new SecurityIdentifier("S-1-5-32-544"), "Administrators", SharedEnums.SidNameUse.Alias, "abc"), | ||
(new SecurityIdentifier($"{Consts.MockWorkstationMachineSid}-1000"), "John", SharedEnums.SidNameUse.User, "abc"), | ||
(new SecurityIdentifier($"{Consts.MockWorkstationMachineSid}-1001"), "TestGroup", SharedEnums.SidNameUse.Alias, "abc"), | ||
}; | ||
} | ||
|
||
public Result<(string Name, SharedEnums.SidNameUse Use, string Domains)> LookupSid(SecurityIdentifier sid) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Result<IEnumerable<(SecurityIdentifier Sid, string Name, SharedEnums.SidNameUse Use, string Domain)>> | ||
LookupSids(SecurityIdentifier[] sids) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...t/Facades/LSAMocks/ErrorCaseMocks/MockFailLSAPolicy_GetResolvedPrincipalsWithPrivilege.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Security.Principal; | ||
using SharpHoundRPC; | ||
using SharpHoundRPC.Shared; | ||
using SharpHoundRPC.Wrappers; | ||
|
||
namespace CommonLibTest.Facades.LSAMocks.WorkstationMocks | ||
{ | ||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] | ||
public class MockFailLSAPolicy_GetResolvedPrincipalsWithPrivilege : ILSAPolicy | ||
{ | ||
public Result<(string Name, string Sid)> GetLocalDomainInformation() | ||
{ | ||
return ("WIN10", Consts.MockWorkstationMachineSid); | ||
} | ||
|
||
public Result<IEnumerable<SecurityIdentifier>> GetPrincipalsWithPrivilege(string userRight) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Result<IEnumerable<(SecurityIdentifier sid, string Name, SharedEnums.SidNameUse Use, string Domain)>> | ||
GetResolvedPrincipalsWithPrivilege(string userRight) | ||
{ | ||
return NtStatus.StatusAccessDenied; | ||
} | ||
|
||
public Result<(string Name, SharedEnums.SidNameUse Use, string Domains)> LookupSid(SecurityIdentifier sid) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public Result<IEnumerable<(SecurityIdentifier Sid, string Name, SharedEnums.SidNameUse Use, string Domain)>> | ||
LookupSids(SecurityIdentifier[] sids) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters