@thefaultvault/tfv-cpe-parser
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

tfv-cpe-parser

This library is used to parse cpe (common product enumerations) strings according to NIST standards. It can parse either uri binding cpe values or formatted binding cpe values. The parser will return an object with the corresponding values from the string.

Examples

let cpeParser = new CpeParser();
//'formatted' binding
let cpe = cpeParser.parse(`cpe:2.3:h:f5:big-ip_protocol_security_manager:10.2.3:*:*:*:*:*:*:*`);
/** 
 * cpe => 
 *  {
 *       part: 'h',
 *       vendor: 'f5',
 *       product: 'big-ip protocol security manager',
 *       version: '10.2.3',
 *       update: '*',
 *       edition: '*',
 *       language: '*',
 *       sw_edition: '*',
 *       target_sw: '*',
 *       target_hw: '*',
 *       other: '*' 
 *   }
 * */
//'uri' binding
let cpe = cpeParser.parse(`cpe:/a:search_autocomplete_project:search_autocomplete:7.x-3.0:rc3:~~~drupal~~`);
/** 
 * cpe => 
 *  {
 *       part: 'a',
 *       vendor: 'search autocomplete project',
 *       product: 'search autocomplete',
 *       version: '7.x-3.0',
 *       update: 'rc3',
 *       edition: '*',
 *       language: '*',
 *       sw_edition: '*',
 *       target_sw: 'drupal',
 *       target_hw: '*',
 *       other: '*' 
 *   }
 * */

Default values are returned as asterisks '*' that represent ANY.

NIST Documentation

This library follows the guidelines outline here: https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf

/@thefaultvault/tfv-cpe-parser/

    Package Sidebar

    Install

    npm i @thefaultvault/tfv-cpe-parser

    Weekly Downloads

    213

    Version

    1.3.0

    License

    ISC

    Unpacked Size

    31.4 kB

    Total Files

    21

    Last publish

    Collaborators

    • jonfasking