class YAVDB::API

Public Class Methods

download_database(force_update = false, yavdb_path = YAVDB::Constants::DEFAULT_YAVDB_PATH, yavdb_url = YAVDB::Constants::YAVDB_DB_URL, yavdb_branch = YAVDB::Constants::YAVDB_DB_BRANCH) click to toggle source

Download a previously generated database from the official yavdb repository into yavdb_path.

@param force_update [Boolean] force an update of the database if it already exists but is in a previous version. @param yavdb_path [String] the local path to the yavdb repository with the database. @param yavdb_url [String] the yavdb url to clone the database repository from. @param yavdb_branch [String] the yavdb branch with the database.

# File lib/yavdb.rb, line 60
def self.download_database(force_update = false,
  yavdb_path = YAVDB::Constants::DEFAULT_YAVDB_PATH,
  yavdb_url = YAVDB::Constants::YAVDB_DB_URL,
  yavdb_branch = YAVDB::Constants::YAVDB_DB_BRANCH)
  YAVDB::Utils::Git.download_or_update(yavdb_path, yavdb_url, yavdb_branch, force_update)
end
generate_database(database_path = YAVDB::Constants::DEFAULT_GENERATE_DATABASE_PATH) click to toggle source

Crawl several sources and generate a local database in database_path.

@param database_path [String] the local path to the database.

# File lib/yavdb.rb, line 49
def self.generate_database(database_path = YAVDB::Constants::DEFAULT_GENERATE_DATABASE_PATH)
  vulnerabilities = YAVDB::Crawler.vulnerabilities
  YAVDB::Database.save(database_path, vulnerabilities)
end
list_vulnerabilities(package_manager, package_name, database_path = YAVDB::Constants::DEFAULT_YAVDB_PATH) click to toggle source

List vulnerabilities from database_path of package_name for package_manager.

@param package_manager [String] the package manager. @param package_name [String] the package_name. @param database_path [String] the local path to the database. @return [Array<Advisory>] the array of vulnerabilities.

# File lib/yavdb.rb, line 40
def self.list_vulnerabilities(package_manager,
  package_name,
  database_path = YAVDB::Constants::DEFAULT_YAVDB_PATH)
  YAVDB::Database.search(database_path, package_manager, package_name)
end