Class: Falcon::DomainBehavior

Inherits:
Object
  • Object
show all
Defined in:
lib/crimson-falcon/models/domain_behavior.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DomainBehavior

Initializes the object

Parameters:

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

    Model attributes in the form of hash


172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
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
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 172

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::DomainBehavior` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Falcon::DomainBehavior`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'aid')
    self.aid = attributes[:'aid']
  end

  if attributes.key?(:'alert_ids')
    if (value = attributes[:'alert_ids']).is_a?(Array)
      self.alert_ids = value
    end
  end

  if attributes.key?(:'behavior_id')
    self.behavior_id = attributes[:'behavior_id']
  end

  if attributes.key?(:'cid')
    self.cid = attributes[:'cid']
  end

  if attributes.key?(:'cmdline')
    self.cmdline = attributes[:'cmdline']
  end

  if attributes.key?(:'compound_tto')
    self.compound_tto = attributes[:'compound_tto']
  end

  if attributes.key?(:'detection_ids')
    if (value = attributes[:'detection_ids']).is_a?(Array)
      self.detection_ids = value
    end
  end

  if attributes.key?(:'display_name')
    self.display_name = attributes[:'display_name']
  end

  if attributes.key?(:'domain')
    self.domain = attributes[:'domain']
  end

  if attributes.key?(:'exclusion_type')
    self.exclusion_type = attributes[:'exclusion_type']
  end

  if attributes.key?(:'filepath')
    self.filepath = attributes[:'filepath']
  end

  if attributes.key?(:'incident_id')
    self.incident_id = attributes[:'incident_id']
  end

  if attributes.key?(:'incident_ids')
    if (value = attributes[:'incident_ids']).is_a?(Array)
      self.incident_ids = value
    end
  end

  if attributes.key?(:'ioc_source')
    self.ioc_source = attributes[:'ioc_source']
  end

  if attributes.key?(:'ioc_type')
    self.ioc_type = attributes[:'ioc_type']
  end

  if attributes.key?(:'ioc_value')
    self.ioc_value = attributes[:'ioc_value']
  end

  if attributes.key?(:'objective')
    self.objective = attributes[:'objective']
  end

  if attributes.key?(:'pattern_disposition')
    self.pattern_disposition = attributes[:'pattern_disposition']
  end

  if attributes.key?(:'pattern_disposition_details')
    self.pattern_disposition_details = attributes[:'pattern_disposition_details']
  end

  if attributes.key?(:'pattern_id')
    self.pattern_id = attributes[:'pattern_id']
  end

  if attributes.key?(:'sha256')
    self.sha256 = attributes[:'sha256']
  end

  if attributes.key?(:'tactic')
    self.tactic = attributes[:'tactic']
  end

  if attributes.key?(:'tactic_id')
    self.tactic_id = attributes[:'tactic_id']
  end

  if attributes.key?(:'technique')
    self.technique = attributes[:'technique']
  end

  if attributes.key?(:'technique_id')
    self.technique_id = attributes[:'technique_id']
  end

  if attributes.key?(:'template_instance_id')
    self.template_instance_id = attributes[:'template_instance_id']
  end

  if attributes.key?(:'timestamp')
    self.timestamp = attributes[:'timestamp']
  end

  if attributes.key?(:'user_name')
    self.user_name = attributes[:'user_name']
  end
end

Instance Attribute Details

#aidObject

Returns the value of attribute aid.


35
36
37
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 35

def aid
  @aid
end

#alert_idsObject

Returns the value of attribute alert_ids.


37
38
39
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 37

def alert_ids
  @alert_ids
end

#behavior_idObject

Returns the value of attribute behavior_id.


39
40
41
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 39

def behavior_id
  @behavior_id
end

#cidObject

Returns the value of attribute cid.


41
42
43
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 41

def cid
  @cid
end

#cmdlineObject

Returns the value of attribute cmdline.


43
44
45
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 43

