本文整理汇总了Java中com.redhat.victims.database.VictimsDBInterface.getVulnerabilities方法的典型用法代码示例。如果您正苦于以下问题:Java VictimsDBInterface.getVulnerabilities方法的具体用法?Java VictimsDBInterface.getVulnerabilities怎么用?Java VictimsDBInterface.getVulnerabilities使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.redhat.victims.database.VictimsDBInterface
的用法示例。
在下文中一共展示了VictimsDBInterface.getVulnerabilities方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFingerprintVulnerabilities
import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
/**
* check if storage file is vulnerable via fingerprint
*
* @param item storage item
* @return list of CVEs
*/
public HashSet<String> getFingerprintVulnerabilities(final StorageFileItem item) {
HashSet<String> cves = new HashSet<String>();
try {
VictimsDBInterface db = getVictimsDB();
for (VictimsRecord vr : VictimsScanner.getRecords(item.getInputStream(), item.getName())) {
cves = db.getVulnerabilities(vr);
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
return cves;
}
示例2: getMetadataVulnerabilities
import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
/**
* check if storage file is vulnerable via meta data
*
* @param item storage item
* @return list of CVEs
*/
public HashSet<String> getMetadataVulnerabilities(final StorageFileItem item) {
HashSet<String> cves = new HashSet<String>();
try {
VictimsDBInterface db = getVictimsDB();
for (VictimsRecord vr : VictimsScanner.getRecords(item.getInputStream(), item.getName())) {
for (String key : vr.getMetaData().keySet()) {
HashSet<String> cveCheck = db.getVulnerabilities(vr.getMetaData().get(key));
if (!cveCheck.isEmpty()) {
cves.addAll(cveCheck);
}
}
}
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
}
return cves;
}
示例3: testVulnerabilities
import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
private void testVulnerabilities(VictimsDBInterface vdb, boolean embedded, boolean meta)
throws IOException, VictimsException {
FileInputStream fin = new FileInputStream(Resources.TEST_RESPONSE);
RecordStream rs = new RecordStream(fin);
VictimsRecord vr;
while (rs.hasNext()) {
vr = rs.getNext();
if (vr.getHashes(Algorithms.SHA512).size() > 0) {
HashSet<String> cves = getVulnerabilities(vdb, vr);
HashSet<String> result;
if (meta) {
result = vdb.getVulnerabilities(vr.getFlattenedMetaData());
} else {
vr.hash = "0";
if (embedded) {
// since we are testing for embedded, inject some new
// filehashes to simulate a superset
vr.getHashes(Algorithms.SHA512).put("1", "1");
vr.getHashes(Algorithms.SHA512).put("2", "2");
}
result = getVulnerabilities(vdb, vr);
}
assertEquals("Unexpected number of CVEs", cves.size(),
result.size());
for (String cve : cves) {
assertTrue(String.format(
"%s was expected, but was not found in result.",
cve), result.contains(cve));
}
break;
}
}
}
示例4: getVulnerabilities
import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
private HashSet<String> getVulnerabilities(VictimsDBInterface vdb,
VictimsRecord vr) throws VictimsException {
return vdb.getVulnerabilities(vr);
}