-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArgus-AD.ps1
More file actions
87 lines (68 loc) · 2.2 KB
/
Argus-AD.ps1
File metadata and controls
87 lines (68 loc) · 2.2 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#
# Argus-AD.ps1
# Main script for Argus-AD
#
# Copyright (c) 2025 MottaSec
#
param (
[Parameter(Mandatory=$false)]
[string]$Domain,
[Parameter(Mandatory=$false)]
[switch]$SkipSimpleMisconfigurations,
[Parameter(Mandatory=$false)]
[switch]$SkipPrivilegeEscalation,
[Parameter(Mandatory=$false)]
[switch]$SkipLateralMovement,
[Parameter(Mandatory=$false)]
[switch]$SkipHybridAD,
[Parameter(Mandatory=$false)]
[string]$OutputPath = ".\reports"
)
# Check if ActiveDirectory module is available
if (-not (Get-Module -ListAvailable -Name ActiveDirectory)) {
Write-Host "The ActiveDirectory module is required to run Argus-AD." -ForegroundColor Red
Write-Host "Please install the RSAT tools or run the Install-ArgusAD.ps1 script." -ForegroundColor Yellow
exit
}
# Import the module
$moduleImported = $false
# First check if it's installed in the standard location
if (Get-Module -ListAvailable -Name MottaSec-ArgusAD) {
Import-Module -Name MottaSec-ArgusAD -Force
$moduleImported = $true
}
# Otherwise, try importing from the local path
else {
$localModulePath = Join-Path -Path $PSScriptRoot -ChildPath "src\MottaSec-ArgusAD.psd1"
if (Test-Path -Path $localModulePath) {
Import-Module -Name $localModulePath -Force
$moduleImported = $true
}
}
if (-not $moduleImported) {
Write-Host "Failed to import the MottaSec-ArgusAD module." -ForegroundColor Red
Write-Host "Please run the Install-ArgusAD.ps1 script or ensure the module files are in the correct location." -ForegroundColor Yellow
exit
}
# Build the parameter hashtable for splatting
$parameters = @{}
if ($PSBoundParameters.ContainsKey('Domain')) {
$parameters['DomainName'] = $Domain
}
if ($PSBoundParameters.ContainsKey('OutputPath')) {
$parameters['OutputPath'] = $OutputPath
}
if ($SkipSimpleMisconfigurations) {
$parameters['SkipSimpleMisconfigurations'] = $true
}
if ($SkipPrivilegeEscalation) {
$parameters['SkipPrivilegeEscalation'] = $true
}
if ($SkipLateralMovement) {
$parameters['SkipLateralMovement'] = $true
}
if ($SkipHybridAD) {
$parameters['SkipHybridAD'] = $true
}
# Run Argus-AD
Invoke-ArgusAD @parameters