-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from willyw0nka/add-dataclasses
Multiple improvements
- Loading branch information
Showing
27 changed files
with
321 additions
and
31 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
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 @@ | ||
from .grype import Grype |
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,15 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class GrypeVersion: | ||
version: str | ||
syft_version: str | ||
git_commit: str | ||
git_description: str | ||
build_date: str | ||
go_version: str | ||
compiler: str | ||
platform: str | ||
application: str | ||
supported_db_schema: int |
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,9 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class DBMetaData: | ||
built: str | ||
version: int | ||
url: str | ||
checksum: str |
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,19 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
from pygrype.core.scan.location import Location | ||
from pygrype.core.scan.upstream import Upstream | ||
|
||
|
||
@dataclass | ||
class Artifact: | ||
id: str | ||
name: str | ||
version: str | ||
type: str | ||
locations: List[Location] | ||
language: str | ||
licenses: List[str] | ||
cpes: List[str] | ||
purl: str | ||
upstreams: List[Upstream] |
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,13 @@ | ||
from dataclasses import dataclass | ||
from typing import Optional | ||
|
||
from pygrype.core.scan.cvss_metrics import CVSSMetrics | ||
|
||
|
||
@dataclass | ||
class CVSS: | ||
source: Optional[str] | ||
type: Optional[str] | ||
version: str | ||
vector: str | ||
metrics: CVSSMetrics |
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,8 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class CVSSMetrics: | ||
baseScore: float | ||
exploitabilityScore: float | ||
impactScore: float |
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,9 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
|
||
@dataclass | ||
class Distro: | ||
name: str | ||
version: str | ||
idLike: List |
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,8 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Layer: | ||
mediaType: str | ||
digest: str | ||
size: int |
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,7 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Location: | ||
path: str | ||
layerID: str |
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,14 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
from pygrype.core.scan.artifact import Artifact | ||
from pygrype.core.scan.match_details import MatchDetails | ||
from pygrype.core.scan.vulnerability import Vulnerability | ||
|
||
|
||
@dataclass | ||
class Match: | ||
vulnerability: Vulnerability | ||
relatedVulnerabilities: List[Vulnerability] | ||
matchDetails: List[MatchDetails] | ||
artifact: Artifact |
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,12 @@ | ||
from dataclasses import dataclass | ||
|
||
from pygrype.core.scan.match_details_found import MatchDetailsFound | ||
from pygrype.core.scan.match_details_searched_by import MatchDetailsSearchedBy | ||
|
||
|
||
@dataclass | ||
class MatchDetails: | ||
type: str | ||
matcher: str | ||
searchedBy: MatchDetailsSearchedBy | ||
found: MatchDetailsFound |
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,9 @@ | ||
from dataclasses import dataclass | ||
from typing import List, Optional | ||
|
||
|
||
@dataclass | ||
class MatchDetailsFound: | ||
vulnerabilityID: str | ||
versionConstraint: str | ||
cpes: Optional[List[str]] |
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,13 @@ | ||
from dataclasses import dataclass | ||
from typing import List, Optional | ||
|
||
from pygrype.core.scan.package import Package | ||
from pygrype.core.scan.searched_by_distro import Distro | ||
|
||
|
||
@dataclass | ||
class MatchDetailsSearchedBy: | ||
namespace: str | ||
cpes: Optional[List[str]] | ||
Package: Optional[Package] | ||
distro: Optional[Distro] |
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,7 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Package: | ||
name: str | ||
version: str |
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,14 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
from pygrype.core.scan.distro import Distro | ||
from pygrype.core.scan.match import Match | ||
from pygrype.core.scan.scan_source import ScanSource | ||
|
||
|
||
@dataclass | ||
class Scan: | ||
matches: List[Match] | ||
source: ScanSource | ||
distro: Distro | ||
# descriptor: GrypeScanDescriptor |
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,9 @@ | ||
from dataclasses import dataclass | ||
|
||
from pygrype.core.scan.target import Target | ||
|
||
|
||
@dataclass | ||
class ScanSource: | ||
type: str | ||
target: Target |
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,7 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Distro: | ||
type: str | ||
version: str |
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,20 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
from pygrype.core.scan.layer import Layer | ||
|
||
|
||
@dataclass | ||
class Target: | ||
userInput: str | ||
imageID: str | ||
manifestDigest: str | ||
mediaType: str | ||
tags: List[str] | ||
imageSize: int | ||
layers: List[Layer] | ||
manifest: str | ||
config: str | ||
repoDigests: List[str] | ||
architecture: str | ||
os: str |
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,6 @@ | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass | ||
class Upstream: | ||
name: str |
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,17 @@ | ||
from dataclasses import dataclass | ||
from typing import List, Optional | ||
|
||
from pygrype.core.scan.cvss import CVSS | ||
from pygrype.core.scan.vulnerability_fix import VulnerabilityFix | ||
|
||
|
||
@dataclass | ||
class Vulnerability: | ||
id: str | ||
description: Optional[str] | ||
dataSource: str | ||
namespace: str | ||
severity: Optional[str] | ||
urls: List[str] | ||
cvss: List[CVSS] | ||
fix: Optional[VulnerabilityFix] |
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,8 @@ | ||
from dataclasses import dataclass | ||
from typing import List | ||
|
||
|
||
@dataclass | ||
class VulnerabilityFix: | ||
versions: List[str] | ||
state: str |
Oops, something went wrong.