CvssSuite for Ruby

This Ruby gem helps you to process the vector of the Common Vulnerability Scoring System.
Besides calculating the Base, Temporal and Environmental Score, you are able to extract the selected option.
[!IMPORTANT]
This project could need some new maintainer(s). I am having less time and motivation to support this gem. Support for v4 was only possible with the help of the community and I am sure I will not implement any v4.x or v5.x support by myself. Since this gem is used in some projects I will not step down without any kind of support. If you are interested in CVSS and ruby, feel free to work on upcoming issues and let me (@Ollirocks) know if you are willing to become a maintainer. As of today there are only a very few issues each year but each new version of CVSS results in quite a lot of work. I am fine with staying the owner of this project until someone is willing to take over completely. I will not vanish from GitHub once and or all :smile: The same applies to the ruby gems account, I am willing to push new versions to rubygems.org until someone trustworthy is found to take over.
Installation
Add this line to your application's Gemfile:
gem 'cvss-suite'
Since the naming of this gem is not following the naming convention you can also add the following line to automatically require the gem:
gem 'cvss-suite', require: 'cvss_suite'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cvss-suite
Version 3.x
If you are still using CvssSuite 3.x please refer to the specific branch for documentation and changelog.
Version 2.x
If you are still using CvssSuite 2.x please refer to the specific branch for documentation and changelog.
Version 1.x
If you are still using CvssSuite 1.x please refer to the specific branch for documentation and changelog.
Usage
require 'cvss_suite'
cvss4 = CvssSuite.new('CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N')
vector = cvss4.vector
version = cvss4.version
valid = cvss4.valid?
severity = cvss4.severity
cvss31 = CvssSuite.new('CVSS:3.1/AV:P/AC:H/PR:L/UI:R/S:U/C:L/I:L/A:H/E:H/RL:U/RC:U')
vector = cvss31.vector
version = cvss31.version
valid = cvss31.valid?
severity = cvss31.severity
cvss3 = CvssSuite.new('CVSS:3.0/AV:L/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L/CR:L/IR:M/AR:H/MAV:N/MAC:H/MPR:N/MUI:R/MS:U/MC:N/MI:L/MA:H')
vector = cvss3.vector
version = cvss3.version
valid = cvss3.valid?
severity = cvss3.severity
cvss = CvssSuite.new('AV:A/AC:M/Au:S/C:P/I:P/A:P/E:POC/RL:TF/RC:UC/CDP:L/TD:M/CR:M/IR:M/AR:M')
vector = cvss.vector
version = cvss.version
valid = cvss.valid?
severity = cvss.severity
score = cvss4.overall_score
base_score = cvss.base_score
temporal_score = cvss.temporal_score
environmental_score = cvss.environmental_score
overall_score = cvss.overall_score
access_vector = cvss.base.access_vector.name
remediation_level = cvss.temporal.remediation_level.name
access_vector.values.each do |value|
value[:name]
value[:abbreviation]
value[:selected]
end
cvss.base.access_vector.selected_value[:name]
cvss.temporal.remediation_level.selected_value[:name]
cvss = CvssSuite.new('random_string')
valid = cvss.valid?
version = cvss.version
cvss.base_score
cvss = CvssSuite.new(1337)
valid = cvss.valid?
version = cvss.version
cvss.base_score
CvssSuite.new()
cvss = CvssSuite.new('AV:N/AC:P/C:P/AV:U/RL:OF/RC:C')
version = cvss.version
valid = cvss.valid?
cvss.base_score
Known Issues
There is a possibility of implementations generating different scores (+/- 0,1) due to small floating-point inaccuracies. This can happen due to differences in floating point arithmetic between different languages and hardware platforms.
Changelog
Click here to see all changes.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/0llirocks/cvss-suite. This project is intended to be a safe, welcoming space for collaboration.
References
CvssSuite for .NET