2022-11-13 14:29:28 -05:00
|
|
|
function Invoke-BloodHound
|
|
|
|
|
{
|
2020-02-08 16:06:06 -05:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Runs the BloodHound C# Ingestor using reflection. The assembly is stored in this file.
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
Using reflection and assembly.load, load the compiled BloodHound C# ingestor into memory
|
|
|
|
|
and run it without touching disk. Parameters are converted to the equivalent CLI arguments
|
|
|
|
|
for the SharpHound executable and passed in via reflection. The appropriate function
|
|
|
|
|
calls are made in order to ensure that assembly dependencies are loaded properly.
|
|
|
|
|
.PARAMETER CollectionMethod
|
|
|
|
|
Specifies the CollectionMethod being used. Possible value are:
|
|
|
|
|
Group - Collect group membership information
|
|
|
|
|
LocalGroup - Collect local group information for computers
|
|
|
|
|
LocalAdmin - Collect local admin users for computers
|
|
|
|
|
RDP - Collect remote desktop users for computers
|
|
|
|
|
DCOM - Collect distributed COM users for computers
|
2020-08-04 09:06:45 -04:00
|
|
|
PSRemote - Collected members of the Remote Management Users group for computers
|
2020-02-08 16:06:06 -05:00
|
|
|
Session - Collect session information for computers
|
|
|
|
|
Trusts - Enumerate domain trust data
|
|
|
|
|
ACL - Collect ACL (Access Control List) data
|
|
|
|
|
Container - Collect GPO/OU Data
|
2022-11-13 14:29:28 -05:00
|
|
|
ComputerOnly - Collects Local Group and Session data
|
|
|
|
|
GPOLocalGroup - Collects Local Group information using GPO (Group Policy Objects)
|
2020-02-08 16:06:06 -05:00
|
|
|
LoggedOn - Collects session information using privileged methods (needs admin!)
|
|
|
|
|
ObjectProps - Collects node property information for users and computers
|
2020-08-04 09:06:45 -04:00
|
|
|
SPNTargets - Collects SPN targets (currently only MSSQL)
|
2022-11-13 14:29:28 -05:00
|
|
|
Default - Collects Group Membership, Local Admin, Sessions, Containers, ACLs and Domain Trusts
|
2020-02-08 16:06:06 -05:00
|
|
|
DcOnly - Collects Group Membership, ACLs, ObjectProps, Trusts, Containers, and GPO Admins
|
2022-11-13 14:29:28 -05:00
|
|
|
All - Collect all data
|
2020-02-08 16:06:06 -05:00
|
|
|
This can be a list of comma seperated valued as well to run multiple collection methods!
|
2020-04-02 21:32:39 -05:00
|
|
|
.PARAMETER Domain
|
|
|
|
|
Specifies the domain to enumerate. If not specified, will enumerate the current
|
|
|
|
|
domain your user context specifies.
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER SearchForest
|
|
|
|
|
Search all trusted domains in the forest.
|
|
|
|
|
.PARAMETER Stealth
|
|
|
|
|
Use stealth collection options, will sacrifice data quality in favor of much reduced
|
|
|
|
|
network impact
|
2020-04-02 21:32:39 -05:00
|
|
|
.PARAMETER LdapFilter
|
|
|
|
|
Append this ldap filter to the search filter to further filter the results enumerated
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER DistinguishedName
|
|
|
|
|
DistinguishedName to start LDAP searches at. Equivalent to the old -Ou option
|
|
|
|
|
.PARAMETER ComputerFile
|
|
|
|
|
A file containing a list of computers to enumerate. This option can only be used with the following Collection Methods:
|
|
|
|
|
Session, Session, LocalGroup, ComputerOnly, LoggedOn
|
2020-04-02 21:32:39 -05:00
|
|
|
.PARAMETER OutputDirectory
|
|
|
|
|
Folder to output files too
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER OutputPrefix
|
2020-04-02 21:32:39 -05:00
|
|
|
Prefix to add to output files
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER CacheName
|
2020-04-02 21:32:39 -05:00
|
|
|
Name for the cache file dropped to disk (default: unique hash generated per machine)
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER MemCache
|
|
|
|
|
Don't write the cache file to disk. Caching will still be performed in memory.
|
|
|
|
|
.PARAMETER RebuildCache
|
|
|
|
|
Invalidate and rebuild the cache file
|
|
|
|
|
.PARAMETER RandomFileNames
|
2020-04-02 21:32:39 -05:00
|
|
|
Randomize file names completely
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER ZipFilename
|
2020-04-02 21:32:39 -05:00
|
|
|
Name for the zip file output by data collection
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER NoZip
|
2020-04-02 21:32:39 -05:00
|
|
|
Do NOT zip the json files
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER ZipPassword
|
|
|
|
|
Encrypt the zip file with the specified password
|
|
|
|
|
.PARAMETER TrackComputerCalls
|
|
|
|
|
Write a CSV file with the results of each computer API call to disk
|
|
|
|
|
.PARAMETER PrettyPrint
|
|
|
|
|
Output "pretty" json with formatting for readability
|
|
|
|
|
.PARAMETER LdapUsername
|
|
|
|
|
Username for connecting to LDAP. Use this if you're using a non-domain account for connecting to computers
|
|
|
|
|
.PARAMETER LdapPassword
|
|
|
|
|
Password for connecting to LDAP. Use this if you're using a non-domain account for connecting to computers
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER DomainController
|
2020-04-02 21:32:39 -05:00
|
|
|
Domain Controller to connect too. Specifiying this can result in data loss
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER LdapPort
|
2020-04-02 21:32:39 -05:00
|
|
|
Port LDAP is running on. Defaults to 389/686 for LDAPS
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER SecureLDAP
|
2020-04-02 21:32:39 -05:00
|
|
|
Connect to LDAPS (LDAP SSL) instead of regular LDAP
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER DisableCertVerification
|
|
|
|
|
Disable certificate verification for secure LDAP
|
|
|
|
|
.PARAMETER DisableSigning
|
2020-04-02 21:32:39 -05:00
|
|
|
Disables keberos signing/sealing, making LDAP traffic viewable
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER SkipPortCheck
|
2020-04-02 21:32:39 -05:00
|
|
|
Skip SMB port checks when connecting to computers
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER PortScanTimeout
|
2022-11-13 14:29:28 -05:00
|
|
|
Timeout for port checks
|
|
|
|
|
.PARAMETER SkipPasswordCheck
|
|
|
|
|
Skip checking of PwdLastSet time for computer scanning
|
|
|
|
|
.PARAMETER ExcludeDCs
|
2020-04-02 21:32:39 -05:00
|
|
|
Exclude domain controllers from enumeration (usefult o avoid Microsoft ATP/ATA)
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER Throttle
|
2020-04-02 21:32:39 -05:00
|
|
|
Throttle requests to computers (in milliseconds)
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER Jitter
|
2020-04-02 21:32:39 -05:00
|
|
|
Add jitter to throttle
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER Threads
|
|
|
|
|
Number of threads to run enumeration with (Default: 50)
|
|
|
|
|
.PARAMETER SkipRegistryLoggedOn
|
|
|
|
|
Disable remote registry check in LoggedOn collection
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER OverrideUserName
|
2020-04-02 21:32:39 -05:00
|
|
|
Override username to filter for NetSessionEnum
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER RealDNSName
|
2020-04-02 21:32:39 -05:00
|
|
|
Overrides the DNS name used for API calls
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER CollectAllProperties
|
2020-04-02 21:32:39 -05:00
|
|
|
Collect all string LDAP properties on objects
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER Loop
|
2020-04-02 21:32:39 -05:00
|
|
|
Perform looping for computer collection
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER LoopDuration
|
2020-04-02 21:32:39 -05:00
|
|
|
Duration to perform looping (Default 02:00:00)
|
2020-08-04 09:06:45 -04:00
|
|
|
.PARAMETER LoopInterval
|
2020-04-02 21:32:39 -05:00
|
|
|
Interval to sleep between loops (Default 00:05:00)
|
2022-11-13 14:29:28 -05:00
|
|
|
.PARAMETER StatusInterval
|
|
|
|
|
Interval for displaying status in milliseconds
|
|
|
|
|
.PARAMETER Verbosity
|
|
|
|
|
Change verbosity of output. Default 2 (lower is more)
|
|
|
|
|
.PARAMETER Help
|
|
|
|
|
Display this help screen
|
|
|
|
|
.PARAMETER Version
|
|
|
|
|
Display version information
|
2020-02-08 16:06:06 -05:00
|
|
|
.EXAMPLE
|
|
|
|
|
PS C:\> Invoke-BloodHound
|
|
|
|
|
Executes the default collection options and exports JSONs to the current directory, compresses the data to a zip file,
|
|
|
|
|
and then removes the JSON files from disk
|
|
|
|
|
.EXAMPLE
|
2020-04-02 21:32:39 -05:00
|
|
|
PS C:\> Invoke-BloodHound -Loop -LoopInterval 00:01:00 -LoopDuration 00:10:00
|
2020-02-08 16:06:06 -05:00
|
|
|
Executes session collection in a loop. Will wait 1 minute after each run to continue collection
|
|
|
|
|
and will continue running for 10 minutes after which the script will exit
|
|
|
|
|
.EXAMPLE
|
|
|
|
|
PS C:\> Invoke-BloodHound -CollectionMethod All
|
|
|
|
|
Runs ACL, ObjectProps, Container, and Default collection methods, compresses the data to a zip file,
|
|
|
|
|
and then removes the JSON files from disk
|
2022-11-13 14:29:28 -05:00
|
|
|
.EXAMPLE
|
|
|
|
|
PS C:\> Invoke-BloodHound -CollectionMethod DCOnly -NoSaveCache -RandomizeFilenames -EncryptZip
|
|
|
|
|
(Opsec!) Run LDAP only collection methods (Groups, Trusts, ObjectProps, ACL, Containers, GPO Admins) without outputting the cache file to disk.
|
2020-02-08 16:06:06 -05:00
|
|
|
Randomizes filenames of the JSON files and the zip file and adds a password to the zip file
|
|
|
|
|
#>
|
2022-11-13 14:29:28 -05:00
|
|
|
[CmdletBinding(PositionalBinding = $false)]
|
2018-10-16 17:53:02 +02:00
|
|
|
param(
|
2022-11-13 14:29:28 -05:00
|
|
|
[Alias("c")]
|
2018-10-16 17:53:02 +02:00
|
|
|
[String[]]
|
2022-11-13 14:29:28 -05:00
|
|
|
$CollectionMethod = [String[]]@('Default'),
|
|
|
|
|
[Alias("d")]
|
2018-10-16 17:53:02 +02:00
|
|
|
[String]
|
|
|
|
|
$Domain,
|
2022-11-13 14:29:28 -05:00
|
|
|
[Alias("s")]
|
|
|
|
|
[Switch]
|
|
|
|
|
$SearchForest,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$Stealth,
|
|
|
|
|
[String]
|
|
|
|
|
$LdapFilter,
|
|
|
|
|
[String]
|
|
|
|
|
$DistinguishedName,
|
2020-08-04 09:06:45 -04:00
|
|
|
[String]
|
2020-04-02 21:32:39 -05:00
|
|
|
$ComputerFile,
|
2020-08-04 09:06:45 -04:00
|
|
|
[ValidateScript({ Test-Path -Path $_ })]
|
2020-04-02 21:32:39 -05:00
|
|
|
[String]
|
2022-11-13 14:29:28 -05:00
|
|
|
$OutputDirectory = $( Get-Location ),
|
2020-08-04 09:06:45 -04:00
|
|
|
[ValidateNotNullOrEmpty()]
|
2020-04-02 21:32:39 -05:00
|
|
|
[String]
|
|
|
|
|
$OutputPrefix,
|
2020-08-04 09:06:45 -04:00
|
|
|
[String]
|
2022-11-13 14:29:28 -05:00
|
|
|
$CacheName,
|
|
|
|
|
[Switch]
|
|
|
|
|
$MemCache,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$RebuildCache,
|
|
|
|
|
[Switch]
|
|
|
|
|
$RandomFilenames,
|
2020-08-04 09:06:45 -04:00
|
|
|
[String]
|
2020-04-02 21:32:39 -05:00
|
|
|
$ZipFilename,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$NoZip,
|
|
|
|
|
[String]
|
|
|
|
|
$ZipPassword,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$TrackComputerCalls,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$PrettyPrint,
|
2018-10-16 17:53:02 +02:00
|
|
|
[String]
|
2022-11-13 14:29:28 -05:00
|
|
|
$LdapUsername,
|
|
|
|
|
[String]
|
|
|
|
|
$LdapPassword,
|
2020-08-04 09:06:45 -04:00
|
|
|
[string]
|
2018-10-16 17:53:02 +02:00
|
|
|
$DomainController,
|
2022-11-13 14:29:28 -05:00
|
|
|
[ValidateRange(0, 65535)]
|
|
|
|
|
[Int]
|
2018-10-16 17:53:02 +02:00
|
|
|
$LdapPort,
|
|
|
|
|
[Switch]
|
|
|
|
|
$SecureLdap,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$DisableCertVerification,
|
2020-08-04 09:06:45 -04:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$DisableSigning,
|
2018-10-16 17:53:02 +02:00
|
|
|
[Switch]
|
2022-11-13 14:29:28 -05:00
|
|
|
$SkipPortCheck,
|
|
|
|
|
[ValidateRange(50, 5000)]
|
|
|
|
|
[Int]
|
|
|
|
|
$PortCheckTimeout = 500,
|
|
|
|
|
[Switch]
|
|
|
|
|
$SkipPasswordCheck,
|
|
|
|
|
[Switch]
|
|
|
|
|
$ExcludeDCs,
|
|
|
|
|
[Int]
|
2018-10-16 17:53:02 +02:00
|
|
|
$Throttle,
|
2022-11-13 14:29:28 -05:00
|
|
|
[ValidateRange(0, 100)]
|
|
|
|
|
[Int]
|
|
|
|
|
$Jitter,
|
|
|
|
|
[Int]
|
|
|
|
|
$Threads,
|
|
|
|
|
[Switch]
|
|
|
|
|
$SkipRegistryLoggedOn,
|
2020-08-04 09:06:45 -04:00
|
|
|
[String]
|
2020-04-02 21:32:39 -05:00
|
|
|
$OverrideUsername,
|
2020-08-04 09:06:45 -04:00
|
|
|
[String]
|
|
|
|
|
$RealDNSName,
|
|
|
|
|
[Switch]
|
|
|
|
|
$CollectAllProperties,
|
|
|
|
|
[Switch]
|
|
|
|
|
$Loop,
|
|
|
|
|
[String]
|
|
|
|
|
$LoopDuration,
|
|
|
|
|
[String]
|
|
|
|
|
$LoopInterval,
|
2022-11-13 14:29:28 -05:00
|
|
|
[ValidateRange(500, 60000)]
|
|
|
|
|
[Int]
|
|
|
|
|
$StatusInterval,
|
|
|
|
|
[Alias("v")]
|
|
|
|
|
[ValidateRange(0, 5)]
|
|
|
|
|
[Int]
|
|
|
|
|
$Verbosity,
|
|
|
|
|
[Alias("h")]
|
|
|
|
|
[Switch]
|
|
|
|
|
$Help,
|
|
|
|
|
[Switch]
|
|
|
|
|
$Version
|
2018-10-16 17:53:02 +02:00
|
|
|
)
|
|
|
|
|
$vars = New-Object System.Collections.Generic.List[System.Object]
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($CollectionMethod)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--CollectionMethods");
|
|
|
|
|
foreach ($cmethod in $CollectionMethod)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add($cmethod);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($Domain)
|
|
|
|
|
{
|
2020-04-02 21:32:39 -05:00
|
|
|
$vars.Add("--Domain");
|
2018-10-16 17:53:02 +02:00
|
|
|
$vars.Add($Domain);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($SearchForest)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--SearchForest")
|
|
|
|
|
}
|
|
|
|
|
if ($Stealth)
|
|
|
|
|
{
|
2018-10-16 17:53:02 +02:00
|
|
|
$vars.Add("--Stealth")
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($LdapFilter)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--LdapFilter");
|
|
|
|
|
$vars.Add($LdapFilter);
|
|
|
|
|
}
|
|
|
|
|
if ($DistinguishedName)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--DistinguishedName")
|
|
|
|
|
$vars.Add($DistinguishedName)
|
2020-08-04 09:06:45 -04:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($ComputerFile)
|
|
|
|
|
{
|
2018-10-16 17:53:02 +02:00
|
|
|
$vars.Add("--ComputerFile");
|
|
|
|
|
$vars.Add($ComputerFile);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($OutputDirectory)
|
|
|
|
|
{
|
2020-04-02 21:32:39 -05:00
|
|
|
$vars.Add("--OutputDirectory");
|
|
|
|
|
$vars.Add($OutputDirectory);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($OutputPrefix)
|
|
|
|
|
{
|
2020-04-02 21:32:39 -05:00
|
|
|
$vars.Add("--OutputPrefix");
|
|
|
|
|
$vars.Add($OutputPrefix);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($CacheName)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--CacheName");
|
|
|
|
|
$vars.Add($CacheName);
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($NoSaveCache)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--MemCache");
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($RebuildCache)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--RebuildCache");
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($RandomFilenames)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--RandomFilenames");
|
|
|
|
|
}
|
|
|
|
|
if ($ZipFileName)
|
|
|
|
|
{
|
2020-04-02 21:32:39 -05:00
|
|
|
$vars.Add("--ZipFileName");
|
|
|
|
|
$vars.Add($ZipFileName);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($NoZip)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--NoZip");
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($ZipPassword)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--ZipPassword");
|
|
|
|
|
$vars.Add($ZipPassword)
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($TrackComputerCalls)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--TrackComputerCalls")
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($PrettyPrint)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--PrettyPrint");
|
2020-04-02 21:32:39 -05:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($LdapUsername)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--LdapUsername");
|
|
|
|
|
$vars.Add($LdapUsername);
|
|
|
|
|
}
|
|
|
|
|
if ($LdapPassword)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--LdapPassword");
|
|
|
|
|
$vars.Add($LdapPassword);
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($DomainController)
|
|
|
|
|
{
|
2018-10-16 17:53:02 +02:00
|
|
|
$vars.Add("--DomainController");
|
|
|
|
|
$vars.Add($DomainController);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($LdapPort)
|
|
|
|
|
{
|
2018-10-16 17:53:02 +02:00
|
|
|
$vars.Add("--LdapPort");
|
|
|
|
|
$vars.Add($LdapPort);
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($SecureLdap)
|
|
|
|
|
{
|
2018-10-16 17:53:02 +02:00
|
|
|
$vars.Add("--SecureLdap");
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($DisableCertVerification)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--DisableCertVerification")
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($DisableSigning)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--DisableSigning");
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($SkipPortCheck)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--SkipPortCheck");
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($PortCheckTimeout)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--PortCheckTimeout")
|
|
|
|
|
$vars.Add($PortCheckTimeout)
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($SkipPasswordCheck)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--SkipPasswordCheck");
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($ExcludeDCs)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--ExcludeDCs")
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($Throttle)
|
|
|
|
|
{
|
2020-04-02 21:32:39 -05:00
|
|
|
$vars.Add("--Throttle");
|
|
|
|
|
$vars.Add($Throttle);
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($Jitter -gt 0)
|
|
|
|
|
{
|
2020-04-02 21:32:39 -05:00
|
|
|
$vars.Add("--Jitter");
|
|
|
|
|
$vars.Add($Jitter);
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($Threads)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--Threads")
|
|
|
|
|
$vars.Add($Threads)
|
2018-10-16 17:53:02 +02:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($SkipRegistryLoggedOn)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--SkipRegistryLoggedOn")
|
2020-08-04 09:06:45 -04:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($OverrideUserName)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--OverrideUserName")
|
|
|
|
|
$vars.Add($OverrideUsername)
|
2020-08-04 09:06:45 -04:00
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($RealDNSName)
|
|
|
|
|
{
|
2020-08-04 09:06:45 -04:00
|
|
|
$vars.Add("--RealDNSName")
|
|
|
|
|
$vars.Add($RealDNSName)
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($CollectAllProperties)
|
|
|
|
|
{
|
2020-08-04 09:06:45 -04:00
|
|
|
$vars.Add("--CollectAllProperties")
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($Loop)
|
|
|
|
|
{
|
2020-08-04 09:06:45 -04:00
|
|
|
$vars.Add("--Loop")
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($LoopDuration)
|
|
|
|
|
{
|
2020-08-04 09:06:45 -04:00
|
|
|
$vars.Add("--LoopDuration")
|
|
|
|
|
$vars.Add($LoopDuration)
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($LoopInterval)
|
|
|
|
|
{
|
2020-08-04 09:06:45 -04:00
|
|
|
$vars.Add("--LoopInterval")
|
|
|
|
|
$vars.Add($LoopInterval)
|
|
|
|
|
}
|
2022-11-13 14:29:28 -05:00
|
|
|
if ($StatusInterval)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("--StatusInterval")
|
|
|
|
|
$vars.Add($StatusInterval)
|
|
|
|
|
}
|
|
|
|
|
if ($Verbosity)
|
|
|
|
|
{
|
|
|
|
|
$vars.Add("-v");
|
|
|
|
|
$vars.Add($Verbosity);
|
|
|
|
|
}
|
|
|
|
|
if ($Help)
|
|
|
|
|
{
|
|
|
|
|
$vars.clear()
|
|
|
|
|
$vars.Add("--Help");
|
|
|
|
|
}
|
|
|
|
|
if ($Version)
|
|
|
|
|
{
|
|
|
|
|
$vars.clear();
|
|
|
|
|
$vars.Add("--Version");
|
2020-08-04 09:06:45 -04:00
|
|
|
}
|
2018-10-16 17:53:02 +02:00
|
|
|
$passed = [string[]]$vars.ToArray()
|
2022-11-13 14:29:28 -05:00
|
|
|
$EncodedCompressedFile = 'zL0HWBPLFze82YRNo4WSUKRYwDUBsSKgYu9gQayo2DsuJlhD0Gvvvber2HsXe8feewN7w2v3Wq4K75yZ3WSD6PX+3/d5vs9Hsju/mT1z5sw5Z+rOxraeQkkpipKhv7w8itpJkX9VqX//NxT9OQfsdqa2Kc8W3imJOVs4vnsPU2Cyketm7JAU2KlDnz5cSmDHLoHGfn0Ce/QJrNmoaWAS17lLSScnVTGeRuNaFBUjkVIVvyzfI9C9RxWRqCWlKOqNC0X5EGySiytFBQopqpJ7mvAN/xghqr0rxuGflGo/kqJc8X/b1XohlBDdBnAT6Eqt0xZQyKqulCO6bHJ2pSJ+QybWf4g/hSioQOG6onDJlC4DU9B1xmsXUhYoK/0DifYljSZjJ3SPeUM8Ul7o+s7FnkX0v6SxS28OJXTkeca0VK7501XPz2ayC0kDvNGUA5Wa60yVc5VQEgrqgWI8tlJU9wbOv11sH/axhGL0lHsp2poZHfgBkbOgmpTRLOJLRUtZVAyGdmAj4GJCCqhiy8EtWxb9yjgZJDI5AFwGAXp/2owgmb4ILbXgGwQ4CIADDzACwPCAXADkPKAQAAUPKAVAyQMqAVDxgFoA1DzgKACOPOAkAE484CwAzjzgIgAuPOAqAK48oBEADQ+4CYAbD7gLgDsPeAiABw94CoAnD2gFQMsDOgHQ8YCXAHjxgLcAePOAjwD48ICvAPjyQCEBKMQDfgLgxwP+AoBvehqRLiSzqI5UE5DUJSyqHNVQCUSBzlRA+oICGjeKRZWkshRGEW4UbSmCr56WQHxNJTCLUhr4EItqTEX0rjjWZUpDs6hKmKBQ12BWiZTSWBwyRtWmUtFsCRTDQLxKH06zSIWYQJ8mFJWoR8+6l5JSY3kaUpVUxqGKVIU6SY2lEQEZ6wI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ryStream][Convert]::FromBase64String($EncodedCompressedFile),[IO.Compression.CompressionMode]::Decompress)
|
2022-11-13 14:29:28 -05:00
|
|
|
$UncompressedFileBytes = New-Object Byte[](1051648)
|
|
|
|
|
$DeflatedStream.Read($UncompressedFileBytes, 0, 1051648) | Out-Null
|
2020-04-23 16:01:12 -04:00
|
|
|
$Assembly = [Reflection.Assembly]::Load($UncompressedFileBytes)
|
|
|
|
|
$BindingFlags = [Reflection.BindingFlags] "Public,Static"
|
|
|
|
|
$a = @()
|
|
|
|
|
$Assembly.GetType("Costura.AssemblyLoader", $false).GetMethod("Attach", $BindingFlags).Invoke($Null, @())
|
2022-11-13 14:29:28 -05:00
|
|
|
$Assembly.GetType("Sharphound.Program").GetMethod("InvokeSharpHound").Invoke($Null, @(,$passed))
|
2020-08-04 09:06:45 -04:00
|
|
|
}
|