Skip to content

Commit

Permalink
Update Monkey365
Browse files Browse the repository at this point in the history
  • Loading branch information
silverhack committed Jan 8, 2025
1 parent d747f4e commit 036059a
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 25 deletions.
44 changes: 43 additions & 1 deletion Invoke-Monkey365.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,48 @@ Function Invoke-Monkey365{
}
return
}
#Check if list collectors
If($PSBoundParameters.ContainsKey('ListRule') -and $PSBoundParameters['ListRule'].IsPresent){
#Get command Metadata
$MetaData = New-Object -TypeName "System.Management.Automation.CommandMetaData" (Get-Command -Name "Get-Rule")
$newPsboundParams = [ordered]@{}
if($null -ne $MetaData){
$param = $MetaData.Parameters.Keys
foreach($p in $param.GetEnumerator()){
if($PSBoundParameters.ContainsKey($p)){
$newPsboundParams.Add($p,$PSBoundParameters[$p])
}
}
#Add verbose, debug
$newPsboundParams.Add('Verbose',$O365Object.verbose)
$newPsboundParams.Add('Debug',$O365Object.debug)
$newPsboundParams.Add('InformationAction',$O365Object.InformationAction)
#Add pretty print
[void]$newPsboundParams.Add('Pretty',$true);
#Add RulesPath
If($newPsboundParams.Contains('RulesPath')){
$newPsboundParams.RulesPath = $O365Object.rulesPath;
}
Else{
[void]$newPsboundParams.Add('RulesPath',$O365Object.rulesPath);
}
#Remove RuleSet if null
If($newPsboundParams.Contains('RuleSet') -and $null -eq $newPsboundParams['RuleSet']){
[void]$newPsboundParams.Remove('RuleSet');
}
#Remove instance if EntraID is selected
If($newPsboundParams.Contains('Instance') -and $newPsboundParams['Instance'] -eq 'EntraID'){
[void]$newPsboundParams.Remove('Instance');
}
#Remove Instance if null
If($newPsboundParams.Contains('Instance') -and $null -eq $newPsboundParams['Instance']){
[void]$newPsboundParams.Remove('Instance');
}
#Execute command
Get-Rule @newPsboundParams
}
return
}
#Check for mandatory params
Test-MandatoryParameter
#Import MSAL module
Expand Down Expand Up @@ -536,4 +578,4 @@ Function Invoke-Monkey365{
[System.GC]::GetTotalMemory($true) | out-null
}
}
}
}
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ The following example will retrieve data and metadata from Azure AD and SharePoi


``` powershell
$param = @{
$options = @{
Instance = 'Microsoft365';
Analysis = 'SharePointOnline';
Collect = 'ExchangeOnline';
PromptBehavior = 'SelectAccount';
IncludeEntraID = $true;
ExportTo = 'PRINT';
ExportTo = 'CSV';
}
$assets = Invoke-Monkey365 @param
Invoke-Monkey365 @options
```

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

The following standards are supported by Monkey365:

* CIS Microsoft Azure Foundations Benchmark v2.0.0
* CIS Microsoft Azure Foundations Benchmark v3.0.0
* CIS Microsoft 365 Foundations Benchmark v2.0.0
* CIS Microsoft 365 Foundations Benchmark v3.0.0

More standards will be added in next releases (NIST, HIPAA, GDPR, PCI-DSS, etc..) as they are available.
Expand Down
4 changes: 2 additions & 2 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -77,4 +77,4 @@ $param = @{
}
Write-information @param
#Start process
Start-Process docker -ArgumentList $buildArgs -NoNewWindow -Wait
Start-Process docker -ArgumentList $buildArgs -NoNewWindow -Wait
4 changes: 2 additions & 2 deletions monkey365.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,4 +14,4 @@

[CmdletBinding()]
param()
Invoke-Monkey365
Invoke-Monkey365
10 changes: 7 additions & 3 deletions monkey365.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'monkey365.psm1'

# Version number of this module.
ModuleVersion = '0.93'
ModuleVersion = '0.94'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -85,7 +85,8 @@ FunctionsToExport = @(
'Copy-PsObject',
'ConvertTo-SecureScriptBlock',
'Update-PsObject',
'Get-AstFunction'
'Get-AstFunction',
'Get-ObjectPropertyByPath'
)

# 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.
Expand Down Expand Up @@ -117,10 +118,12 @@ PrivateData = @{
"Microsoft 365 security",
"Azure",
"AzureAD",
"Entra ID security assessment",
"Microsoft Entra",
"CSPM",
"Office 365",
"Office 365 Security"
"Office 365 Security",
"CIS Benchmark"
)

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

}


4 changes: 2 additions & 2 deletions monkey365.psm1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Set-StrictMode -Off #-Version Latest
#Set-StrictMode -Off #-Version Latest
Set-StrictMode -Version Latest

$LocalizedDataParams = @{
Expand Down Expand Up @@ -93,4 +93,4 @@ $all_files = $all_files.Where({$_.EndsWith('ps1')})
$all_files.ForEach({. $_})

$monkey = ("{0}/Invoke-Monkey365.ps1" -f $PSScriptRoot)
. $monkey
. $monkey
3 changes: 2 additions & 1 deletion tests/Get-MonkeyTest.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
# Monkey365 - the PowerShell Cloud Security Tool for Azure and Microsoft 365 (copyright 2022) by Juan Garrido
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,3 +51,4 @@ Function Get-MonkeyTest{
Write-Host "End!"
}
}

4 changes: 2 additions & 2 deletions tests/MonkeyCloudUtils.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PSScriptAnalyzer - ignore test file
# PSScriptAnalyzer - ignore test file
Import-Module Pester
Set-StrictMode -Version Latest

Expand Down Expand Up @@ -94,4 +94,4 @@ Describe 'MonkeyCloudUtils' {
$tinfo.TenantRegionScope | Should -Be "USGov"
}
}
}
}
4 changes: 2 additions & 2 deletions tests/MonkeyJob.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PSScriptAnalyzer - ignore test file
# PSScriptAnalyzer - ignore test file
Import-Module Pester
Set-StrictMode -Version Latest

Expand Down Expand Up @@ -96,4 +96,4 @@ Describe 'MonkeyJob' {
Get-MonkeyJob | Remove-MonkeyJob -Force
}
}
}
}
4 changes: 2 additions & 2 deletions tests/MonkeyWebRequests.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PSScriptAnalyzer - ignore test file
# PSScriptAnalyzer - ignore test file
Import-Module Pester
Set-StrictMode -Version Latest

Expand All @@ -25,4 +25,4 @@ Describe 'Google' {
$StatusCode | Should -Be 'OK'
}
}
}
}
4 changes: 2 additions & 2 deletions tests/MonkeyWebRequestsAPI.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PSScriptAnalyzer - ignore test file
# PSScriptAnalyzer - ignore test file
Import-Module Pester
Set-StrictMode -Version Latest

Expand All @@ -16,4 +16,4 @@ Describe 'Star Wars' {
$Han = Invoke-MonkeyWebRequest -url "https://swapi.dev/api/people/14"
$Han.name | Should -Be 'Han Solo'
}
}
}

0 comments on commit 036059a

Please sign in to comment.