Skip to content

CPE LibraryCommon Platform Enumeration for Go

A comprehensive Go library for parsing, matching, and managing CPE (Common Platform Enumeration) information

Quick Start

Install the library:

bash
go get github.com/scagogogo/cpe

Parse a CPE string:

go
package main

import (
    "fmt"
    "log"
    "github.com/scagogogo/cpe"
)

func main() {
    // Parse CPE 2.3 format
    cpeObj, err := cpe.ParseCpe23("cpe:2.3:a:microsoft:windows:10:*:*:*:*:*:*:*")
    if err != nil {
        log.Fatal(err)
    }
    
    fmt.Printf("Vendor: %s\n", cpeObj.Vendor)
    fmt.Printf("Product: %s\n", cpeObj.ProductName)
    fmt.Printf("Version: %s\n", cpeObj.Version)
}

Features

🔍 Parsing & Formatting

  • Parse CPE 2.2 and 2.3 format strings
  • Generate CPE strings from structured data
  • Validate CPE format and components

🎯 Matching & Comparison

  • Basic CPE matching with wildcard support
  • Advanced matching with fuzzy logic
  • Version comparison and range matching
  • Regular expression matching

📚 Dictionary Support

  • Parse NVD CPE Dictionary XML
  • Store and retrieve CPE dictionaries
  • Search and filter dictionary entries

🔗 NVD Integration

  • Download and parse NVD CPE feeds
  • Map CPEs to CVE vulnerabilities
  • Automatic data updates and caching

💾 Storage

  • File-based storage with JSON format
  • Memory storage for testing
  • Caching layer for performance
  • Pluggable storage interface

🧮 Set Operations

  • Create and manage CPE sets
  • Union, intersection, and difference operations
  • Filter sets with advanced criteria

Documentation


Last updated: $(date)

Released under the MIT License.