def cmdline
  @cmdline
end

#compound_ttoObject

Returns the value of attribute compound_tto.


45
46
47
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 45

def compound_tto
  @compound_tto
end

#detection_idsObject

Returns the value of attribute detection_ids.


47
48
49
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 47

def detection_ids
  @detection_ids
end

#display_nameObject

Returns the value of attribute display_name.


49
50
51
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 49

def display_name
  @display_name
end

#domainObject

Returns the value of attribute domain.


51
52
53
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 51

def domain
  @domain
end

#exclusion_typeObject

Returns the value of attribute exclusion_type.


53
54
55
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 53

def exclusion_type
  @exclusion_type
end

#filepathObject

Returns the value of attribute filepath.


55
56
57
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 55

def filepath
  @filepath
end

#incident_idObject

Returns the value of attribute incident_id.


57
58
59
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 57

def incident_id
  @incident_id
end

#incident_idsObject

Returns the value of attribute incident_ids.


59
60
61
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 59

def incident_ids
  @incident_ids
end

#ioc_sourceObject

Returns the value of attribute ioc_source.


61
62
63
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 61

def ioc_source
  @ioc_source
end

#ioc_typeObject

Returns the value of attribute ioc_type.


63
64
65
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 63

def ioc_type
  @ioc_type
end

#ioc_valueObject

Returns the value of attribute ioc_value.


65
66
67
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 65

def ioc_value
  @ioc_value
end

#objectiveObject

Returns the value of attribute objective.


67
68
69
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 67

def objective
  @objective
end

#pattern_dispositionObject

Returns the value of attribute pattern_disposition.


69
70
71
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 69

def pattern_disposition
  @pattern_disposition
end

#pattern_disposition_detailsObject

Returns the value of attribute pattern_disposition_details.


71
72
73
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 71

def pattern_disposition_details
  @pattern_disposition_details
end

#pattern_idObject

Returns the value of attribute pattern_id.


73
74
75
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 73

def pattern_id
  @pattern_id
end

#sha256Object

Returns the value of attribute sha256.


75
76
77
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 75

def sha256
  @sha256
end

#tacticObject

Returns the value of attribute tactic.


77
78
79
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 77

def tactic
  @tactic
end

#tactic_idObject

Returns the value of attribute tactic_id.


79
80
81
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 79

def tactic_id
  @tactic_id
end

#techniqueObject

Returns the value of attribute technique.


81
82
83
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 81

def technique
  @technique
end

#technique_idObject

Returns the value of attribute technique_id.


83
84
85
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 83

def technique_id
  @technique_id
end

#template_instance_idObject

Returns the value of attribute template_instance_id.


85
86
87
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 85

def template_instance_id
  @template_instance_id
end

#timestampObject

Returns the value of attribute timestamp.


87
88
89
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 87

def timestamp
  @timestamp
end

#user_nameObject

Returns the value of attribute user_name.


89
90
91
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 89

def user_name
  @user_name
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about


126
127
128
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 126

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 92

