| | 1 | | using SharpHoundCommonLib.Enums; |
| | 2 | |
|
| | 3 | | namespace SharpHoundCommonLib.OutputTypes { |
| | 4 | | public class ACE { |
| 54 | 5 | | public string PrincipalSID { get; set; } |
| 52 | 6 | | public Label PrincipalType { get; set; } |
| 61 | 7 | | public string RightName { get; set; } |
| 52 | 8 | | public bool IsInherited { get; set; } |
| 34 | 9 | | public string InheritanceHash { get; set; } |
| | 10 | |
|
| 1 | 11 | | public override string ToString() { |
| 1 | 12 | | return $"{PrincipalType} {PrincipalSID} - {RightName} {(IsInherited ? "" : "Not")} Inherited"; |
| 1 | 13 | | } |
| | 14 | |
|
| 0 | 15 | | protected bool Equals(ACE other) { |
| 0 | 16 | | return PrincipalSID == other.PrincipalSID && PrincipalType == other.PrincipalType && |
| 0 | 17 | | RightName == other.RightName && IsInherited == other.IsInherited; |
| 0 | 18 | | } |
| | 19 | |
|
| 0 | 20 | | public override bool Equals(object obj) { |
| 0 | 21 | | if (ReferenceEquals(null, obj)) return false; |
| 0 | 22 | | if (ReferenceEquals(this, obj)) return true; |
| 0 | 23 | | if (obj.GetType() != GetType()) return false; |
| 0 | 24 | | return Equals((ACE)obj); |
| 0 | 25 | | } |
| | 26 | |
|
| 0 | 27 | | public override int GetHashCode() { |
| 0 | 28 | | unchecked { |
| 0 | 29 | | var hashCode = PrincipalSID != null ? PrincipalSID.GetHashCode() : 0; |
| 0 | 30 | | hashCode = (hashCode * 397) ^ (int)PrincipalType; |
| 0 | 31 | | hashCode = (hashCode * 397) ^ (RightName != null ? RightName.GetHashCode() : 0); |
| 0 | 32 | | hashCode = (hashCode * 397) ^ IsInherited.GetHashCode(); |
| 0 | 33 | | return hashCode; |
| | 34 | | } |
| 0 | 35 | | } |
| | 36 | | } |
| | 37 | | } |