Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
pgm-attack — 针对PGM索引的投毒攻击研究代码,演示如何构造对抗性数据以降低学习型索引的性能。 | Kitploit
工具/GitHubGitHub/atsukisato/pgm-attack
机器学习论文与研究AI 安全对抗性攻击
GitHubatsukisato/pgm-attack

pgm-attack

针对PGM索引的投毒攻击研究代码,演示如何构造对抗性数据以降低学习型索引的性能。

查看仓库
1111天前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

PGM-attack

概述

我们论文《Poisoning Attacks on the PGM-index》的官方代码。

快速开始

1. 克隆仓库及子模块

root@kitploit:~
git clone [REPOSITORY LINK]
cd pgm-index-poisoning
git submodule update --init --recursive

2. 构建

root@kitploit:~
./scripts/build.sh

需要 CMake(见依赖项)。输出文件位于 build/ 目录下(默认情况下二进制文件在 build/bin 中)。

3. 下载、预处理及合成数据

root@kitploit:~
./scripts/download_alex_dataset.sh       # ALEX
./scripts/download_mgbench.sh            # mgbench
./scripts/download_sosd_datasets.sh      # SOSD
./scripts/preprocess_alex_dataset.sh     # ALEX
./scripts/preprocess_mgbench.sh          # mgbench
./scripts/generate_synthetic_dataset.sh  # synthetic

4. 实验

每次运行通过 ./scripts/run_experiment.sh <config.json> 传入一个 JSON 配置。示例:

4.1 最大化最大误差(例如 n=16,连续方法)

root@kitploit:~
./scripts/run_experiment.sh "configs/experiments/poison_attack/maximize_maxerror_consec/baseline_n16.json"

4.2 最小化被覆盖的合法键(例如 epsilon=2,连续方法)

root@kitploit:~
./scripts/run_experiment.sh "configs/experiments/poison_attack/minimize_segment_length/baseline_epsilon2.json"

4.3 最大化 m_opt(PGM-index 示例)

root@kitploit:~
./scripts/run_experiment.sh "configs/experiments/poison_attack/inject_poisons_to_minimize_segment_length_swing_lambda_with_theta/baseline.json"

4.4 m_opt 的上界(实例相关示例)

root@kitploit:~
./scripts/run_experiment.sh "configs/experiments/upper_bound/fix_w_per_block/baseline.json"

4.5 运行所有实验(批量)

运行 scripts/run_all_experiment.sh 中列出的全部实验配置(编辑该文件可更改实验集合)。

root@kitploit:~
./scripts/run_all_experiment.sh

5. 绘图与表格

在仓库根目录下执行:

root@kitploit:~
./scripts/plot.sh
./scripts/print_table.sh

图表和日志写入 fig/ 目录。请先安装 Python 依赖:pip install -r requirements.txt。

依赖项

  • C++ 工具链: g++、make 和 CMake(构建脚本使用 CMake 配置,并通过 cmake --build 构建,通常会调用 Make)。
  • Python 3,包含 requirements.txt 中的包(绘图/表格脚本)。
  • jq — ./scripts/run_experiment.sh 解析实验 JSON 所需。

项目结构

Docker

构建镜像一次:

root@kitploit:~
./docker_build.sh
  • docker_run.sh — 交互式容器:将仓库挂载到 /workspace,分配 8 个 CPU(0–7),进入 bash 以便手动构建和运行命令。
  • docker_run_all.sh — 分离式运行:在容器内执行 ./scripts/run_all_experiment.sh(8 个 CPU),并将标准输出写入 results/run_all.log。
  • docker_run_all_single_cpu.sh — 与 docker_run_all.sh 相同,但仅使用一个 CPU 并设置 OMP_NUM_THREADS=1 以进行单线程运行。

三者均使用镜像 pgm_poisoning:latest,并采用与脚本中相同的权限/卷设置。

下载工具
路径作用
src/C++ 源码(攻击、PGM 基准测试、工具、上界)。
configs/experiments/实验 JSON 配置(poison_attack/、upper_bound/ 等目录下)。
scripts/构建、数据、run_experiment.sh、run_all_experiment.sh、plot.sh、print_table.sh。
third_party/Git 子模块(PGM-index、FITing-Tree、RadixSpline)。
data/、results/、fig/数据、运行输出以及生成的图表/表格日志。
plot/Python 绘图和表格打印脚本。