Sha256: 28d45a31e70ea13b9b5847ddcd287c34d6cd331be9b87e2f7dc8841ea59a531b
Contents?: true
Size: 883 Bytes
Versions: 1
Compression:
Stored size: 883 Bytes
Contents
# frozen_string_literal: true require 'json' module NoradBeacon class Result # rubocop:disable ParameterLists def initialize(nid, status, output, title, description, sir = 'unevaluated') @nid = nid @sir = cvss_to_sir(sir) @status = status @output = output @title = title @description = description end # rubocop:enable ParameterLists def to_json(*a) { nid: @nid, sir: @sir, status: @status, output: @output, title: @title, description: @description }.to_json(*a) end private def cvss_to_sir(sir) return sir if sir !~ /\A\d+\.?\d*\z/ case sir.to_f when 0.0..3.9 then return 'low' when 4.0..6.9 then return 'medium' when 7.0..8.9 then return 'high' when 9.0..10.0 then return 'critical' else return 'unevaluated' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
norad_beacon-0.1.1 | lib/norad_beacon/result.rb |