-
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.
Parse CVE objects into domain objects
Showing
11 changed files
with
482 additions
and
18 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
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,40 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class Configuration { | ||
private List<Node> nodes; | ||
|
||
public Configuration() { | ||
} | ||
|
||
public Configuration(List<Node> nodes) { | ||
this.nodes = nodes; | ||
} | ||
|
||
public List<Node> getNodes() { | ||
return nodes; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Configuration that = (Configuration) o; | ||
return Objects.equals(nodes, that.nodes); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(nodes); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Configuration{" + | ||
"nodes=" + nodes + | ||
'}'; | ||
} | ||
} |
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,81 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.Objects; | ||
|
||
public class CpeMatch { | ||
private String criteria; | ||
private Deb deb; | ||
private boolean vulnerable; | ||
private String versionStartIncluding; | ||
private String versionEndExcluding; | ||
private String matchCriteriaId; | ||
|
||
public CpeMatch() { | ||
} | ||
|
||
|
||
public CpeMatch(String criteria, Deb deb, boolean vulnerable, String versionStartIncluding, String versionEndExcluding, String matchCriteriaId) { | ||
this.criteria = criteria; | ||
this.deb = deb; | ||
this.vulnerable = vulnerable; | ||
this.versionStartIncluding = versionStartIncluding; | ||
this.versionEndExcluding = versionEndExcluding; | ||
this.matchCriteriaId = matchCriteriaId; | ||
} | ||
|
||
public String getVersionStartIncluding() { | ||
return versionStartIncluding; | ||
} | ||
|
||
public String getCriteria() { | ||
return criteria; | ||
} | ||
|
||
public Deb getDeb() { | ||
return deb; | ||
} | ||
|
||
public boolean isVulnerable() { | ||
return vulnerable; | ||
} | ||
|
||
public String getVersionEndExcluding() { | ||
return versionEndExcluding; | ||
} | ||
|
||
public String getMatchCriteriaId() { | ||
return matchCriteriaId; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
CpeMatch cpeMatch = (CpeMatch) o; | ||
return vulnerable == cpeMatch.vulnerable && Objects.equals(criteria, cpeMatch.criteria) && Objects.equals(deb, cpeMatch.deb) && Objects.equals(versionStartIncluding, cpeMatch.versionStartIncluding) && Objects.equals(versionEndExcluding, cpeMatch.versionEndExcluding) && Objects.equals(matchCriteriaId, cpeMatch.matchCriteriaId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hashCode(criteria); | ||
result = 31 * result + Objects.hashCode(deb); | ||
result = 31 * result + Boolean.hashCode(vulnerable); | ||
result = 31 * result + Objects.hashCode(versionStartIncluding); | ||
result = 31 * result + Objects.hashCode(versionEndExcluding); | ||
result = 31 * result + Objects.hashCode(matchCriteriaId); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CpeMatch{" + | ||
"criteria='" + criteria + '\'' + | ||
", deb=" + deb + | ||
", vulnerable=" + vulnerable + | ||
", versionStartIncluding='" + versionStartIncluding + '\'' + | ||
", versionEndExcluding='" + versionEndExcluding + '\'' + | ||
", matchCriteriaId='" + matchCriteriaId + '\'' + | ||
'}'; | ||
} | ||
} |
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,56 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.Objects; | ||
|
||
public class Deb { | ||
private String versionLatest; | ||
private String versionEndExcluding; | ||
private String cvssSeverity; | ||
|
||
public Deb() { | ||
} | ||
|
||
public Deb(String versionLatest, String versionEndExcluding, String cvssSeverity) { | ||
this.versionLatest = versionLatest; | ||
this.versionEndExcluding = versionEndExcluding; | ||
this.cvssSeverity = cvssSeverity; | ||
} | ||
|
||
public String getVersionLatest() { | ||
return versionLatest; | ||
} | ||
|
||
public String getVersionEndExcluding() { | ||
return versionEndExcluding; | ||
} | ||
|
||
public String getCvssSeverity() { | ||
return cvssSeverity; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Deb deb = (Deb) o; | ||
return Objects.equals(versionLatest, deb.versionLatest) && Objects.equals(versionEndExcluding, deb.versionEndExcluding) && Objects.equals(cvssSeverity, deb.cvssSeverity); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hashCode(versionLatest); | ||
result = 31 * result + Objects.hashCode(versionEndExcluding); | ||
result = 31 * result + Objects.hashCode(cvssSeverity); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Deb{" + | ||
"versionLatest='" + versionLatest + '\'' + | ||
", versionEndExcluding='" + versionEndExcluding + '\'' + | ||
", cvssSeverity='" + cvssSeverity + '\'' + | ||
'}'; | ||
} | ||
} |
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,42 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.Objects; | ||
|
||
public class Description { | ||
|
||
private String lang; | ||
|
||
private String value; | ||
|
||
public Description() { | ||
} | ||
|
||
public Description(String lang, String value) { | ||
this.lang = lang; | ||
this.value = value; | ||
} | ||
|
||
public String getLang() { | ||
return lang; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Description that = (Description) o; | ||
return Objects.equals(lang, that.lang) && Objects.equals(value, that.value); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hashCode(lang); | ||
result = 31 * result + Objects.hashCode(value); | ||
return result; | ||
} | ||
} |
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,40 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class Node { | ||
private List<CpeMatch> cpeMatch; | ||
private boolean negate; | ||
private String operator; | ||
|
||
public Node() { | ||
} | ||
|
||
public Node(List<CpeMatch> cpeMatch, boolean negate, String operator) { | ||
this.cpeMatch = cpeMatch; | ||
this.negate = negate; | ||
this.operator = operator; | ||
} | ||
|
||
public List<CpeMatch> getCpeMatch() { | ||
return cpeMatch; | ||
} | ||
|
||
public boolean isNegate() { | ||
return negate; | ||
} | ||
|
||
public String getOperator() { | ||
return operator; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Node{" + | ||
"cpeMatch=" + cpeMatch + | ||
", negate=" + negate + | ||
", operator='" + operator + '\'' + | ||
'}'; | ||
} | ||
} |
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,57 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class Reference { | ||
private String url; | ||
private String source; | ||
private List<String> tags; | ||
|
||
public Reference() { | ||
} | ||
|
||
public Reference(String url, String source, List<String> tags) { | ||
this.url = url; | ||
this.source = source; | ||
this.tags = tags; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public List<String> getTags() { | ||
return tags; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Reference reference = (Reference) o; | ||
return Objects.equals(url, reference.url) && Objects.equals(source, reference.source) && Objects.equals(tags, reference.tags); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hashCode(url); | ||
result = 31 * result + Objects.hashCode(source); | ||
result = 31 * result + Objects.hashCode(tags); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Reference{" + | ||
"url='" + url + '\'' + | ||
", source='" + source + '\'' + | ||
", tags=" + tags + | ||
'}'; | ||
} | ||
} |
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,60 @@ | ||
package io.gardenlinux.glvd.dto; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class Weakness { | ||
|
||
private String source; | ||
|
||
private String type; | ||
|
||
private List<Description> description; | ||
|
||
public Weakness() { | ||
} | ||
|
||
public Weakness(String source, String type, List<Description> description) { | ||
this.source = source; | ||
this.type = type; | ||
this.description = description; | ||
} | ||
|
||
public String getSource() { | ||
return source; | ||
} | ||
|
||
public String getType() { | ||
return type; | ||
} | ||
|
||
public List<Description> getDescription() { | ||
return description; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
Weakness weakness = (Weakness) o; | ||
return Objects.equals(source, weakness.source) && Objects.equals(type, weakness.type) && Objects.equals(description, weakness.description); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Objects.hashCode(source); | ||
result = 31 * result + Objects.hashCode(type); | ||
result = 31 * result + Objects.hashCode(description); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Weakness{" + | ||
"source='" + source + '\'' + | ||
", type='" + type + '\'' + | ||
", description=" + description + | ||
'}'; | ||
} | ||
} |