def self.attribute_map
  {
    :'aid' => :'aid',
    :'alert_ids' => :'alert_ids',
    :'behavior_id' => :'behavior_id',
    :'cid' => :'cid',
    :'cmdline' => :'cmdline',
    :'compound_tto' => :'compound_tto',
    :'detection_ids' => :'detection_ids',
    :'display_name' => :'display_name',
    :'domain' => :'domain',
    :'exclusion_type' => :'exclusion_type',
    :'filepath' => :'filepath',
    :'incident_id' => :'incident_id',
    :'incident_ids' => :'incident_ids',
    :'ioc_source' => :'ioc_source',
    :'ioc_type' => :'ioc_type',
    :'ioc_value' => :'ioc_value',
    :'objective' => :'objective',
    :'pattern_disposition' => :'pattern_disposition',
    :'pattern_disposition_details' => :'pattern_disposition_details',
    :'pattern_id' => :'pattern_id',
    :'sha256' => :'sha256',
    :'tactic' => :'tactic',
    :'tactic_id' => :'tactic_id',
    :'technique' => :'technique',
    :'technique_id' => :'technique_id',
    :'template_instance_id' => :'template_instance_id',
    :'timestamp' => :'timestamp',
    :'user_name' => :'user_name'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself


382
383
384
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 382

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true


165
166
167
168
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 165

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.


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
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 131

def self.openapi_types
  {
    :'aid' => :'String',
    :'alert_ids' => :'Array<String>',
    :'behavior_id' => :'String',
    :'cid' => :'String',
    :'cmdline' => :'String',
    :'compound_tto' => :'String',
    :'detection_ids' => :'Array<String>',
    :'display_name' => :'String',
    :'domain' => :'String',
    :'exclusion_type' => :'String',
    :'filepath' => :'String',
    :'incident_id' => :'String',
    :'incident_ids' => :'Array<String>',
    :'ioc_source' => :'String',
    :'ioc_type' => :'String',
    :'ioc_value' => :'String',
    :'objective' => :'String',
    :'pattern_disposition' => :'Integer',
    :'pattern_disposition_details' => :'PatterndispositionPatternDisposition',
    :'pattern_id' => :'Integer',
    :'sha256' => :'String',
    :'tactic' => :'String',
    :'tactic_id' => :'String',
    :'technique' => :'String',
    :'technique_id' => :'String',
    :'template_instance_id' => :'Integer',
    :'timestamp' => :'Time',
    :'user_name' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared


334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 334

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      aid == o.aid &&
      alert_ids == o.alert_ids &&
      behavior_id == o.behavior_id &&
      cid == o.cid &&
      cmdline == o.cmdline &&
      compound_tto == o.compound_tto &&
      detection_ids == o.detection_ids &&
      display_name == o.display_name &&
      domain == o.domain &&
      exclusion_type == o.exclusion_type &&
      filepath == o.filepath &&
      incident_id == o.incident_id &&
      incident_ids == o.incident_ids &&
      ioc_source == o.ioc_source &&
      ioc_type == o.ioc_type &&
      ioc_value == o.ioc_value &&
      objective == o.objective &&
      pattern_disposition == o.pattern_disposition &&
      pattern_disposition_details == o.pattern_disposition_details &&
      pattern_id == o.pattern_id &&
      sha256 == o.sha256 &&
      tactic == o.tactic &&
      tactic_id == o.tactic_id &&
      technique == o.technique &&
      technique_id == o.technique_id &&
      template_instance_id == o.template_instance_id &&
      timestamp == o.timestamp &&
      user_name == o.user_name
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data


413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 413

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Falcon.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash


484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 484

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself


389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 389

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method

369
370
371
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 369

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code


375
376
377
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 375

def hash
  [aid, alert_ids, behavior_id, cid, cmdline, compound_tto, detection_ids, display_name, domain, exclusion_type, filepath, incident_id, incident_ids, ioc_source, ioc_type, ioc_value, objective, pattern_disposition, pattern_disposition_details, pattern_id, sha256, tactic, tactic_id, technique, technique_id, template_instance_id, timestamp, user_name].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons


306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 306

def list_invalid_properties
  invalid_properties = Array.new
  if @pattern_id.nil?
    invalid_properties.push('invalid value for "pattern_id", pattern_id cannot be nil.')
  end

  if @template_instance_id.nil?
    invalid_properties.push('invalid value for "template_instance_id", template_instance_id cannot be nil.')
  end

  if @timestamp.nil?
    invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash


460
461
462
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 460

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash


466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 466

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object


454
455
456
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 454

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid


325
326
327
328
329
330
# File 'lib/crimson-falcon/models/domain_behavior.rb', line 325

def valid?
  return false if @pattern_id.nil?
  return false if @template_instance_id.nil?
  return false if @timestamp.nil?
  true
end