The ActiveDirectory PowerShell module is a set of PowerShell cmdlets for administering an Active Directory environment. Before using it, we need to make sure it is imported with Get-Module.
Get-Module
Import-Module ActiveDirectory
Domain
Get-ADDomain
echo %USERDOMAIN%
echo %logonserver%# DC
We get domain information through PowerShell, using LDAP to communicate with AD and extract information.
$domainObj = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()$PDC = $domainObj.PdcRoleOwner.Name$DN = ([adsi]'').distinguishedName $LDAP ="LDAP://$PDC/$DN"$direntry =New-Object System.DirectoryServices.DirectoryEntry($LDAP)$dirsearcher =New-Object System.DirectoryServices.DirectorySearcher($direntry)$dirsearcher.filter="samAccountType=805306368"# enumerate all users in the domain# $dirsearcher.filter="name=jeffadmin" # takes a specific user and instead of printing $prop, it prints $prop.memberof$result = $dirsearcher.FindAll()Foreach($obj in $result){Foreach($prop in $obj.Properties) { $prop }Write-Host"-------------------------------"}
It is a PowerSploit script and there are two versions: Old and New(maintained by Empire)
Import-Module .\PowerView.ps1
Get-NetDomain# basic domain infoGet-NetUser# user infoGet-NetGroup# group infoGet-NetComputer# machine infoGet-DomainPolicy# password policy infoFind-LocalAdminAccess# machines where user has administrator privilegesGet-DomainTrustMapping# trust relationshipsGet-DomainUser*-spn # SPN# Etc.
Enumeration with SMB
enum4linux -u <USER> -p <PASS> <IP> -a
Detailed enumeration with specific queries
rpcclient -U [<DOMAIN>/]<USER>[%<PASS>] <IP>>> <QUERY>
Tool
Tool
Details
Allows you to see which users are connected to a specified computer. For this to work, the machine must have Remote Registry enabled. (we can get false positives because we are not sure that Remote Registry is enabled on the target)
.\PsLoggedon.exe \<COMPUTER_NAME>
Tool to acquire credentials or other sensitive data in an Active Directory environment by searching between shares.
Snaffler.exe -s -d <DOMAIN> -o <OUTPUT_FILE.log> -v data