Skip to content

Commit

Permalink
feat: initial NTLM commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rvazarkar committed Dec 9, 2024
1 parent c953260 commit 076f41d
Show file tree
Hide file tree
Showing 32 changed files with 3,941 additions and 100 deletions.
12 changes: 8 additions & 4 deletions src/CommonLib/Enums/CollectionMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ public enum CollectionMethod
CARegistry = 1 << 16,
DCRegistry = 1 << 17,
CertServices = 1 << 18,
LdapServices = 1 << 19,
WebClientService = 1 << 21,
SmbInfo = 1 << 22,
EventLogs = 1 << 23,
LocalGroups = DCOM | RDP | LocalAdmin | PSRemote,
ComputerOnly = LocalGroups | Session | UserRights | CARegistry | DCRegistry,
DCOnly = ACL | Container | Group | ObjectProps | Trusts | GPOLocalGroup | CertServices,
Default = Group | Session | Trusts | ACL | ObjectProps | LocalGroups | SPNTargets | Container | CertServices,
All = Default | LoggedOn | GPOLocalGroup | UserRights | CARegistry | DCRegistry
ComputerOnly = LocalGroups | Session | UserRights | CARegistry | DCRegistry | WebClientService | SmbInfo | EventLogs,
DCOnly = ACL | Container | Group | ObjectProps | Trusts | GPOLocalGroup | CertServices | LdapServices | SmbInfo,
Default = Group | Session | Trusts | ACL | ObjectProps | LocalGroups | SPNTargets | Container | CertServices | LdapServices | SmbInfo,
All = Default | LoggedOn | GPOLocalGroup | UserRights | CARegistry | DCRegistry | WebClientService | LdapServices | EventLogs
}
}
4 changes: 3 additions & 1 deletion src/CommonLib/Enums/LdapErrorCodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
public enum LdapErrorCodes : int
{
Success = 0,
StrongAuthRequired = 8,
SaslBindInProgress = 14,
InvalidCredentials = 49,
Busy = 51,
ServerDown = 81,
LocalError = 82,
KerberosAuthType = 83
KerberosAuthType = 83,
}
}
14 changes: 14 additions & 0 deletions src/CommonLib/Enums/LdapOption.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace SharpHoundCommonLib.Enums
{
public enum LdapOption : int
{
Ssl = 0x0A,
ProtocolVersion = 0x11,
ResultCode = 0x31,
ServerError = 0x33,
ServerCertificate = 0x81,
Sign = 0x95,
Encrypt = 0x96,
Timeout = 0x5002,
}
}
15 changes: 15 additions & 0 deletions src/CommonLib/Enums/LdapOptionValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharpHoundCommonLib.Enums
{
public enum LdapOptionValue : int
{
Off = 0,
On = 1,
Version3 = 3,
};
}
16 changes: 16 additions & 0 deletions src/CommonLib/Enums/LdapSupportedSaslMechansims.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharpHoundCommonLib.Enums
{
public static class LdapSupportedSaslMechansims
{
public const string GSSAPI = "GSSAPI";
public const string GSS_SPNEGO = "GSS-SPNEGO";
public const string EXTERNAL = "EXTERNAL";
public const string DIGEST_MD5 = "DIGEST_MD5";
}
}
2 changes: 1 addition & 1 deletion src/CommonLib/LdapConnectionPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace SharpHoundCommonLib {
internal class LdapConnectionPool : IDisposable{
private readonly ConcurrentBag<LdapConnectionWrapper> _connections;
private readonly ConcurrentBag<LdapConnectionWrapper> _globalCatalogConnection;
private readonly SemaphoreSlim _semaphore;
private readonly SemaphoreSlim _semaphore = null;
private readonly string _identifier;
private readonly string _poolIdentifier;
private readonly LdapConfig _ldapConfig;
Expand Down
4 changes: 2 additions & 2 deletions src/CommonLib/LdapProducerQueryGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static GeneratedLdapParameters GenerateDefaultPartitionParameters(Collect
if (methods.HasFlag(CollectionMethod.SPNTargets))
properties.AddRange(CommonProperties.SPNTargetProps);

if (methods.HasFlag(CollectionMethod.DCRegistry))
if (methods.HasFlag(CollectionMethod.DCRegistry) || methods.HasFlag(CollectionMethod.LdapServices))
properties.AddRange(CommonProperties.ComputerMethodProps);

if (methods.HasFlag(CollectionMethod.SPNTargets)) {
Expand Down Expand Up @@ -79,7 +79,7 @@ public static GeneratedLdapParameters GenerateDefaultPartitionParameters(Collect
properties.AddRange(CommonProperties.GPOLocalGroupProps);
}

if (methods.HasFlag(CollectionMethod.DCRegistry)) {
if (methods.HasFlag(CollectionMethod.DCRegistry) || methods.HasFlag(CollectionMethod.LdapServices)) {
filter = filter.AddComputers(CommonFilters.DomainControllers);
properties.AddRange(CommonProperties.ComputerMethodProps);
}
Expand Down
Loading

0 comments on commit 076f41d

Please sign in to comment.