
DataSurgeon用プラグインで、テキストからCVE番号を抽出します(例: CVE-2021-56789)
DataSurgeon 用のプラグインで、テキストから CVE 番号を抽出します(例: CVE-2021-56789)
Windows ユーザーの場合、プラグインファイルは C:\ds\ ディレクトリにあります。Linux の場合は、~/.DataSurgeon/plugins.json にプラグインファイルがあります。もしどちらのディレクトリにもプラグインファイルが見つからない場合は、カレントワーキングディレクトリを自動的に確認します。
json オブジェクトのすべてのフィールドが重要です。プラグインが DataSurgeon の --add および --remove オプションとシームレスに動作するように、plugins.json ファイルを GitHub リポジトリにアップロードすることを忘れないでください。ファイル名は plugins.json のままにし、アップロードしたいプラグインオプションだけを含めてください。各フィールドの簡単なガイドは次のとおりです。
以下は例です。
[
{
"content_type": "windows_registry",
"arg_long_name": "winregistry",
"version": "1.0.0",
"help_message": "Extracts windows registry paths",
"regex": "^(HKEY_(?:LOCAL_MACHINE|CURRENT_USER|CLASSES_ROOT|CURRENT_CONFIG|USERS)\\\\[\\w\\-\\.\\\\]*)",
"source_url": "https://github.com/DataSurgeon-ds/ds-cve-plugin/"
}
]
プラグインファイルが読み込まれると、オプションが追加の引数として追加されます。ご覧のとおり、引数の名前は arg_long_name です。
drew@DESKTOP-A5AO3TO$ ds -h
Options:
......
-a, --aws Extract AWS keys
--cve Extracts CVE Identifiers
-V, --version Print version
実行例は次のとおりです。
┌──(drew㉿IT-DREW)-[~]
└─$ ds --cve -f cves.txt
cve: The first one is CVE-2023-1234. This is a hypothetical vulnerability that was supposedly discovered in 2023.
cve: Here's another one: CVE-2021-56789. This one was supposedly discovered in 2021.
cve: And here's a third one: CVE-2020-1234567. This one was supposedly discovered in 2020.
cve: But not all strings that look like CVE identifiers are actual CVE identifiers. For example, CVE-23-1234 is not a valid identifier because the year part only has two digits. Similarly, CVE-2023-123 is not valid because the identifier part only has three digits. And CVE-2023-12345678 is not valid because the identifier part has eight digits, which is too many.
cve: Finally, note that not all CVE identifiers are associated with actual vulnerabilities. For example, CVE-2023-9999 might not be associated with any known vulnerability. To check if a CVE identifier is real, you would need to look it up in a CVE database.
┌──(drew㉿IT-DREW)-[~]
└─$ ds --cve -f cves.txt --clean
cve: CVE-2023-1234
cve: CVE-2021-56789
cve: CVE-2020-1234567
cve: CVE-2023-1234567
cve: CVE-2023-9999
新しいプラグインを追加するには、--add <URL> オプションを使用する必要があります。URL は、plugins.json ファイルをホストしているリモートの GitHub リポジトリである必要があります。新しいプラグインの使用方法。
drew@DESKTOP-A5AO3TO:~$ ds --add https://github.com/DataSurgeon-ds/ds-cve-plugin/
[*] Download and added plugin: https://github.com/DataSurgeon-ds/ds-cve-plugin/
すべてのプラグインを一覧表示するには、--list オプションを使用できます。
drew@DESKTOP-A5AO3TO$ ds --list
Plugin File: /home/drew/.DataSurgeon/plugins.json
Source URL | Argument Long Name
https://raw.githubusercontent.com/DataSurgeon-ds/ds-cve-plugin | cve
不要になったプラグインを削除するには、--remove オプションを使用できます。
drew@DESKTOP-A5AO3TO:~$ ds --remove https://github.com/DataSurgeon-ds/ds-cve-plugin//
[*] Removed plugin: https://github.com/DataSurgeon-ds/ds-cve-plugin//
| フィールド | 説明 |
|---|
| content_type | これは、検索対象のコンテンツを一言で表す説明です(スペースなし)。マッチしたコンテンツと一緒に表示される単語です。 |
| arg_long_name | これはコマンドラインインターフェースの一意の引数名です。すべてのプラグイン間で一意である必要があります。 |
| help_message | これは、プラグインが何を行うかの簡潔で分かりやすい説明です。ツールのヘルプメッセージに表示されます。 |
| version | これはプラグインのバージョン番号です(例: 1.0.0) |
| regex | これは、コンテンツのマッチングに使用される正規表現です。--clean オプションとの互換性を確保するには、マッチ全体 ($0) に目的のコンテンツが正確に含まれるように正規表現を設計してください。これにより、--clean オプションは関連するマッチしたコンテンツのみを抽出できます。正規表現パターンをテストするには、https://regexr.com/ の使用をお勧めします。 |
| source_url | これは、プラグインをホストしている GitHub リポジトリの URL です。 |