-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3' into additionalOUACLs
- Loading branch information
Showing
19 changed files
with
712 additions
and
266 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
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,20 @@ | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.DirectoryServices.Protocols; | ||
|
||
namespace SharpHoundCommonLib | ||
{ | ||
public class DomainInfo | ||
{ | ||
public string DomainSID { get; set; } | ||
public string DomainFQDN { get; set; } | ||
public string DomainSearchBase { get; set; } | ||
public string DomainConfigurationPath { get; set; } | ||
public string DomainNetbiosName { get; set; } | ||
|
||
public override string ToString() | ||
{ | ||
return $"{nameof(DomainSID)}: {DomainSID}, {nameof(DomainFQDN)}: {DomainFQDN}, {nameof(DomainSearchBase)}: {DomainSearchBase}, {nameof(DomainConfigurationPath)}: {DomainConfigurationPath}, {nameof(DomainNetbiosName)}: {DomainNetbiosName}"; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.DirectoryServices.Protocols; | ||
|
||
namespace SharpHoundCommonLib.Exceptions | ||
{ | ||
public class LdapAuthenticationException : Exception | ||
{ | ||
public LdapAuthenticationException(LdapException exception) : base("Error authenticating to LDAP", exception) | ||
{ | ||
} | ||
} | ||
} |
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,14 @@ | ||
using System; | ||
using System.DirectoryServices.Protocols; | ||
|
||
namespace SharpHoundCommonLib.Exceptions | ||
{ | ||
public class LdapConnectionException : Exception | ||
{ | ||
public int ErrorCode { get; } | ||
public LdapConnectionException(LdapException innerException) : base("Failed during ldap connection tests", innerException) | ||
{ | ||
ErrorCode = innerException.ErrorCode; | ||
} | ||
} | ||
} |
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,13 @@ | ||
using System; | ||
|
||
namespace SharpHoundCommonLib.Exceptions | ||
{ | ||
public class NoLdapDataException : Exception | ||
{ | ||
public int ErrorCode { get; set; } | ||
public NoLdapDataException(int errorCode) | ||
{ | ||
ErrorCode = errorCode; | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace SharpHoundCommonLib | ||
{ | ||
public class LDAPConnectionCacheKey | ||
{ | ||
public bool GlobalCatalog { get; } | ||
public string Domain { get; } | ||
public string Server { get; set; } | ||
|
||
public LDAPConnectionCacheKey(string domain, bool globalCatalog) | ||
{ | ||
GlobalCatalog = globalCatalog; | ||
Domain = domain; | ||
} | ||
|
||
protected bool Equals(LDAPConnectionCacheKey other) | ||
{ | ||
return GlobalCatalog == other.GlobalCatalog && Domain == other.Domain; | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (ReferenceEquals(null, obj)) return false; | ||
if (ReferenceEquals(this, obj)) return true; | ||
if (obj.GetType() != this.GetType()) return false; | ||
return Equals((LDAPConnectionCacheKey)obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return (GlobalCatalog.GetHashCode() * 397) ^ (Domain != null ? Domain.GetHashCode() : 0); | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.