Created
January 9, 2019 15:04
-
-
Save nsagot/e1a08e87c42d7bc51b11279d28a963f4 to your computer and use it in GitHub Desktop.
Extract info from CPE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Convert CPE URI to Understandable object | |
| * | |
| * @param {string} uri | |
| * @returns {{part: (*|string), vendor: (*|string), product: (*|string), version: (*|string), update: (*|string), edition: (*|string), language: (*|string), sw_edition: (*|string), target_sw: (*|string), target_hw: (*|string), other: (*|string)}} | |
| */ | |
| function cpeUriToObject(uri){ | |
| let CPE23 = new Array(13); | |
| let cpeDetails = uri.split(`:`); | |
| cpeDetails.forEach((item) => CPE23.push(item)); | |
| return { | |
| part: cpeDetails[2], | |
| vendor: cpeDetails[3], | |
| product: cpeDetails[4], | |
| version: cpeDetails[5], // vendor-specific alphanumeric strings characterizing the particular release version of the product | |
| update: cpeDetails[6], // update, service pack, or point release of the product | |
| edition: cpeDetails[7], | |
| language: cpeDetails[8], | |
| sw_edition: cpeDetails[9], // Type of Edition | |
| target_sw: cpeDetails[10], // Software environment | |
| target_hw: cpeDetails[11], // Hardware architecture | |
| other: cpeDetails[12], | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment