Skip to content

Commit 58ca58d

Browse files
committed
Add case insensitivity to long form arguments
1 parent 000d5ca commit 58ca58d

2 files changed

Lines changed: 24 additions & 14 deletions

File tree

TheSprayer/CommandLineOptions.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,46 @@ namespace TheSprayer
44
{
55
public class CommandLineOptions
66
{
7-
[Option('d', "Domain", Required = false, HelpText = "The Active Directory domain (e.g. windomain.local)")]
7+
[Option('d', "domain", Required = false, HelpText = "The Active Directory domain (e.g. windomain.local)")]
88
public string Domain { get; set; }
99

10-
[Option('s', "Server", Required = false, HelpText = "The IP or hostname of a domain controller")]
10+
[Option('s', "server", Required = false, HelpText = "The IP or hostname of a domain controller")]
1111
public string DomainController { get; set; }
1212

13-
[Option('U', "Username", Required = false, HelpText = "Username for domain user to enumerate policies")]
13+
[Option('U', "username", Required = false, HelpText = "Username for domain user to enumerate policies")]
1414
public string Username { get; set; }
1515

16-
[Option('P', "Password", Required = false, HelpText = "Password for domain user to enumerate policies")]
16+
[Option('P', "password", Required = false, HelpText = "Password for domain user to enumerate policies")]
1717
public string Password { get; set; }
1818

19-
[Option('u', "UserList", Required = false, HelpText = "A file containing a line delimited list of usernames or a single user to try")]
19+
[Option('u', "userList", Required = false, HelpText = "A file containing a line delimited list of usernames or a single user to try")]
2020
public string UserList { get; set; }
2121

22-
[Option('p', "PasswordList", Required = false, HelpText = "A file containing a line delimited list of passwords or a single password to try")]
22+
[Option('p', "passwordlist", Required = false, HelpText = "A file containing a line delimited list of passwords or a single password to try")]
2323
public string PasswordList { get; set; }
2424

25-
[Option('o', "OutFile", Required = false, HelpText = "File to output found credentials")]
25+
[Option('o', "outfile", Required = false, HelpText = "File to output found credentials")]
2626
public string OutFile { get; set; }
2727

28-
[Option('a', "AttemptsRemaining", Required = false, HelpText = "Amount of attempts to leave per-account before lockout (Default: 2)")]
28+
[Option('a', "attemptsremaining", Required = false, HelpText = "Amount of attempts to leave per-account before lockout (Default: 2)")]
2929
public int AttemptsRemaining { get; set; }
3030

31-
[Option('c', "Continuous", Required = false, HelpText = "Continuously spray credentials, waiting between attempts to prevent lockout.")]
31+
[Option('c', "continuous", Required = false, HelpText = "Continuously spray credentials, waiting between attempts to prevent lockout.")]
3232
public bool Continuous { get; set; }
3333

34-
[Option('n', "NoDb", Required = false, HelpText = "Disable using a DB to store previously sprayed creds.")]
34+
[Option('n', "nodb", Required = false, HelpText = "Disable using a DB to store previously sprayed creds.")]
3535
public bool NoDb { get; set; }
3636

37-
[Option("Users", Required = false, HelpText = "Outputs a list of all users to the specified file")]
37+
[Option("users", Required = false, HelpText = "Outputs a list of all users to the specified file")]
3838
public string OutputUsers { get; set; }
3939

40-
[Option("UsersCsv", Required = false, HelpText = "Outputs a list of all users along with their domain info to the specified CSV file")]
40+
[Option("userscsv", Required = false, HelpText = "Outputs a list of all users along with their domain info to the specified CSV file")]
4141
public string OutputUsersCsv { get; set; }
4242

43-
[Option("Policy", Required = false, HelpText = "Outputs the password policy(ies) to the terminal")]
43+
[Option("policy", Required = false, HelpText = "Outputs the password policy(ies) to the terminal")]
4444
public bool OutputPasswordPolicy { get; set; }
4545

46-
[Option('f', "Force", Required = false, HelpText = "Force authentication attempts, even users close to lockout")]
46+
[Option('f', "force", Required = false, HelpText = "Force authentication attempts, even users close to lockout")]
4747
public bool Force { get; set; }
4848
}
4949
}

TheSprayer/Program.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ public class Program
1313
{
1414
public static void Main(string[] args)
1515
{
16+
// Transform long form args to lowercase
17+
for(var i = 0; i < args.Length; i++)
18+
{
19+
// Only transform long form args
20+
if (args[i].Length > 2 && args[i][0] != '-' && args[i][1] == '-')
21+
{
22+
args[i] = args[i].ToLower();
23+
}
24+
}
25+
1626
Parser.Default.ParseArguments<CommandLineOptions>(args).WithParsed(o =>
1727
{
1828
//Try figure out the domain if it isn't provided

0 commit comments

Comments
 (0)