Search in sources :

Example 1 with IndicatorBaseType

use of org.mitre.stix.common_1.IndicatorBaseType in project metron by apache.

the class StixExtractor method getObservables.

public List<Observable> getObservables(STIXPackage stixPackage) {
    List<Observable> ret = new ArrayList<>();
    Observables observables = stixPackage.getObservables();
    if (observables != null) {
        for (Observable o : observables.getObservables()) {
            ret.add(o);
        }
    }
    if (stixPackage.getIndicators() != null) {
        if (stixPackage.getIndicators().getIndicators() != null) {
            List<IndicatorBaseType> indicators = stixPackage.getIndicators().getIndicators();
            int indicatorCount = indicators.size();
            for (int i = 0; i < indicatorCount; i++) {
                Indicator indicator = (Indicator) indicators.get(i);
                if (indicator.getObservable() != null) {
                    ret.add(indicator.getObservable());
                }
            }
        }
    }
    return ret;
}
Also used : ArrayList(java.util.ArrayList) Observables(org.mitre.cybox.cybox_2.Observables) IndicatorBaseType(org.mitre.stix.common_1.IndicatorBaseType) Observable(org.mitre.cybox.cybox_2.Observable) Indicator(org.mitre.stix.indicator_2.Indicator)

Aggregations

ArrayList (java.util.ArrayList)1 Observable (org.mitre.cybox.cybox_2.Observable)1 Observables (org.mitre.cybox.cybox_2.Observables)1 IndicatorBaseType (org.mitre.stix.common_1.IndicatorBaseType)1 Indicator (org.mitre.stix.indicator_2.Indicator)1