Skip to content

Commit 036059a

Browse files
committed
Update Monkey365
1 parent d747f4e commit 036059a

11 files changed

+70
-25
lines changed

Invoke-Monkey365.ps1

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,48 @@ Function Invoke-Monkey365{
459459
}
460460
return
461461
}
462+
#Check if list collectors
463+
If($PSBoundParameters.ContainsKey('ListRule') -and $PSBoundParameters['ListRule'].IsPresent){
464+
#Get command Metadata
465+
$MetaData = New-Object -TypeName "System.Management.Automation.CommandMetaData" (Get-Command -Name "Get-Rule")
466+
$newPsboundParams = [ordered]@{}
467+
if($null -ne $MetaData){
468+
$param = $MetaData.Parameters.Keys
469+
foreach($p in $param.GetEnumerator()){
470+
if($PSBoundParameters.ContainsKey($p)){
471+
$newPsboundParams.Add($p,$PSBoundParameters[$p])
472+
}
473+
}
474+
#Add verbose, debug
475+
$newPsboundParams.Add('Verbose',$O365Object.verbose)
476+
$newPsboundParams.Add('Debug',$O365Object.debug)
477+
$newPsboundParams.Add('InformationAction',$O365Object.InformationAction)
478+
#Add pretty print
479+
[void]$newPsboundParams.Add('Pretty',$true);
480+
#Add RulesPath
481+
If($newPsboundParams.Contains('RulesPath')){
482+
$newPsboundParams.RulesPath = $O365Object.rulesPath;
483+
}
484+
Else{
485+
[void]$newPsboundParams.Add('RulesPath',$O365Object.rulesPath);
486+
}
487+
#Remove RuleSet if null
488+
If($newPsboundParams.Contains('RuleSet') -and $null -eq $newPsboundParams['RuleSet']){
489+
[void]$newPsboundParams.Remove('RuleSet');
490+
}
491+
#Remove instance if EntraID is selected
492+
If($newPsboundParams.Contains('Instance') -and $newPsboundParams['Instance'] -eq 'EntraID'){
493+
[void]$newPsboundParams.Remove('Instance');
494+
}
495+
#Remove Instance if null
496+
If($newPsboundParams.Contains('Instance') -and $null -eq $newPsboundParams['Instance']){
497+
[void]$newPsboundParams.Remove('Instance');
498+
}
499+
#Execute command
500+
Get-Rule @newPsboundParams
501+
}
502+
return
503+
}
462504
#Check for mandatory params
463505
Test-MandatoryParameter
464506
#Import MSAL module
@@ -536,4 +578,4 @@ Function Invoke-Monkey365{
536578
[System.GC]::GetTotalMemory($true) | out-null
537579
}
538580
}
539-
}
581+
}

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ The following example will retrieve data and metadata from Azure AD and SharePoi
6565

6666

6767
``` powershell
68-
$param = @{
68+
$options = @{
6969
Instance = 'Microsoft365';
70-
Analysis = 'SharePointOnline';
70+
Collect = 'ExchangeOnline';
7171
PromptBehavior = 'SelectAccount';
7272
IncludeEntraID = $true;
73-
ExportTo = 'PRINT';
73+
ExportTo = 'CSV';
7474
}
75-
$assets = Invoke-Monkey365 @param
75+
Invoke-Monkey365 @options
7676
```
7777

7878
# Regulatory compliance checks
@@ -93,9 +93,7 @@ By default, the HTML report shows you the CIS (Center for Internet Security) Ben
9393

9494
The following standards are supported by Monkey365:
9595

96-
* CIS Microsoft Azure Foundations Benchmark v2.0.0
9796
* CIS Microsoft Azure Foundations Benchmark v3.0.0
98-
* CIS Microsoft 365 Foundations Benchmark v2.0.0
9997
* CIS Microsoft 365 Foundations Benchmark v3.0.0
10098

10199
More standards will be added in next releases (NIST, HIPAA, GDPR, PCI-DSS, etc..) as they are available.

build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
1+
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -77,4 +77,4 @@ $param = @{
7777
}
7878
Write-information @param
7979
#Start process
80-
Start-Process docker -ArgumentList $buildArgs -NoNewWindow -Wait
80+
Start-Process docker -ArgumentList $buildArgs -NoNewWindow -Wait

monkey365.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
1+
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -14,4 +14,4 @@
1414

1515
[CmdletBinding()]
1616
param()
17-
Invoke-Monkey365
17+
Invoke-Monkey365

monkey365.psd1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'monkey365.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.93'
15+
ModuleVersion = '0.94'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -85,7 +85,8 @@ FunctionsToExport = @(
8585
'Copy-PsObject',
8686
'ConvertTo-SecureScriptBlock',
8787
'Update-PsObject',
88-
'Get-AstFunction'
88+
'Get-AstFunction',
89+
'Get-ObjectPropertyByPath'
8990
)
9091

9192
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
@@ -117,10 +118,12 @@ PrivateData = @{
117118
"Microsoft 365 security",
118119
"Azure",
119120
"AzureAD",
121+
"Entra ID security assessment",
120122
"Microsoft Entra",
121123
"CSPM",
122124
"Office 365",
123-
"Office 365 Security"
125+
"Office 365 Security",
126+
"CIS Benchmark"
124127
)
125128

126129
# A URL to the license for this module.
@@ -152,3 +155,4 @@ HelpInfoURI = 'https://silverhack.github.io/monkey365/'
152155

153156
}
154157

158+

monkey365.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Set-StrictMode -Off #-Version Latest
1+
#Set-StrictMode -Off #-Version Latest
22
Set-StrictMode -Version Latest
33

44
$LocalizedDataParams = @{
@@ -93,4 +93,4 @@ $all_files = $all_files.Where({$_.EndsWith('ps1')})
9393
$all_files.ForEach({. $_})
9494

9595
$monkey = ("{0}/Invoke-Monkey365.ps1" -f $PSScriptRoot)
96-
. $monkey
96+
. $monkey

tests/Get-MonkeyTest.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
1+
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -51,3 +51,4 @@ Function Get-MonkeyTest{
5151
Write-Host "End!"
5252
}
5353
}
54+

tests/MonkeyCloudUtils.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PSScriptAnalyzer - ignore test file
1+
# PSScriptAnalyzer - ignore test file
22
Import-Module Pester
33
Set-StrictMode -Version Latest
44

@@ -94,4 +94,4 @@ Describe 'MonkeyCloudUtils' {
9494
$tinfo.TenantRegionScope | Should -Be "USGov"
9595
}
9696
}
97-
}
97+
}

tests/MonkeyJob.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PSScriptAnalyzer - ignore test file
1+
# PSScriptAnalyzer - ignore test file
22
Import-Module Pester
33
Set-StrictMode -Version Latest
44

@@ -96,4 +96,4 @@ Describe 'MonkeyJob' {
9696
Get-MonkeyJob | Remove-MonkeyJob -Force
9797
}
9898
}
99-
}
99+
}

tests/MonkeyWebRequests.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PSScriptAnalyzer - ignore test file
1+
# PSScriptAnalyzer - ignore test file
22
Import-Module Pester
33
Set-StrictMode -Version Latest
44

@@ -25,4 +25,4 @@ Describe 'Google' {
2525
$StatusCode | Should -Be 'OK'
2626
}
2727
}
28-
}
28+
}

0 commit comments

Comments
 (0)