@Override public SensorEnrichmentConfig findOne(String name) throws RestException { EnrichmentConfigurations configs = cache.get( EnrichmentConfigurations.class); return configs.getSensorEnrichmentConfig(name); }
@Override public Map<String, Object> getSensorConfig(String sensorName) { return config.orElse(new EnrichmentConfigurations()).getSensorEnrichmentConfig(sensorName) .getConfiguration(); }
protected Map<String, ConfigHandler> getFieldToHandlerMap(String sensorType) { if(sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getEnrichment().getEnrichmentConfigs(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); } protected Map<String, Object > getFieldMap(String sensorType) {
protected Map<String, Object > getFieldMap(String sensorType) { if(sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getEnrichment().getFieldMap(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); }
protected Map<String, ConfigHandler> getFieldToHandlerMap(String sensorType) { if(sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getEnrichment().getEnrichmentConfigs(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); }
@Override protected Map<String, Object> getFieldMap(String sensorType) { if (sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getThreatIntel().getFieldMap(); } else { LOG.debug("Unable to retrieve sensor config: {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); }
@Override protected Map<String, ConfigHandler> getFieldToHandlerMap(String sensorType) { if(sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getThreatIntel().getEnrichmentConfigs(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); }
@Override protected Map<String, ConfigHandler> getFieldToHandlerMap(String sensorType) { if(sensorType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sensorType); if (config != null) { return config.getThreatIntel().getEnrichmentConfigs(); } else { LOG.debug("Unable to retrieve a sensor config of {}", sensorType); } } else { LOG.error("Trying to retrieve a field map with sensor type of null"); } return new HashMap<>(); }
@Override public Map<String, Object> getFieldMap(String sourceType) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sourceType); if(config != null) { return config.getThreatIntel().getFieldMap(); } else { LOG.debug("Unable to retrieve sensor config: {}", sourceType); return null; } }
public Map<String, Object> getFieldMap(String sourceType) { if(sourceType != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sourceType); if (config != null && config.getEnrichment() != null) { return config.getEnrichment().getFieldMap(); } else { LOG.debug("Unable to retrieve a sensor enrichment config of {}", sourceType); } } else { LOG.error("Trying to retrieve a field map with source type of null"); } return null; } }
@Override public JSONObject joinMessages(Map<String, Tuple> streamMessageMap, MessageGetStrategy messageGetStrategy) { JSONObject ret = super.joinMessages(streamMessageMap, messageGetStrategy); String sourceType = MessageUtils.getSensorType(ret); return ThreatIntelUtils.triage(ret, getConfigurations().getSensorEnrichmentConfig(sourceType), functionResolver, stellarContext); }
JSONObject enrichedField = new JSONObject(); if (value != null) { SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sourceType); if(config == null) { LOG.debug("Unable to find SensorEnrichmentConfig for sourceType: {}", sourceType);
try { String sourceType = MessageUtils.getSensorType(message); SensorEnrichmentConfig config = getConfigurations().getSensorEnrichmentConfig(sourceType); if(config == null) { LOG.debug("Unable to find SensorEnrichmentConfig for sourceType: {}", sourceType);
Map<String, Object> expectedGlobalConfig = JSONUtils.INSTANCE.load(globalConfig, JSONUtils.MAP_SUPPLIER); EnrichmentConfigurations config = cache.get( EnrichmentConfigurations.class); assertEventually(() -> Assert.assertEquals(expectedConfig, config.getSensorEnrichmentConfig("test"))); assertEventually(() -> Assert.assertEquals(expectedGlobalConfig, config.getGlobalConfig()));
SensorEnrichmentConfig expectedConfig = JSONUtils.INSTANCE.load(inFile, SensorEnrichmentConfig.class); EnrichmentConfigurations config = cache.get( EnrichmentConfigurations.class); assertEventually(() -> Assert.assertEquals(expectedConfig, config.getSensorEnrichmentConfig("test"))); assertEventually(() -> Assert.assertEquals(expectedGlobalConfig, config.getGlobalConfig())); assertEventually(() -> Assert.assertNull(config.getSensorEnrichmentConfig("notthere")));
assertEventually(() -> Assert.assertNull(config.getSensorEnrichmentConfig("test"))); assertEventually(()-> Assert.assertNull(config.getGlobalConfig(false)));