-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f566137
commit bf1b72c
Showing
3 changed files
with
2,999 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import json | ||
|
||
|
||
# Path to your CycloneDX SBOM file | ||
sbom_file_path = 'ssgan.bom' | ||
|
||
|
||
with open(sbom_file_path, 'rb') as sbom_file: | ||
bom = json.load(sbom_file) | ||
|
||
|
||
#print(bom) | ||
# Extract license information | ||
licenses=set() | ||
for y in bom['components']: | ||
if "licenses" in y.keys(): | ||
if 'license' in y['licenses'][0].keys(): | ||
if 'id' in y["licenses"][0]["license"].keys(): | ||
licenses.add(y["licenses"][0]["license"]["id"]) | ||
#licenses.add(y["licenses"]["license"]["name"]) | ||
elif 'name' in y["licenses"][0]["license"].keys(): | ||
licenses.add(y["licenses"][0]["license"]["name"]) | ||
|
||
|
||
|
||
#lol=[[licenses.add(x['license']['text']) for x in y['licenses']] ] | ||
for i,lic in enumerate(licenses): | ||
print('\n License No',i,'and Name is',lic) |
Oops, something went wrong.