Test Passwords Against Active Directory User

Tool to test password against Active Directory user. Multiple passwords can be tested by ; separating them

Usage: CheckCredentials.exe FQDN USERNAME PASSWORD1[;PASSWORD2;PASSWORD3..]

[sourcecode language=”vb”]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.DirectoryServices.AccountManagement;
using System.Diagnostics;

namespace CheckCredentials
{
class Program
{
static void Main(string[] args)
{
if (args.GetUpperBound(0) == 2)
{
foreach (string password in args[2].Split(‘;’))
{
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, args[0]))
{

// validate the credentials
bool isValid = pc.ValidateCredentials(args[1], password);

if (isValid)
{
Console.WriteLine(@"{1}@{0} has password {2}", args[0], args[1], password);
}

}
}
}
else
{
Console.WriteLine("Usage:{0} FQDN USERNAME PASSWORD1[;PASSWORD2;PASSWORD3..]", Process.GetCurrentProcess().ProcessName + ".exe");
}
}
}
}
[/sourcecode]

Attachment(s): [list-attachments]

View Shaun Vermaak's profile on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.