Class VulnerableSoftware
- All Implemented Interfaces:
Serializable, Comparable<us.springett.parsers.cpe.ICpe>, us.springett.parsers.cpe.ICpe
- Author:
- Jeremy Long
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionVulnerableSoftware(us.springett.parsers.cpe.values.Part part, String vendor, String product, String version, String update, String edition, String language, String swEdition, String targetSw, String targetHw, String other, String versionEndExcluding, String versionEndIncluding, String versionStartExcluding, String versionStartIncluding, boolean vulnerable) Constructs a new immutable VulnerableSoftware object that represents the Well Form Named defined in the CPE 2.3 specification. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(@NonNull us.springett.parsers.cpe.ICpe o) protected static booleancompareUpdateAttributes(String left, String right) Performs the same operation as Cpe.compareAttributes() - except additional rules are applied to match a1 to alpha1 and the comparison of update attributes will also return true if the only difference between the strings is an underscore or hyphen.protected booleancompareVersionRange(String targetVersion) Evaluates the target against the version and version range checks: versionEndExcluding, versionStartExcluding versionEndIncluding, and versionStartIncluding.protected static booleancompareVersions(VulnerableSoftware vs, String targetVersion) Evaluates the target against the version and version range checks: versionEndExcluding, versionStartExcluding versionEndIncluding, and versionStartIncluding.booleanReturns the versionEndExcluding.Returns the versionEndIncluding.Returns the versionStartExcluding.Returns the versionStartIncluding.inthashCode()booleanReturns the value of vulnerable.booleanmatchedBy(us.springett.parsers.cpe.ICpe target) Determines if the target VulnerableSoftware matches the VulnerableSoftware.booleanmatches(us.springett.parsers.cpe.ICpe target) Determines if the VulnerableSoftware matches the given target VulnerableSoftware.static booleantestMatch(us.springett.parsers.cpe.ICpe left, us.springett.parsers.cpe.ICpe right) Tests if the left matches the right.Returns the NVD search URL for this vulnerable software.toString()Methods inherited from class us.springett.parsers.cpe.Cpe
compareAttribute, compareAttribute, compareAttributes, compareAttributes, compareVersions, getEdition, getLanguage, getOther, getPart, getProduct, getSwEdition, getTargetHw, getTargetSw, getUpdate, getVendor, getVersion, getWellFormedEdition, getWellFormedLanguage, getWellFormedOther, getWellFormedProduct, getWellFormedSwEdition, getWellFormedTargetHw, getWellFormedTargetSw, getWellFormedUpdate, getWellFormedVendor, getWellFormedVersion, toCpe22Uri, toCpe23FS
-
Constructor Details
-
VulnerableSoftware
public VulnerableSoftware(us.springett.parsers.cpe.values.Part part, String vendor, String product, String version, String update, String edition, String language, String swEdition, String targetSw, String targetHw, String other, String versionEndExcluding, String versionEndIncluding, String versionStartExcluding, String versionStartIncluding, boolean vulnerable) throws us.springett.parsers.cpe.exceptions.CpeValidationException Constructs a new immutable VulnerableSoftware object that represents the Well Form Named defined in the CPE 2.3 specification. Specifyingnullwill be set to the defaultLogicalValue.ANY. All values passed in must be well formed (i.e. special characters quoted with a backslash).- Parameters:
part- the type of entry: application, operating system, or hardwarevendor- the vendor of the CPE entryproduct- the product of the CPE entryversion- the version of the CPE entryupdate- the update of the CPE entryedition- the edition of the CPE entrylanguage- the language of the CPE entryswEdition- the swEdition of the CPE entrytargetSw- the targetSw of the CPE entrytargetHw- the targetHw of the CPE entryother- the other of the CPE entryversionEndExcluding- the ending range, excluding the specified version, for matching vulnerable softwareversionEndIncluding- the ending range, including the specified version, for matching vulnerable softwareversionStartExcluding- the starting range, excluding the specified version, for matching vulnerable softwareversionStartIncluding- the starting range, including the specified version, for matching vulnerable softwarevulnerable- whether or not this represents a vulnerable software item- Throws:
us.springett.parsers.cpe.exceptions.CpeValidationException- thrown if one of the CPE entries is invalid- See Also:
-
-
Method Details
-
compareTo
public int compareTo(@NonNull us.springett.parsers.cpe.ICpe o) - Specified by:
compareToin interfaceComparable<us.springett.parsers.cpe.ICpe>- Overrides:
compareToin classus.springett.parsers.cpe.Cpe
-
hashCode
public int hashCode()- Overrides:
hashCodein classus.springett.parsers.cpe.Cpe
-
equals
- Overrides:
equalsin classus.springett.parsers.cpe.Cpe
-
matches
public boolean matches(us.springett.parsers.cpe.ICpe target) Determines if the VulnerableSoftware matches the given target VulnerableSoftware. This does not follow the CPE 2.3 Specification exactly as there are cases where undefined comparisons will result in either true or false. For instance, 'ANY' will match 'm+wild cards' and NA will return false when the target has 'm+wild cards'.
For vulnerable software matching, the implementation also takes into account version ranges as specified within the NVD data feeds.
- Specified by:
matchesin interfaceus.springett.parsers.cpe.ICpe- Overrides:
matchesin classus.springett.parsers.cpe.Cpe- Parameters:
target- the target CPE to evaluate- Returns:
trueif the CPE matches the target; otherwisefalse
-
compareUpdateAttributes
Performs the same operation as Cpe.compareAttributes() - except additional rules are applied to match a1 to alpha1 and the comparison of update attributes will also return true if the only difference between the strings is an underscore or hyphen.- Parameters:
left- the left value to compareright- the right value to compare- Returns:
trueif there is a match; otherwisefalse
-
testMatch
public static boolean testMatch(us.springett.parsers.cpe.ICpe left, us.springett.parsers.cpe.ICpe right) Tests if the left matches the right.- Parameters:
left- the cpe to compareright- the cpe to check- Returns:
trueif a match is found; otherwisefalse
-
matchedBy
public boolean matchedBy(us.springett.parsers.cpe.ICpe target) Determines if the target VulnerableSoftware matches the VulnerableSoftware. This does not follow the CPE 2.3 Specification exactly as there are cases where undefined comparisons will result in either true or false. For instance, 'ANY' will match 'm+wild cards' and NA will return false when the target has 'm+wild cards'.
For vulnerable software matching, the implementation also takes into account version ranges as specified within the NVD data feeds.
- Specified by:
matchedByin interfaceus.springett.parsers.cpe.ICpe- Overrides:
matchedByin classus.springett.parsers.cpe.Cpe- Parameters:
target- the VulnerableSoftware to evaluate- Returns:
trueif the target CPE matches CPE; otherwisefalse
-
compareVersionRange
Evaluates the target against the version and version range checks: versionEndExcluding, versionStartExcluding versionEndIncluding, and versionStartIncluding.- Parameters:
targetVersion- the version to compare- Returns:
trueif the target version is matched; otherwisefalse
-
compareVersions
Evaluates the target against the version and version range checks: versionEndExcluding, versionStartExcluding versionEndIncluding, and versionStartIncluding.- Parameters:
vs- a reference to the vulnerable software to comparetargetVersion- the version to compare- Returns:
trueif the target version is matched; otherwisefalse
-
getVersionEndExcluding
Returns the versionEndExcluding.- Returns:
- the versionEndExcluding
-
getVersionEndIncluding
Returns the versionEndIncluding.- Returns:
- the versionEndIncluding
-
getVersionStartExcluding
Returns the versionStartExcluding.- Returns:
- the versionStartExcluding
-
getVersionStartIncluding
Returns the versionStartIncluding.- Returns:
- the versionStartIncluding
-
isVulnerable
public boolean isVulnerable()Returns the value of vulnerable.- Returns:
- the value of vulnerable
-
toString
- Overrides:
toStringin classus.springett.parsers.cpe.Cpe
-
toNvdSearchUrl
Returns the NVD search URL for this vulnerable software.- Returns:
- the NVD search URL
-