Skip to content

Commit 00b1bc2

Browse files
committed
Update user details output to boolean flags
1 parent 20d1bb2 commit 00b1bc2

3 files changed

Lines changed: 16 additions & 15 deletions

File tree

ReadMe.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ TheSprayer.exe -p Passwords.txt -f
5151
TheSprayer.exe --Policy
5252
```
5353

54-
##### Write a list of users to users.txt
54+
##### Output a list of users to AdUserList.txt
5555
```
56-
TheSprayer.exe --Users users
56+
TheSprayer.exe --Users
5757
```
5858

59-
##### Write a list of users and all their details from AD to users.csv
59+
##### Write a list of users and all their details from AD to AdUserDetails.csv
6060
```
61-
TheSprayer.exe --UsersCsv users
61+
TheSprayer.exe --UsersCsv
6262
```
6363

6464
## Options

TheSprayer/CommandLineOptions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public class CommandLineOptions
3434
[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")]
38-
public string OutputUsers { get; set; }
37+
[Option("users", Required = false, Default = null, HelpText = "Outputs a simple list of all users to the txt file")]
38+
public bool 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")]
41-
public string OutputUsersCsv { get; set; }
40+
[Option("userscsv", Required = false, Default = null, HelpText = "Outputs a list of all users along with their domain info to a CSV file")]
41+
public bool OutputUsersCsv { get; set; }
4242

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

TheSprayer/Program.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@ public static void Main(string[] args)
5656
return;
5757
}
5858
}
59-
6059
var adService = new ActiveDirectoryService(o.Domain, o.Username, o.Password, o.DomainController);
6160

6261
//Output a list of users to the specified file and exit
63-
if (!string.IsNullOrWhiteSpace(o.OutputUsers))
62+
if (o.OutputUsers)
6463
{
6564
var users = adService.GetAllDomainUsers().Select(u => u.SamAccountName);
66-
File.WriteAllLines(o.OutputUsers + ".txt", users);
67-
Console.WriteLine($"{o.OutputUsers + ".txt"} created.");
65+
File.WriteAllLines("AdUserList.txt", users);
66+
Console.WriteLine("AdUserList.txt created.");
6867
return;
6968
}
70-
if (!string.IsNullOrWhiteSpace(o.OutputUsersCsv))
69+
if (o.OutputUsersCsv)
7170
{
7271
var users = adService.GetAllDomainUsers();
73-
File.WriteAllText(o.OutputUsersCsv + ".csv", users.ToCsv());
74-
Console.WriteLine($"{o.OutputUsersCsv + ".csv"} created.");
72+
File.WriteAllText("AdUserDetails.csv", users.ToCsv());
73+
Console.WriteLine("AdUserDetails.csv created.");
7574
return;
7675
}
7776
else if (o.OutputPasswordPolicy) //Output the password policy to the terminal and exit
7877
{
78+
Console.WriteLine(5);
7979
var defaultPolicy = adService.GetPasswordPolicy();
8080
var fineGrainedPolicies = adService.GetFineGrainedPasswordPolicy();
8181

@@ -99,6 +99,7 @@ public static void Main(string[] args)
9999
}
100100
else //Otherwise we want to validate remaining parameters and spray
101101
{
102+
Console.WriteLine(6);
102103
IEnumerable<string> passwords, users;
103104
int remainingAttempts;
104105

0 commit comments

Comments
 (0)