Giter VIP home page Giter VIP logo

elasticsearch-nvd-river's Introduction

NVD River for ElasticSearch

Welcome to the NVD River Plugin for Elasticsearch. The purpose of this plugin is to read the CVE vulnerability XML feeds of the National Vulnerability Database and push it into ElasticSearch. Another purpose was to learn ElasticSearch and get some hands on experience.

Versions

The plugin code is considered highly experimental and was only tested with Java 7.

Installing

  1. ~/code$ git clone https://github.com/frosenberg/elasticsearch-nvd-river
  2. ~/code$ cd elasticsearch-nvd-river
  3. ~/code/elasticsearch-nvd-river$ mvn clean package (will take a while b/c of some long running tests)
  4. Copy the package from ~/code/elasticsearch-nvd-river/target/release/nvdriver-1.0.0-SNAPSHOT.zip to your ElasticSearch instance
  5. bin/plugin --url file:///path/to/nvdriver-1.0.0-SNAPSHOT.zip --install nvdriver

Usage

You just need to execute a few simple cURL command to feed the data from the NIST NVD database.

Create an index

curl -XPUT 'http://localhost:9200/nvd/' -d '{}'

Create a mapping

Mappings are not needed and currently not supported. I did not see the need in my use case. ElasticSearch has pretty good dynamic mapping generation that was sufficient. If you feel the need to customize the mapping please open an issue or contribute.

Create the river

This will create a river and will push in the following XML feed. You can of course add more if needed, or remove some. Keep in mind this may take some time until all of the are processed.

curl -XPUT 'localhost:9200/_river/nvd/_meta' -d '{
  "type": "nvd",
  "nvd": {
    "streams" : [
      {
        "name": "cve-modified",
        "url": "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-modified.xml"
      },
      {
        "name": "cve-2014",
        "url": "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2014.xml"
      },
      {
        "name": "cve-2013",
        "url": "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2013.xml"
      },
      {
        "name": "cve-2012",
        "url": "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2012.xml"
      },
      {
        "name": "cve-2011",
        "url": "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2011.xml"
      },
      {
        "name": "cve-2010",
        "url": "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-2010.xml"
      }
    ]
  }
}'

Test the river plugin

curl -XGET 'http://localhost:9200/nvd/_search?q=oracle'

Developer Notes

The code contains a lot of generated classes that were generated from the CVE XML schema 2.0 located at [http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd]

Compiling the NVD XML schema files:

The following command will compile the schema into Java JAXB version 2.1 data bindings.

~/code/elasticsearch-nvd-river$ xjc -d src/main/java/ -target 2.1 http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd

We do not use a specific namespace to Java package customization because this will only complicate matters.

elasticsearch-nvd-river's People

Contributors

frosenberg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.