forked from KelvinTegelaar/CIPP-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from KelvinTegelaar/master
[pull] master from KelvinTegelaar:master
- Loading branch information
Showing
56 changed files
with
961 additions
and
644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Modules/CIPPCore/Public/Alerts/Get-CIPPAlertHuntressRogueApps.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function Get-CIPPAlertHuntressRogueApps { | ||
<# | ||
.SYNOPSIS | ||
Check for rogue apps in a Tenant | ||
.DESCRIPTION | ||
This function checks for rogue apps in the tenant by comparing the service principals in the tenant with a list of known rogue apps provided by Huntress. | ||
.FUNCTIONALITY | ||
Entrypoint | ||
.LINK | ||
https://huntresslabs.github.io/rogueapps/ | ||
#> | ||
[CmdletBinding()] | ||
Param ( | ||
[Parameter(Mandatory = $false)] | ||
[Alias('input')] | ||
$InputValue, | ||
$TenantFilter | ||
) | ||
|
||
try { | ||
$RogueApps = Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/huntresslabs/rogueapps/main/public/rogueapps.json' | ||
$RogueAppFilter = $RogueApps.appId -join "','" | ||
$ServicePrincipals = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$filter=appId in ('$RogueAppFilter')" -tenantid $TenantFilter | ||
|
||
if (($ServicePrincipals | Measure-Object).Count -gt 0) { | ||
$AlertData = foreach ($ServicePrincipal in $ServicePrincipals) { | ||
$RogueApp = $RogueApps | Where-Object { $_.appId -eq $ServicePrincipal.appId } | ||
[pscustomobject]@{ | ||
'App Name' = $RogueApp.appDisplayName | ||
'App Id' = $RogueApp.appId | ||
'Description' = $RogueApp.description | ||
'Enabled' = $ServicePrincipal.accountEnabled | ||
'Created' = $ServicePrincipal.createdDateTime | ||
'Tags' = $RogueApp.tags -join ', ' | ||
'References' = $RogueApp.references -join ', ' | ||
'Huntress Added' = $RogueApp.dateAdded | ||
} | ||
} | ||
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData | ||
} | ||
} catch { | ||
#Write-AlertMessage -tenant $($TenantFilter) -message "Failed to check for rogue apps for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)" | ||
} | ||
} |
Oops, something went wrong.