Git Product home page Git Product logo

get_ghsa_tool's Introduction

GHSA IDからCVE情報を取得するツール

概要

任意のリポジトリのSecurity Advisoryから GHSA IDの一覧とAffected version,およびCVE IDが発行されている場合,CVE IDを取得する.

また,CVE IDが存在する場合,NVDからCVSS,およびCWE IDを取得し, 取得した結果をデータベースに保存する.

動作環境

  • Ubuntu 20.04
  • python 3.8.10
  • BeautifulSoup4
  • sqlite3

インストール方法

GitHubからこのリポジトリをcloneする.

git clone https://github.com/siva0410/get_ghsa_tool.git

python3がインストールされていない場合,python3とpip3をインストール(Ubuntuの場合)

sudo apt install python3 python3-pip
python3 --version # インストールできたか確認

BeautifulSoup4がインストールされていない場合,BeautifulSoup4をインストール

pip install BeautifulSoup4

sqlite3がインストールされていない場合,sqlite3をインストール

sudo apt install sqlite3
pip install pysqlite3

使用方法

オプションの説明を参考に下記のコマンドを実行

python3 main.py -u owner_name -r repository_name

オプション一覧

オプション省略説明
必須--owner owner_name-u owner_nameGHSAを調査したいリポジトリの所有者を指定
必須--repository repository_name-r repository_nameGHSAを調査したいリポジトリの名前を指定

データベース

database/repository_name.db ファイルを作成 取得した結果を以下のテーブルに保存

ghsa table

ghsa_idaffected_versioncve_id
TEXTTEXTTEXT

cve table

cve_idcvss_v2cvss_v3cve_description
TEXTREALREALTEXT

cve_cwe table

cve_idcwe_id
TEXTTEXT

cwe table

cwe_idcwe_description
TEXTTEXT

データベースへのアクセス

下記のコマンドを入力

sqlite3 参照したいデータベースのファイル

sqlite3が起動したら,下記のsql文を参考にデータベースへアクセス

sqlの例

  • ghsa idの一覧の取得
select ghsa_id from ghsa;
  • ghsa idの個数の取得
select count(ghsa_id) from ghsa;
  • 全てのデータを取得
select * from ghsa, cve, cve_cwe, cwe natural left outer join cve natural left outer join cve_cwe natural left outer join cwe;

データベースのCSVファイルへの出力

.mode csv
.output output.csv -- 出力したいファイル名
-- csvファイルに出力するsql文
select * from ghsa natural left outer join cve natural left outer join cve_cwe natural left outer join cwe;

LICENSE

MIT License

get_ghsa_tool's People

Contributors

siva0410 avatar

Watchers

James Cloos avatar  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.