Class: Falcon::IocsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/api/iocs_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ IocsApi

Returns a new instance of IocsApi.


36
37
38
# File 'lib/crimson-falcon/api/iocs_api.rb', line 36

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.


34
35
36
# File 'lib/crimson-falcon/api/iocs_api.rb', line 34

def api_client
  @api_client
end

Instance Method Details

#devices_count(type, value, opts = {}) ⇒ IocapiMsaReplyIOCDevicesCount

Number of hosts in your customer account that have observed a given custom IOC

Parameters:

  • type (String)

    The type of the indicator. Valid types include: sha256: A hex-encoded sha256 hash string. Length - min: 64, max: 64. md5: A hex-encoded md5 hash string. Length - min 32, max: 32. domain: A domain name. Length - min: 1, max: 200. ipv4: An IPv4 address. Must be a valid IP address. ipv6: An IPv6 address. Must be a valid IP address.

  • value (String)

    The string representation of the indicator

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:


44
45
46
47
# File 'lib/crimson-falcon/api/iocs_api.rb', line 44

def devices_count(type, value, opts = {})
  data, _status_code, _headers = devices_count_with_http_info(type, value, opts)
  data
end

#devices_count_with_http_info(type, value, opts = {}) ⇒ Array<(IocapiMsaReplyIOCDevicesCount, Integer, Hash)>

Number of hosts in your customer account that have observed a given custom IOC

Parameters:

  • type (String)

    The type of the indicator. Valid types include: sha256: A hex-encoded sha256 hash string. Length - min: 64, max: 64. md5: A hex-encoded md5 hash string. Length - min 32, max: 32. domain: A domain name. Length - min: 1, max: 200. ipv4: An IPv4 address. Must be a valid IP address. ipv6: An IPv6 address. Must be a valid IP address.

  • value (String)

    The string representation of the indicator

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/crimson-falcon/api/iocs_api.rb', line 54

def devices_count_with_http_info(type, value, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IocsApi.devices_count ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling IocsApi.devices_count"
  end
  # verify the required parameter 'value' is set
  if @api_client.config.client_side_validation && value.nil?
    fail ArgumentError, "Missing the required parameter 'value' when calling IocsApi.devices_count"
  end
  # resource path
  local_var_path = '/indicators/aggregates/devices-count/v1'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'type'] = type
  query_params[:'value'] = value

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'IocapiMsaReplyIOCDevicesCount'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"IocsApi.devices_count",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IocsApi#devices_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#devices_ran_on(type, value, opts = {}) ⇒ IocapiMsaReplyDevicesRanOn

Find hosts that have observed a given custom IOC. For details about those hosts, use GET /devices/entities/devices/v1

Parameters:

  • type (String)

    The type of the indicator. Valid types include: sha256: A hex-encoded sha256 hash string. Length - min: 64, max: 64. md5: A hex-encoded md5 hash string. Length - min 32, max: 32. domain: A domain name. Length - min: 1, max: 200. ipv4: An IPv4 address. Must be a valid IP address. ipv6: An IPv6 address. Must be a valid IP address.

  • value (String)

    The string representation of the indicator

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (String)

    The first process to return, where 0 is the latest offset. Use with the offset parameter to manage pagination of results.

  • :offset (String)

    The first process to return, where 0 is the latest offset. Use with the limit parameter to manage pagination of results.

Returns:


115
116
117
118
# File 'lib/crimson-falcon/api/iocs_api.rb', line 115

def devices_ran_on(type, value, opts = {})
  data, _status_code, _headers = devices_ran_on_with_http_info(type, value, opts)
  data
end

#devices_ran_on_with_http_info(type, value, opts = {}) ⇒ Array<(IocapiMsaReplyDevicesRanOn, Integer, Hash)>

Find hosts that have observed a given custom IOC. For details about those hosts, use GET /devices/entities/devices/v1

Parameters:

  • type (String)

    The type of the indicator. Valid types include: sha256: A hex-encoded sha256 hash string. Length - min: 64, max: 64. md5: A hex-encoded md5 hash string. Length - min 32, max: 32. domain: A domain name. Length - min: 1, max: 200. ipv4: An IPv4 address. Must be a valid IP address. ipv6: An IPv6 address. Must be a valid IP address.

  • value (String)

    The string representation of the indicator

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (String)

    The first process to return, where 0 is the latest offset. Use with the offset parameter to manage pagination of results.

  • :offset (String)

    The first process to return, where 0 is the latest offset. Use with the limit parameter to manage pagination of results.

Returns:

  • (Array<(IocapiMsaReplyDevicesRanOn, Integer, Hash)>)

    IocapiMsaReplyDevicesRanOn data, response status code and response headers


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/crimson-falcon/api/iocs_api.rb', line 127

