diff --git a/ReadMe.md b/ReadMe.md index 1b6109f..08bc607 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -51,14 +51,14 @@ TheSprayer.exe -p Passwords.txt -f TheSprayer.exe --Policy ``` -##### Write a list of users to users.txt +##### Output a list of users to AdUserList.txt ``` -TheSprayer.exe --Users users +TheSprayer.exe --Users ``` -##### Write a list of users and all their details from AD to users.csv +##### Write a list of users and all their details from AD to AdUserDetails.csv ``` -TheSprayer.exe --UsersCsv users +TheSprayer.exe --UsersCsv ``` ## Options diff --git a/TheSprayer/CommandLineOptions.cs b/TheSprayer/CommandLineOptions.cs index 32fe4cd..894949b 100644 --- a/TheSprayer/CommandLineOptions.cs +++ b/TheSprayer/CommandLineOptions.cs @@ -34,11 +34,11 @@ public class CommandLineOptions [Option('n', "nodb", Required = false, HelpText = "Disable using a DB to store previously sprayed creds.")] public bool NoDb { get; set; } - [Option("users", Required = false, HelpText = "Outputs a list of all users to the specified file")] - public string OutputUsers { get; set; } + [Option("users", Required = false, Default = null, HelpText = "Outputs a simple list of all users to the txt file")] + public bool OutputUsers { get; set; } - [Option("userscsv", Required = false, HelpText = "Outputs a list of all users along with their domain info to the specified CSV file")] - public string OutputUsersCsv { get; set; } + [Option("userscsv", Required = false, Default = null, HelpText = "Outputs a list of all users along with their domain info to a CSV file")] + public bool OutputUsersCsv { get; set; } [Option("policy", Required = false, HelpText = "Outputs the password policy(ies) to the terminal")] public bool OutputPasswordPolicy { get; set; } diff --git a/TheSprayer/Program.cs b/TheSprayer/Program.cs index 18e6979..b494849 100644 --- a/TheSprayer/Program.cs +++ b/TheSprayer/Program.cs @@ -56,26 +56,26 @@ public static void Main(string[] args) return; } } - var adService = new ActiveDirectoryService(o.Domain, o.Username, o.Password, o.DomainController); //Output a list of users to the specified file and exit - if (!string.IsNullOrWhiteSpace(o.OutputUsers)) + if (o.OutputUsers) { var users = adService.GetAllDomainUsers().Select(u => u.SamAccountName); - File.WriteAllLines(o.OutputUsers + ".txt", users); - Console.WriteLine($"{o.OutputUsers + ".txt"} created."); + File.WriteAllLines("AdUserList.txt", users); + Console.WriteLine("AdUserList.txt created."); return; } - if (!string.IsNullOrWhiteSpace(o.OutputUsersCsv)) + if (o.OutputUsersCsv) { var users = adService.GetAllDomainUsers(); - File.WriteAllText(o.OutputUsersCsv + ".csv", users.ToCsv()); - Console.WriteLine($"{o.OutputUsersCsv + ".csv"} created."); + File.WriteAllText("AdUserDetails.csv", users.ToCsv()); + Console.WriteLine("AdUserDetails.csv created."); return; } else if (o.OutputPasswordPolicy) //Output the password policy to the terminal and exit { + Console.WriteLine(5); var defaultPolicy = adService.GetPasswordPolicy(); var fineGrainedPolicies = adService.GetFineGrainedPasswordPolicy(); @@ -99,6 +99,7 @@ public static void Main(string[] args) } else //Otherwise we want to validate remaining parameters and spray { + Console.WriteLine(6); IEnumerable passwords, users; int remainingAttempts;