forked from Cephalowat/PSFalcon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-CsIndicatorInfo.psm1
77 lines (66 loc) · 2.18 KB
/
Get-CsIndicatorInfo.psm1
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
function Get-CsIndicatorInfo {
<#
.SYNOPSIS
Retrieve info about specific indicators
.PARAMETER DELETED
If $true, include both published and deleted indicators in the response [default: $false]
.PARAMETER FILTER
Filter your query by specifying FQL filter parameters
.PARAMETER QUERY
Perform a generic substring search across all fields
.PARAMETER LIMIT
The maximum records to return [default: 50000]
.PARAMETER OFFSET
The offset to start retrieving records from [default: 0]
.PARAMETER ID
IDs of specific indicators to return
#>
[CmdletBinding(DefaultParameterSetName = 'combined')]
[OutputType([psobject])]
param(
[Parameter(ParameterSetName = 'combined')]
[boolean]
$Deleted = $false,
[Parameter(ParameterSetName = 'combined')]
[string]
$Filter,
[Parameter(ParameterSetName = 'combined')]
[string]
$Query,
[Parameter(ParameterSetName = 'combined')]
[ValidateRange(1,50000)]
[int]
$Limit = 50000,
[Parameter(ParameterSetName = 'combined')]
[int]
$Offset = 0,
[Parameter(ParameterSetName = 'entities', Mandatory = $true)]
[array]
$Id
)
begin{
if ($Filter) { Add-Type -AssemblyName System.Web }
}
process{
$Param = @{
Uri = '/intel/combined/indicators/v1?limit=' + [string] $Limit + '&offset=' + [string] $Offset +
'&include_deleted=' + $Deleted
Method = 'get'
Header = @{
accept = 'application/json'
'content-type' = 'application/json'
}
}
switch ($PSBoundParameters.Keys) {
'Filter' { $Param.Uri += '&filter=' + [System.Web.HTTPUtility]::UrlEncode($Filter) }
'Query' { $Param.Uri += '&q=' + $Query }
'Id' {
$Param.Uri = '/intel/entities/indicators/GET/v1'
$Param['Body'] = @{ ids = $Id } | ConvertTo-Json
}
'Verbose' { $Param['Verbose'] = $true }
'Debug' { $Param['Debug'] = $true }
}
Invoke-CsAPI @Param
}
}