from fl.preprocessing import load_mnist, data_to_client
from fl.model import NN
from fl.utils import plot_train_and_test, weights_to_json
from fl.federated_learning import federatedChallenge 2: Poison [2/2]

1 A Defense?
This time, a defense mechanism has been implemented. It aims to prevent any single client from having too much influence by enforcing a maximum variation on the weights. But is that enough?
2 Flag Retrieval
Just like in the first challenge, you need to send your weights to the API.
model = ...
raise NotImplementedErrorimport requests as rq
URL = "https://du-poison.challenges.404ctf.fr"
rq.get(URL + "/healthcheck").json()d = weights_to_json(model.get_weights())
rq.post(URL + "/challenges/2", json=d).json()