Skip to content

Instantly share code, notes, and snippets.

View trevorbryant's full-sized avatar
🤘

Trevor Bryant trevorbryant

🤘
View GitHub Profile
@trevorbryant
trevorbryant / Find-NetShares.ps1
Created November 7, 2018 18:22
Quick and ghetto way to enumerate open shares on a target Windows host
param(
[array] $Target
)
foreach ($TargetShares in $Target) {
(net view \\$Target) | Foreach-Object {
@trevorbryant
trevorbryant / Get-LocalGroupMembers.ps1
Created November 7, 2018 17:50
Query local group objects to find member objects
# Get-LocalGroupMembers.ps1
# Set variables
$Results = @()
$ComputerName = [ADSI]("WinNT://$env:COMPUTERNAME,computer")
$LocalGroups = $ComputerName.psbase.Children | Where-Object {
$_.psbase.schemaclassname -Eq "group"
}
@trevorbryant
trevorbryant / Discover-LocalAdmins.ps1
Created November 7, 2018 17:46
This script uses ADSI query Active Directory to discover users nested under your Local Administrators group
# Run on local Microsoft Windows endpoint and find all objects with Local Administrator rights
$ErrorActionPreference="SilentlyContinue"
#Credit to Sean Metcalf for this bit
$ADForestInfo = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest()
$ADForestInfoRootDomain = $ADForestInfo.RootDomain
$ADForestInfoRootDomainDN = "DC=" + $ADForestInfoRootDomain -Replace("\.",',DC=')
$ADDomainLDAPDN = 'GC://' + $ADForestInfoRootDomainDN
$root = [ADSI]$ADDomainLDAPDN
### Keybase proof
I hereby claim:
* I am trevorbryant on github.
* I am trevorbryant (https://keybase.io/trevorbryant) on keybase.
* I have a public key ASBLUMBhLtBsA6Rl62X09nNiSTRjMkCTWympa7fjxUXXqgo
To claim this, I am signing this object: