/** * This method analyzes {@link Attack} objects that are added * to the system (either via direct addition or generated by the event analysis * engine), generates an appropriate {@link Response} object, * and adds it to the configured {@link ResponseStore} * * @param event the {@link Attack} that was added to the {@link AttackStore} */ public override void analyze(Attack attack) { if (attack != null) { Response response = findAppropriateResponse(attack); if (response != null) { //Logger.Info("Response set for user <" + attack.GetUser().getUsername() + "> - storing response action " + response.getAction()); Logger.Info("Response set for user <" + attack.GetUser().getUsername() + "> - storing response action " + response.getAction()); appSensorServer.getResponseStore().addResponse(response); } } }
/** * {@inheritDoc} */ //public override Collection<Response> getResponses(string earliest) { public Collection <Response> getResponses(string earliest) { /// <exception cref="NotAuthorizedException"></exception> SearchCriteria criteria = new SearchCriteria(). setDetectionSystemIds(StringUtils.toCollection(detectionSystemId != null ? detectionSystemId : "")). setEarliest(earliest); return(appSensorServer.getResponseStore().findResponses(criteria)); }
/** * {@inheritDoc} */ //@Override //@GET //@Path("/responses") //@Produces(MediaType.APPLICATION_JSON) //public Collection<Response> getResponses(@QueryParam("earliest") String earliest) { // throws NotAuthorizedException public Collection <Response> getResponses(String earliest) // throws NotAuthorizedException { accessControlUtils.checkAuthorization(org.owasp.appsensor.accesscontrol.Action.GET_RESPONSES, requestContext); SearchCriteria criteria = new SearchCriteria(). setDetectionSystemIds(StringUtils.toCollection(getClientApplicationName())). setEarliest(earliest); return(appSensorServer.getResponseStore().findResponses(criteria)); }
public void deleteTestFiles() { //IApplicationContext context = new XmlApplicationContext("Resources/base-context.xml", "Resources/appsensor-server-config.xml"); IApplicationContext context = new XmlApplicationContext("Resources/base-context.xml", "Resources/appsensor-server-config.xml"); AppSensorServer appSensorServer = (AppSensorServer)context.GetObject("AppSensorServer"); FileBasedEventStore eventStore = (FileBasedEventStore)appSensorServer.getEventStore(); FileBasedAttackStore attackStore = (FileBasedAttackStore)appSensorServer.getAttackStore(); FileBasedResponseStore responseStore = (FileBasedResponseStore)appSensorServer.getResponseStore(); File.Delete(eventStore.getPath()); File.Delete(attackStore.getPath()); File.Delete(responseStore.getPath()); }