[STIX2] 使用 stix2-validator 驗證 STIX2 JSON 檔案
最近在處理專案中關於 STIX2 的部分,
需要確認產生出來的 STIX2 檔案,是否符合 schema 要求。
驗證方式很簡單,先安裝 stix2-validator:
pip install stix2-validator
接著再把要驗證的檔案傳給 stix2-validator 就行了,例如:
testuser@localhost ~ $ stix2_validator -v stix2.json ================================================================================ [-] Results for: stix2.json [+] STIX JSON: Valid [!] Warning: malware--a821e0b7-3d9f-4ea2-a56a-50d8c8a91212: {216} labels contains a value not in the malware-label-ov vocabulary. [!] Warning: attack-pattern--355be19c-ffc9-46d5-8d50-d6a036c675b6: {302} External reference 'mitre-attack' has a URL but no hash. [!] Warning: attack-pattern--f879d51c-5476-431c-aedf-f14d207e4d1e: {302} External reference 'mitre-attack' has a URL but no hash.
當 schema 正確時,stix2-validator 還會檢查一些細項,
像是 malware 使用了一個沒有定義在 malware-label-ov 裡的類型,
stix2-validator 也會出現警告訊息喔~
(本頁面已被瀏覽過 513 次)