This code achieves an interface, receiving the POST and GET then scheduling several docker containers where adversarial samples are generated.
Now it implemented to Task 16, docker link and security-enhance modes have been implemented.
-
setting with ip and port in gunicorn.conf.py, as follows:
workers = 5
worker_class = "gevent"
bind = "127.0.0.1:5901" // ip and port
-
using run.sh to start the interface:
chmod a+x run.sh && ./run.sh
//in the url blank:
-
for testing mode1 获取被测对象的数据源:
-
for testing mode2 获取内置依赖库及其版本的数据源
-
for testing mode3 获取被测对象的模型权重文件数量
-
for testing mode4 被测对象的模型权重文件zip包下载
-
for testing mode5 获取被测对象的模型权重文件列表、对抗方法列表的数据源
-
for testing mode6 启动对抗样本生成
- leveraging curl for POST:
curl -X POST http://127.0.0.1:5901/adver_gen \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "mission_id=123&test_model=Vgg16&test_weight=weightA&test_seed=seed1&test_method=FGSM&timeout=3600" \
--noproxy 127.0.0.1 ***if you has set proxy, this option should be added***-
for testing mode7 对抗样本生成过程中数据轮询
-
for testing mode8 停止对抗样本生成
curl -X POST http://127.0.0.1:5901/adver_gen_stop \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "mission_id=123" \
--noproxy 127.0.0.1 -
for testing mode9 生成的对抗样本zip包下载
-
for testing mode10 获取不同被测对象下的评估配置指标
http://127.0.0.1:5901/adver_metrics?test_model=Vgg16
- for testing mode11 启动测试任务评估
curl -X POST http://127.0.0.1:5901/adver_eval \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "mission_id=123" \
--noproxy 127.0.0.1 -
for testing mode12 评估过程中数据轮询
-
for testing mode13 启动安全加固任务
curl -X POST http://127.0.0.1:5901/sec_enhance \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "enhance_id=777&test_model=Vgg16&mission_id=12" \
--noproxy 127.0.0.1 -
for testing mode14 安全加固过程数据轮询