apollon.attacks¶
attacks ¶
Adversarial evaluation with the Adversarial Robustness Toolbox (ART).
Two settings are supported:
- transfer: adversarial examples are crafted against a single classifier
(:func:
model_classifier) and then submitted to Apollon; - direct: the attack queries Apollon itself (:func:
apollon_classifier), so every query goes through cluster assignment and Thompson-sampled selection, exactly as a request reaching the deployed IDS.
Both attacks are black-box and targeted towards the benign class: ZOO (score-based) and
HopSkipJump (decision-based). After an attack, :func:restore_functional puts back the
value of every functional feature, those an attacker cannot change without breaking
the attack itself.
Requires the attacks extra: pip install "apollon-ids[attacks]".
functional_indexes ¶
Indexes of functional (must not change) and modifiable features in columns.
columns are the feature columns in the order the models receive them. Returns
(functional, modifiable, missing), where missing lists functional names that
are not among the columns.
Source code in src/apollon/attacks.py
restore_functional ¶
Put back the original value of every functional feature.
Source code in src/apollon/attacks.py
model_classifier ¶
ART wrapper around a single scikit-learn model (transfer setting).
Source code in src/apollon/attacks.py
apollon_classifier ¶
ART wrapper that queries the whole Apollon system (direct setting).
Probabilities come from the arm selected for each query: ZOO uses the scores and HopSkipJump only the predicted label.
Source code in src/apollon/attacks.py
run_attack ¶
Run a targeted (towards benign) black-box attack and return the adversarial examples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
|
required |
classifier
|
An ART classifier, from :func: |
required | |
x
|
Attack samples to perturb. |
required | |
max_iter
|
int
|
Iterations of the attack (100 in the paper). |
100
|
nb_parallel
|
int
|
Coordinates updated in parallel by ZOO. |
60
|