osvrp-cvss
v1.0.0
Published
[CVSS 3.0](https://www.first.org/cvss/specification-document) parser, generator, and calculator.
Downloads
2
Readme
osvrp-cvss
CVSS 3.0 parser, generator, and calculator.
API
parseString
import {parseString} from 'osvrp-cvss';
const string = 'CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H';
const fields = parseString(string);
// {
// AV: 'N',
// AC: 'L',
// PR: 'L',
// ...
// }
generateString
import {generateString} from 'osvrp-cvss';
const fields = {
AV: 'N',
AC: 'L',
PR: 'L',
// ...
};
generateString(fields);
// 'CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H'
getScores
import {parseString, getScores} from 'osvrp-cvss';
const string = 'CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H';
const fields = parseString(string);
const scores = getScores(fields);
// {
// BASE: 9.9,
// TEMPORAL: 9.9,
// ENVIRONMENTAL: 9.9,
// }
getSeverityRating
import {parseString, getScores, getSeverityRating} from 'osvrp-cvss';
const string = 'CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H';
const fields = parseString(string);
const scores = getScores(fields);
const baseSeverity = getSeverityRating(scores.BASE);
// CRITICAL
Constants
SCORES
import {SCORES} from 'osvrp-cvss';
SCORES; // ['BASE', 'TEMPORAL', 'ENVIRONMENTAL']
SEVERITY_RATINGS
import {SEVERITY_RATINGS} from 'osvrp-cvss';
SEVERITY_RATINGS; // ['NONE', 'LOW', 'MEDIUM', 'HIGH', 'CRITICAL']
VALID_FIELDS
import {VALID_FIELDS} from 'osvrp-cvss';
VALID_FIELDS; // ['AV', 'AC', 'PR', 'UI', 'S', 'C', ...]
VALID_VALUES
import {VALID_VALUES} from 'osvrp-cvss';
VALID_VALUES; // { AV: ['N', 'A', 'L', 'P'], AC: ['L', 'H'], ...]
REQUIRED_FIELDS
import {REQUIRED_FIELDS} from 'osvrp-cvss';
REQUIRED_FIELDS; // ['AV', 'AC', 'PR', 'UI', 'S', 'C', ...]