def devices_ran_on_with_http_info(type, value, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IocsApi.devices_ran_on ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling IocsApi.devices_ran_on"
  end
  # verify the required parameter 'value' is set
  if @api_client.config.client_side_validation && value.nil?
    fail ArgumentError, "Missing the required parameter 'value' when calling IocsApi.devices_ran_on"
  end
  # resource path
  local_var_path = '/indicators/queries/devices/v1'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'type'] = type
  query_params[:'value'] = value
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'IocapiMsaReplyDevicesRanOn'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"IocsApi.devices_ran_on",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IocsApi#devices_ran_on\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#entities_processes(ids, opts = {}) ⇒ ProcessesapiMsaProcessDetailResponse

For the provided ProcessID retrieve the process details

Parameters:

  • ids (Array<String>)

    ProcessID for the running process you want to lookup

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:


187
188
189
190
# File 'lib/crimson-falcon/api/iocs_api.rb', line 187

def entities_processes(ids, opts = {})
  data, _status_code, _headers = entities_processes_with_http_info(ids, opts)
  data
end

#entities_processes_with_http_info(ids, opts = {}) ⇒ Array<(ProcessesapiMsaProcessDetailResponse, Integer, Hash)>

For the provided ProcessID retrieve the process details

Parameters:

  • ids (Array<String>)

    ProcessID for the running process you want to lookup

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:


196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/crimson-falcon/api/iocs_api.rb', line 196

def entities_processes_with_http_info(ids, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IocsApi.entities_processes ...'
  end
  # verify the required parameter 'ids' is set
  if @api_client.config.client_side_validation && ids.nil?
    fail ArgumentError, "Missing the required parameter 'ids' when calling IocsApi.entities_processes"
  end
  # resource path
  local_var_path = '/processes/entities/processes/v1'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'ids'] = @api_client.build_collection_param(ids, :multi)

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ProcessesapiMsaProcessDetailResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"IocsApi.entities_processes",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IocsApi#entities_processes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#processes_ran_on(type, value, device_id, opts = {}) ⇒ IocapiMsaReplyProcessesRanOn

Search for processes associated with a custom IOC

Parameters:

  • type (String)

    The type of the indicator. Valid types include: sha256: A hex-encoded sha256 hash string. Length - min: 64, max: 64. md5: A hex-encoded md5 hash string. Length - min 32, max: 32. domain: A domain name. Length - min: 1, max: 200. ipv4: An IPv4 address. Must be a valid IP address. ipv6: An IPv6 address. Must be a valid IP address.

  • value (String)

    The string representation of the indicator

  • device_id (String)

    Specify a host&#39;s ID to return only processes from that host. Get a host&#39;s ID from GET /devices/queries/devices/v1, the Falcon console, or the Streaming API.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (String)

    The first process to return, where 0 is the latest offset. Use with the offset parameter to manage pagination of results.

  • :offset (String)

    The first process to return, where 0 is the latest offset. Use with the limit parameter to manage pagination of results.

Returns:


253
254
255
256
# File 'lib/crimson-falcon/api/iocs_api.rb', line 253

def processes_ran_on(type, value, device_id, opts = {})
  data, _status_code, _headers = processes_ran_on_with_http_info(type, value, device_id, opts)
  data
end

#processes_ran_on_with_http_info(type, value, device_id, opts = {}) ⇒ Array<(IocapiMsaReplyProcessesRanOn, Integer, Hash)>

Search for processes associated with a custom IOC

Parameters:

  • type (String)

    The type of the indicator. Valid types include: sha256: A hex-encoded sha256 hash string. Length - min: 64, max: 64. md5: A hex-encoded md5 hash string. Length - min 32, max: 32. domain: A domain name. Length - min: 1, max: 200. ipv4: An IPv4 address. Must be a valid IP address. ipv6: An IPv6 address. Must be a valid IP address.

  • value (String)

    The string representation of the indicator

  • device_id (String)

    Specify a host&#39;s ID to return only processes from that host. Get a host&#39;s ID from GET /devices/queries/devices/v1, the Falcon console, or the Streaming API.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (String)

    The first process to return, where 0 is the latest offset. Use with the offset parameter to manage pagination of results.

  • :offset (String)

    The first process to return, where 0 is the latest offset. Use with the limit parameter to manage pagination of results.

Returns:


266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/crimson-falcon/api/iocs_api.rb', line 266

def processes_ran_on_with_http_info(type, value, device_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: IocsApi.processes_ran_on ...'
  end
  # verify the required parameter 'type' is set
  if @api_client.config.client_side_validation && type.nil?
    fail ArgumentError, "Missing the required parameter 'type' when calling IocsApi.processes_ran_on"
  end
  # verify the required parameter 'value' is set
  if @api_client.config.client_side_validation && value.nil?
    fail ArgumentError, "Missing the required parameter 'value' when calling IocsApi.processes_ran_on"
  end
  # verify the required parameter 'device_id' is set
  if @api_client.config.client_side_validation && device_id.nil?
    fail ArgumentError, "Missing the required parameter 'device_id' when calling IocsApi.processes_ran_on"
  end
  # resource path
  local_var_path = '/indicators/queries/processes/v1'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'type'] = type
  query_params[:'value'] = value
  query_params[:'device_id'] = device_id
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'IocapiMsaReplyProcessesRanOn'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"IocsApi.processes_ran_on",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: IocsApi#processes_ran_on\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end