[ ENHANCEMENT ] Enriching information returned by Get-FalconHostGroup #270
DimitrisBinichakis
started this conversation in
Ideas
Replies: 1 comment
-
Most PSFalcon commands are simply API calls, returning whatever data is provided from that particular endpoint. Only a handful of the commands combine multiple endpoints, and they're usually for a specific purpose. The host group listing within the Falcon console is pulling data from multiple different APIs to provide the other information. If I were to update I think this is best solved using a script: param(
[Parameter(Mandatory=$true,ParameterSetName='Id')]
[ValidatePattern('^[a-fA-F0-9]{32}$')]
[string]$Id,
[Parameter(Mandatory=$true,ParameterSetName='Name')]
[string]$Name
)
try {
[object]$Group = if ($Id) {
Get-FalconHostGroup -Id $Id
} else {
Get-FalconHostGroup -Filter "name:['$Name']" -Detailed
}
if (!$Group -and $Id) {
throw "No group found matching id '$Id'."
} elseif (!$Group -and $Name) {
throw "No group found matching '$Name'."
}
$Group.PSObject.Properties.Add((New-Object PSNoteProperty('applied_hosts',
(Get-FalconHostGroupMember -Id $Group.id -Total))))
[System.Collections.Generic.List[object]]$PolicyList = @()
foreach ($Type in @('SensorUpdate','Prevention','Firewall','Response','DeviceControl')) {
@(& "Get-Falcon$($Type)Policy" -Filter "groups:'$($Group.id)'" -Detailed).foreach{
$PolicyList.Add([PSCustomObject]@{
id = $_.id
name = $_.name
status = if ($_.enabled -eq $true) { 'Enabled' } else { 'Disabled' }
type = $Type
platform = $_.platform_name
})
}
}
$Group.PSObject.Properties.Add((New-Object PSNoteProperty('assigned_policies',$PolicyList)))
[object[]]$ExclusionList = @('Ml','Ioa','Sv').foreach{
[PSCustomObject]@{
type = switch ($_) {
'Ml' { 'MachineLearning' }
'Ioa' { 'IndicatorOfAttack' }
'Sv' { 'SensorVisibility' }
}
id = [string[]](@(& "Get-Falcon$($_)Exclusion" -Detailed -All).Where({
$_.groups.id -contains $Group.id })).id
}
}
$Group.PSObject.Properties.Add((New-Object PSNoteProperty('exclusions',$ExclusionList)))
$Group
} catch {
throw $_
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Supplying
Get-FalconHostGroup
with an ID of a group like so:Get-FalconHostGroup -Id c7m99ad98h7AAAAAAAAAA4oiijh9l4ix
returns information for the following fields:
It would be very useful if it also returned the following information that can be found by looking at the host groups tab in the console:
If it is not possible to include these fields in this API call, maybe a new one can be created. It would be really useful to easily extract this information from PSFalcon. One idea would be to have a command that exports all of the groups in a tenant along with the fields described above and outputs the results in a .csv file.
Beta Was this translation helpful? Give feedback.
All reactions