PHP code example of rootshell / cvss-calculator

1. Go to this page and download the library: Download rootshell/cvss-calculator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rootshell / cvss-calculator example snippets


use Rootshell\Cvss\Cvss;
use Rootshell\Cvss\Exceptions\CvssException;

try {
$result = Cvss::generateScores('CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H');
} catch (CvssException $e) {
    return 'Error!';
}

echo $result->baseScore; // 8.0
echo $result->temporalScore; // 8.0
echo $result->environmentalScore; // 8.0