Class: CVESchema::CVE::Impact::CVSSv3::EM

Inherits:
Object
  • Object
show all
Defined in:
lib/cve_schema/cve/impact/cvss_v3.rb

Constant Summary collapse

CR =
{'X' => :X, 'H' => :H, 'M' => :M, 'L' => :L}
IR =
{'X' => :X, 'H' => :H, 'M' => :M, 'L' => :L}
AR =
{'X' => :X, 'H' => :H, 'M' => :M, 'L' => :L}
MAV =
{'N' => :N, 'A' => :A, 'L' => :L, 'P' => :P}
MAC =
{'L' => :L, 'H' => :H}
MPR =
{'N' => :N, 'L' => :L, 'H' => :H}
MUI =
{'N' => :N, 'R' => :R}
MS =
{'U' => :S, 'C' => :C}
MC =
{'H' => :H, 'L' => :L, 'N' => :N}
MI =
{'H' => :H, 'L' => :L, 'N' => :N}
MA =
{'H' => :H, 'L' => :L, 'N' => :N}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cr: nil, ir: nil, ar: nil, mav: nil, mac: nil, mpr: nil, mui: nil, ms: nil, mc: nil, mi: nil, ma: nil) ⇒ EM

Initializes the EM object.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 282

def initialize(cr: nil, ir: nil, ar: nil, mav: nil, mac: nil,
               mpr: nil, mui: nil, ms: nil, mc: nil, mi: nil, ma: nil)
  @cr  = cr
  @ir  = ir
  @ar  = ar
  @mav = mav
  @mac = mac
  @mpr = mpr
  @mui = mui
  @ms  = ms
  @mc  = mc
  @mi  = mi
  @ma  = ma
end

Instance Attribute Details

#ar:X, ... (readonly)

Security Requirements Availability.

Returns:

  • (:X, :H, :M, :L)


221
222
223
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 221

def ar
  @ar
end

#cr:X, ... (readonly)

Security Requirements Confidentiality.

Returns:

  • (:X, :H, :M, :L)


207
208
209
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 207

def cr
  @cr
end

#ir:X, ... (readonly)

Security Requirements Integrity.

Returns:

  • (:X, :H, :M, :L)


214
215
216
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 214

def ir
  @ir
end

#ma:H, ... (readonly)

The Modified Availability Impact.

Returns:

  • (:H, :L, :N)


277
278
279
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 277

def ma
  @ma
end

#mac:L, :H (readonly)

The Modified Attack Complexity.

Returns:

  • (:L, :H)


235
236
237
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 235

def mac
  @mac
end

#mav:N, ... (readonly)

The Modified Attack Vector.

Returns:

  • (:N, :A, :L, :P)


228
229
230
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 228

def mav
  @mav
end

#mc:H, ... (readonly)

The Modified Confidentiality Impact.

Returns:

  • (:H, :L, :N)


263
264
265
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 263

def mc
  @mc
end

#mi:H, ... (readonly)

The Modified Integrity Impact.

Returns:

  • (:H, :L, :N)


270
271
272
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 270

def mi
  @mi
end

#mpr:N, ... (readonly)

The Modified Privileges Required.

Returns:

  • (:N, :L, :H)


242
243
244
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 242

def mpr
  @mpr
end

#ms:U, :C (readonly)

The Modified Scope.

Returns:

  • (:U, :C)


256
257
258
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 256

def ms
  @ms
end

#mui:N, :R (readonly)

The Modified User Interaction.

Returns:

  • (:N, :R)


249
250
251
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 249

def mui
  @mui
end

Class Method Details

.from_json(json) ⇒ Hash{Symbol => Object}

Maps the parsed JSON to a Symbol Hash for #initialize.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (Hash{Symbol => Object})

    The mapped Symbol Hash.



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 306

def self.from_json(json)
  {
    cr:  CR[json['CR']],
    ir:  IR[json['IR']],
    ar:  AR[json['AR']],
    mav: MAV[json['MAV']],
    mac: MAC[json['MAC']],
    mpr: MPR[json['MPR']],
    mui: MUI[json['MUI']],
    ms:  MS[json['MS']],
    mc:  MC[json['MC']],
    mi:  MI[json['MI']],
    ma:  MA[json['MA']]
  }
end

.load(json) ⇒ EM

Loads the EM object from the parsed JSON.

Parameters:

  • json (Hash{String => Object})

    The parsed JSON.

Returns:

  • (EM)

    The loaded EM object.



331
332
333
# File 'lib/cve_schema/cve/impact/cvss_v3.rb', line 331

def self.load(json)
  new(**from_json(json))
end