Skip to content

Commit

Permalink
Merge pull request #1 from eversinc33/dev
Browse files Browse the repository at this point in the history
fix options parsing
  • Loading branch information
LuemmelSec authored Feb 15, 2023
2 parents a357407 + ff03198 commit 02efb58
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/BaseContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ public string ResolveFileName(string filename, string extension, bool addTimesta
}

public string[] Domains { get; set; }
public string LocalAdminUsername { get; internal set; }
public string LocalAdminPassword { get; internal set; }
public bool LocalAdminSessionEnum { get; internal set; }
public string LocalAdminUsername { get; set; }
public string LocalAdminPassword { get; set; }
public bool LocalAdminSessionEnum { get; set; }

// // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
// ~Context()
Expand Down
4 changes: 4 additions & 0 deletions src/Client/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public interface IContext
int Jitter { get; set; }
int PortScanTimeout { get; set; }

public string LocalAdminUsername { get; set; }

public string LocalAdminPassword { get; set; }

ResolvedCollectionMethod ResolvedCollectionMethods { get; set; }

/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions src/Client/Flags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public class Flags
public bool DCOnly { get; set; }
public bool PrettyPrint { get; set; }
public bool SearchForest { get; set; }
public bool LocalAdminSessionEnum { get; set; }

public bool DoLocalAdminSessionEnum { get; set; }
}
}
7 changes: 5 additions & 2 deletions src/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ public class Options
[Option(HelpText = "Password for LDAP", Default = null)]
public string LDAPPassword { get; set; }

[Option(HelpText = "Username for local Administrator", Default = null)]
[Option(HelpText = "Do the session enumeration with local admin credentials instead of domain credentials", Default = false)]
public bool DoLocalAdminSessionEnum { get; set; }

[Option(HelpText = "Username for local Administrator to be used if DoLocalAdminSessionEnum is set", Default = null)]
public string LocalAdminUsername { get; set; }

[Option(HelpText = "Password for local Administrator", Default = null)]
[Option(HelpText = "Password for local Administrator to be used if DoLocalAdminSessionEnum is set", Default = null)]
public string LocalAdminPassword { get; set; }

[Option(HelpText = "Override domain controller to pull LDAP from. This option can result in data loss", Default = null)]
Expand Down
2 changes: 1 addition & 1 deletion src/Runtime/ObjectProcessors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public ObjectProcessors(IContext context, ILogger log)
_ldapPropertyProcessor = new LDAPPropertyProcessor(context.LDAPUtils);
_domainTrustProcessor = new DomainTrustProcessor(context.LDAPUtils);
_computerAvailability = new ComputerAvailability(context.PortScanTimeout, skipPortScan: context.Flags.SkipPortScan, skipPasswordCheck: context.Flags.SkipPasswordAgeCheck);
_computerSessionProcessor = new ComputerSessionProcessor(context.LDAPUtils, LocalAdminSessionEnum: context.Flags.LocalAdminSessionEnum);
_computerSessionProcessor = new ComputerSessionProcessor(context.LDAPUtils, doLocalAdminSessionEnum: context.Flags.DoLocalAdminSessionEnum, localAdminUsername: context.LocalAdminUsername, localAdminPassword: context.LocalAdminPassword);
_groupProcessor = new GroupProcessor(context.LDAPUtils);
_containerProcessor = new ContainerProcessor(context.LDAPUtils);
_gpoLocalGroupProcessor = new GPOLocalGroupProcessor(context.LDAPUtils);
Expand Down
7 changes: 2 additions & 5 deletions src/Sharphound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,7 @@ await options.WithParsedAsync(async options =>
DCOnly = dconly,
PrettyPrint = options.PrettyPrint,
SearchForest = options.SearchForest,
LocalAdminSessionEnum = options.LocalAdminSessionEnum,
LocalAdminUsername = options.LocalAdminUsername,
LocalAdminPassword = options.LocalAdminPassword
DoLocalAdminSessionEnum = options.DoLocalAdminSessionEnum,
};
var ldapOptions = new LDAPConfig
Expand All @@ -401,7 +399,7 @@ await options.WithParsedAsync(async options =>
}
IContext context = new BaseContext(logger, ldapOptions, flags)
IContext context = new BaseContext(logger, ldapOptions, flags)
{
DomainName = options.Domain,
CacheFileName = options.CacheName,
Expand All @@ -422,7 +420,6 @@ await options.WithParsedAsync(async options =>
LoopInterval = options.LoopInterval,
ZipPassword = options.ZipPassword,
IsFaulted = false,
LocalAdminSessionEnum = options.LocalAdminSessionEnum,
LocalAdminUsername = options.LocalAdminUsername,
LocalAdminPassword = options.LocalAdminPassword
Expand Down

0 comments on commit 02efb58

Please sign in to comment.