/** * {@inheritDoc} */ public override void addAttack(Attack attack) { Logger.Warn("Security attack " + attack.GetDetectionPoint().getId() + " triggered by user: " + attack.GetUser().getUsername()); writeAttack(attack); //super.notifyListeners(attack); base.notifyListeners(attack); }
/** * {@inheritDoc} */ //public override void addAttack(Attack attack) { public void addAttack(Attack attack) { /// <exception cref="NotAuthorizedException"></exception> if (detectionSystemId == null) { detectionSystemId = attack.GetDetectionSystemId(); } appSensorServer.getAttackStore().addAttack(attack); }
/** * {@inheritDoc} */ //public override void onAdd(Attack attack) { public void onAdd(Attack attack) { notifyWebSocket("attack", attack); Logger.Info("Reporter observed attack by user [" + attack.GetUser().getUsername() + "]"); }
protected void writeAttack(Attack attack) { //string json = gson.toJson(attack); string json = attack.toString(); try { //Files.write(getPath(), Arrays.asList(json), StandardCharsets.UTF_8, StandardOpenOption.APPEND, StandardOpenOption.WRITE); File.WriteAllText(getPath().ToString(), json, System.Text.Encoding.UTF8); } catch(IOException e) { Logger.Error("Error occurred loading writing event file to path: " + getPath(), e); } }
/** * {@inheritDoc} */ //public override void addAttack(Attack attack) { public void addAttack(Attack attack) { requestHandler.addAttack(attack); }
/** * Add an {@link Attack} * @param attack {@link Attack} to Add */ public void addAttack(Attack attack) { }
/** * {@inheritDoc} */ //@Override public void addAttack(Attack attack) { //make request }
public abstract void analyze(Attack attack);
public void onAdd(Attack attack) { analyze(attack); }
/** * Add an Attack * @param attack Attack to Add */ /// <exception cref="NotAuthorizedException"></exception> //public void addAttack(Attack attack); void addAttack(Attack attack) { }
/** * {@inheritDoc} */ //public override void onAdd(Attack attack) { public void onAdd(Attack attack) { Logger.Info("Reporter observed attack by user [" + attack.GetUser().getUsername() + "]"); }
/** * Notify each {@link AttackListener} of the specified {@link Attack} * * @param response the {@link Attack} to notify each {@link AttackListener} about */ public void notifyListeners(Attack attack) { foreach (AttackListener listener in listeners) { listener.onAdd(attack); } }
//private static System.Collections.Concurrent.Partitioner<AttackListener> listeners = new (); /// <summary> /// Add an attack to the AttackStore /// </summary> /// <param name="attack">the <seealso cref="org.owasp.appsensor.Attack"/> object to Add to the AttackStore</param> public abstract void addAttack(Attack attack);