当前位置: 首页>>代码示例>>Java>>正文


Java VictimsDBInterface.getVulnerabilities方法代码示例

本文整理汇总了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;
}
 
开发者ID:skavanagh,项目名称:victims-plugin-nexus,代码行数:22,代码来源:VictimsNexusScanner.java

示例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;

}
 
开发者ID:skavanagh,项目名称:victims-plugin-nexus,代码行数:31,代码来源:VictimsNexusScanner.java

示例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;
        }
    }
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:35,代码来源:VictimsDatabaseTest.java

示例4: getVulnerabilities

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
private HashSet<String> getVulnerabilities(VictimsDBInterface vdb,
        VictimsRecord vr) throws VictimsException {
    return vdb.getVulnerabilities(vr);
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:5,代码来源:VictimsDatabaseTest.java


注:本文中的com.redhat.victims.database.VictimsDBInterface.getVulnerabilities方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。