Class: Falcon::FigapiIndicator

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FigapiIndicator

Initializes the object

Parameters:

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

    Model attributes in the form of hash



160
161
162
163
164
165
166
167
168
169
170
171
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
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 160

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Falcon::FigapiIndicator` 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::FigapiIndicator`. 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?(:'adversaries')
    if (value = attributes[:'adversaries']).is_a?(Array)
      self.adversaries = value
    end
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#adversariesObject

Returns the value of attribute adversaries.



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

def adversaries
  @adversaries
end

#affected_customersObject

Total range of customers affected by this indicator



38
39
40
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 38

def affected_customers
  @affected_customers
end

#certificatesObject

Returns the value of attribute certificates.



40
41
42
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 40

def certificates
  @certificates
end

#countriesObject

Returns the value of attribute countries.



42
43
44
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 42

def countries
  @countries
end

#domain_detailsObject

Returns the value of attribute domain_details.



44
45
46
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 44

def domain_details
  @domain_details
end

#file_detailsObject

Returns the value of attribute file_details.



46
47
48
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 46

def file_details
  @file_details
end

#first_seenObject

Indicators first seen



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

def first_seen
  @first_seen
end

#idObject

The indicator ID. Concatenation of type and indicator fields. Based on the CKB2 vertex ID.



52
53
54
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 52

def id
  @id
end

#ipv4_detailsObject

Returns the value of attribute ipv4_details.



54
55
56
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 54

def ipv4_details
  @ipv4_details
end

#ipv6_detailsObject

Returns the value of attribute ipv6_details.



56
57
58
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 56

def ipv6_details
  @ipv6_details
end

#kill_chainObject

Multi field property describing indicators kill-chain, possible properties: ActionOnObjectives, C2, Delivery, Exploitation, Installation, Reconnaissance, Weaponization



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

def kill_chain
  @kill_chain
end

#last_seenObject

Indicators last seen



62
63
64
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 62

def last_seen
  @last_seen
end

#last_updatedObject

Returns the value of attribute last_updated.



64
65
66
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 64

def last_updated
  @last_updated
end

#malicious_confidenceObject

Indicates a confidence level by which an indicator is considered to be malicious, this can be one of: Low, Medium, High



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

def malicious_confidence
  @malicious_confidence
end

#malicious_confidence_validated_timeObject

Indicates when was the confidence was last set



70
71
72
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 70

def malicious_confidence_validated_time
  @malicious_confidence_validated_time
end

#publish_dateObject

Returns the value of attribute publish_date.



72
73
74
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 72

def publish_date
  @publish_date
end

#reportsObject

Returns the value of attribute reports.



74
75
76
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 74

def reports
  @reports
end

#sectorsObject

Returns the value of attribute sectors.



76
77
78
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 76

def sectors
  @sectors
end

#threat_typesObject

Returns the value of attribute threat_types.



78
79
80
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 78

def threat_types
  @threat_types
end

#threatsObject

Returns the value of attribute threats.



80
81
82
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 80

def threats
  @threats
end

#typeObject

Type of the indicator, this can be one of: File, Domain, IPv4, IPv6, URL



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

def type
  @type
end

#url_detailsObject

Returns the value of attribute url_details.



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

def url_details
  @url_details
end

#vulnerabilitiesObject

Returns the value of attribute vulnerabilities.



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

def vulnerabilities
  @vulnerabilities
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



119
120
121
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 119

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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

def self.attribute_map
  {
    :'adversaries' => :'Adversaries',
    :'affected_customers' => :'AffectedCustomers',
    :'certificates' => :'Certificates',
    :'countries' => :'Countries',
    :'domain_details' => :'DomainDetails',
    :'file_details' => :'FileDetails',
    :'first_seen' => :'FirstSeen',
    :'id' => :'ID',
    :'ipv4_details' => :'IPv4Details',
    :'ipv6_details' => :'IPv6Details',
    :'kill_chain' => :'KillChain',
    :'last_seen' => :'LastSeen',
    :'last_updated' => :'LastUpdated',
    :'malicious_confidence' => :'MaliciousConfidence',
    :'malicious_confidence_validated_time' => :'MaliciousConfidenceValidatedTime',
    :'publish_date' => :'PublishDate',
    :'reports' => :'Reports',
    :'sectors' => :'Sectors',
    :'threat_types' => :'ThreatTypes',
    :'threats' => :'Threats',
    :'type' => :'Type',
    :'url_details' => :'URLDetails',
    :'vulnerabilities' => :'Vulnerabilities'
  }
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



342
343
344
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 342

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

.openapi_nullableObject

List of attributes with nullable: true



153
154
155
156
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 153

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

.openapi_typesObject

Attribute type mapping.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 124

def self.openapi_types
  {
    :'adversaries' => :'Array<FigapiAdversary>',
    :'affected_customers' => :'String',
    :'certificates' => :'Array<FigapiX509Certificate>',
    :'countries' => :'Array<FigapiCountry>',
    :'domain_details' => :'FigapiDomain',
    :'file_details' => :'FigapiFile',
    :'first_seen' => :'String',
    :'id' => :'String',
    :'ipv4_details' => :'FigapiIPv4',
    :'ipv6_details' => :'FigapiIPv6',
    :'kill_chain' => :'Array<String>',
    :'last_seen' => :'String',
    :'last_updated' => :'String',
    :'malicious_confidence' => :'String',
    :'malicious_confidence_validated_time' => :'String',
    :'publish_date' => :'String',
    :'reports' => :'Array<FigapiReport>',
    :'sectors' => :'Array<FigapiSector>',
    :'threat_types' => :'Array<String>',
    :'threats' => :'Array<FigapiThreat>',
    :'type' => :'String',
    :'url_details' => :'FigapiURL',
    :'vulnerabilities' => :'Array<FigapiVulnerability>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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/models/figapi_indicator.rb', line 299

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      adversaries == o.adversaries &&
      affected_customers == o.affected_customers &&
      certificates == o.certificates &&
      countries == o.countries &&
      domain_details == o.domain_details &&
      file_details == o.file_details &&
      first_seen == o.first_seen &&
      id == o.id &&
      ipv4_details == o.ipv4_details &&
      ipv6_details == o.ipv6_details &&
      kill_chain == o.kill_chain &&
      last_seen == o.last_seen &&
      last_updated == o.last_updated &&
      malicious_confidence == o.malicious_confidence &&
      malicious_confidence_validated_time == o.malicious_confidence_validated_time &&
      publish_date == o.publish_date &&
      reports == o.reports &&
      sectors == o.sectors &&
      threat_types == o.threat_types &&
      threats == o.threats &&
      type == o.type &&
      url_details == o.url_details &&
      vulnerabilities == o.vulnerabilities
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



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 373

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



444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 444

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



349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 349

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


329
330
331
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 329

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



335
336
337
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 335

def hash
  [adversaries, affected_customers, certificates, countries, domain_details, file_details, first_seen, id, ipv4_details, ipv6_details, kill_chain, last_seen, last_updated, malicious_confidence, malicious_confidence_validated_time, publish_date, reports, sectors, threat_types, threats, type, url_details, vulnerabilities].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



286
287
288
289
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 286

def list_invalid_properties
  invalid_properties = Array.new
  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



420
421
422
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 420

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



426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 426

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



414
415
416
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 414

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



293
294
295
# File 'lib/crimson-falcon/models/figapi_indicator.rb', line 293

def valid?
  true
end