Search in sources :

Example 1 with DomainNameTypeEnum

use of org.mitre.cybox.objects.DomainNameTypeEnum in project metron by apache.

the class DomainHandler method extract.

@Override
public Iterable<LookupKV> extract(final DomainName type, Map<String, Object> config) throws IOException {
    List<LookupKV> ret = new ArrayList<>();
    String typeStr = getType();
    if (config != null) {
        Object o = config.get(TYPE_CONFIG);
        if (o != null) {
            typeStr = o.toString();
        }
    }
    final DomainNameTypeEnum domainType = type.getType();
    if (domainType == null || SUPPORTED_TYPES.contains(domainType)) {
        StringObjectPropertyType value = type.getValue();
        for (String token : StixExtractor.split(value)) {
            final String indicatorType = typeStr + ":" + DomainNameTypeEnum.FQDN;
            LookupKV results = new LookupKV(new EnrichmentKey(indicatorType, token), new EnrichmentValue(new HashMap<String, Object>() {

                {
                    put("source-type", "STIX");
                    put("indicator-type", indicatorType);
                    put("source", type.toXMLString());
                }
            }));
            ret.add(results);
        }
    }
    return ret;
}
Also used : DomainNameTypeEnum(org.mitre.cybox.objects.DomainNameTypeEnum) LookupKV(org.apache.metron.enrichment.lookup.LookupKV) StringObjectPropertyType(org.mitre.cybox.common_2.StringObjectPropertyType) EnrichmentKey(org.apache.metron.enrichment.converter.EnrichmentKey) EnrichmentValue(org.apache.metron.enrichment.converter.EnrichmentValue)

Example 2 with DomainNameTypeEnum

use of org.mitre.cybox.objects.DomainNameTypeEnum in project metron by apache.

the class DomainHandler method getPossibleTypes.

@Override
public List<String> getPossibleTypes() {
    String typeStr = getType();
    List<String> ret = new ArrayList<>();
    for (DomainNameTypeEnum e : SUPPORTED_TYPES) {
        ret.add(typeStr + ":" + e);
    }
    return ret;
}
Also used : DomainNameTypeEnum(org.mitre.cybox.objects.DomainNameTypeEnum)

Aggregations

DomainNameTypeEnum (org.mitre.cybox.objects.DomainNameTypeEnum)2 EnrichmentKey (org.apache.metron.enrichment.converter.EnrichmentKey)1 EnrichmentValue (org.apache.metron.enrichment.converter.EnrichmentValue)1 LookupKV (org.apache.metron.enrichment.lookup.LookupKV)1 StringObjectPropertyType (org.mitre.cybox.common_2.StringObjectPropertyType)1