• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java VictimsScanner类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.redhat.victims.VictimsScanner的典型用法代码示例。如果您正苦于以下问题:Java VictimsScanner类的具体用法?Java VictimsScanner怎么用?Java VictimsScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

VictimsScanner类属于com.redhat.victims包,在下文中一共展示了VictimsScanner类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getFingerprintVulnerabilities

点赞 3

import com.redhat.victims.VictimsScanner; //导入依赖的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

点赞 3

import com.redhat.victims.VictimsScanner; //导入依赖的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: execute

点赞 3

import com.redhat.victims.VictimsScanner; //导入依赖的package包/类
@Override
public CommandResult execute(List<String> args) {
    
    CommandResult result = new ExitSuccess(null);
    
    for (String arg : args) {
        try { 
            ArrayList<VictimsRecord> records = new ArrayList();
            VictimsScanner.scan(arg, records);
            result.addOutput("[");
            for (int i = 0; i < records.size(); ++i){
            	result.addOutput(records.get(i).toString());
            	if (records.size() > 1 && i < records.size() -1){
            		result.addOutput(",");
            	}
            }
            result.addOutput("]");
                    
        } catch (IOException e){
            result.addOutput(e.toString());
        }
        
    }
    return result;
}
 

开发者ID:victims,
项目名称:victims-client-java-legacy,
代码行数:26,
代码来源:DumpCommand.java

示例4: execute

点赞 2

import com.redhat.victims.VictimsScanner; //导入依赖的package包/类
@Override
public CommandResult execute(List<String> args) {

	CommandResult result = new ExitSuccess(null);
	if (args.size() != 2) {
		return new ExitInvalid("Two jars are required to do comparisson");
	}

	String lhs = args.get(0);
	String rhs = args.get(1);

	try {

		ArrayList<VictimsRecord> lhsRecords = VictimsScanner
				.getRecords(lhs);
		ArrayList<VictimsRecord> rhsRecords = VictimsScanner
				.getRecords(rhs);

		Integer lcount = 0;
		Integer rcount = 0;

		for (VictimsRecord vrl : lhsRecords) {
			for (VictimsRecord vrr : rhsRecords) {
				if (vrl.containsAll(vrr)) {
					lcount += 1;
				}

				if (vrr.containsAll(vrl)) {
					rcount += 1;
				}
			}
		}

		boolean lr = lcount.equals(rhsRecords.size());
		boolean rl = rcount.equals(lhsRecords.size());

		if (lr && rl) {
			result.addOutput("IDENT: Both files have identical content");
		} else {
			String format = "SUBSET: %s contains %s";
			if (lr) {
				result.addOutput(String.format(format, lhs, rhs));
			} else if (rl) {
				result.addOutput(String.format(format, rhs, lhs));
			} else {
				result.addOutput("NO MATCH: No content match");
			}
		}

		return result;

	} catch (IOException e) {
		return new ExitFailure(e.toString());
	}
}
 

开发者ID:victims,
项目名称:victims-client-java-legacy,
代码行数:56,
代码来源:CompareCommand.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)