先按INSTALL.md
安装好需要的库
我用的kali 2021,自带有llvm 9 11 12,所以就没再安装了,不过建议还是准备个新环境,按文档全部装上
然后测试的过程发现出现了[-] Oops, can't find gcc header files. Be sure to install 'gcc-X-plugin-dev'.
也就是要安装gcc
对应版本的plugin-dev
,这个在文档也有体现,就是下面的命令安装的,可以自己识别出来对应的版本。当然这里也安装了libstdc++-X-dev
sudo apt update
sudo apt install -y gcc-$(gcc --version|head -n1|sed 's/\..*//'|sed 's/.* //')-plugin-dev libstdc++-$(gcc --version|head -n1|sed 's/\..*//'|sed 's/.* //')-dev
然后设置好LLVM_CONFIG
环境变量,因为后面会用到。似乎12更好些,不过稳妥起见,这里设置成11的
export LLVM_CONFIG="llvm-config-11"
然后就可以开始编译了,安装的时候需要用sudo
,然后会用到LLVM_CONFIG
,于是使用-E
来保持环境变量
make
sudo -E make install
不出意外就是下面这样了,算是完成了编译
└─$ ls -al /usr/local/bin/afl*
-rwxr-xr-x 1 root root 289848 Jun 3 10:11 /usr/local/bin/afl-analyze
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-c++ -> afl-cc
-rwxr-xr-x 1 root root 147968 Jun 3 10:11 /usr/local/bin/afl-cc
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-clang -> afl-cc
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-clang++ -> afl-cc
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-clang-fast -> afl-cc
lrwxrwxrwx 1 root root 9 Jun 3 10:11 /usr/local/bin/afl-clang-fast++ -> ./afl-c++
-rwxr-xr-x 1 root root 16669 Jun 3 10:11 /usr/local/bin/afl-cmin
-rwxr-xr-x 1 root root 12350 Jun 3 10:11 /usr/local/bin/afl-cmin.bash
-rwxr-xr-x 1 root root 1457856 Jun 3 10:11 /usr/local/bin/afl-fuzz
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-g++ -> afl-cc
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-gcc -> afl-cc
lrwxrwxrwx 1 root root 6 Jun 3 10:11 /usr/local/bin/afl-gcc-fast -> afl-cc
lrwxrwxrwx 1 root root 7 Jun 3 10:11 /usr/local/bin/afl-g++-fast -> afl-c++
-rwxr-xr-x 1 root root 43864 Jun 3 10:11 /usr/local/bin/afl-gotcpu
-rwxr-xr-x 1 root root 4359 Jun 3 10:11 /usr/local/bin/afl-persistent-config
-rwxr-xr-x 1 root root 7863 Jun 3 10:11 /usr/local/bin/afl-plot
-rwxr-xr-x 1 root root 323160 Jun 3 10:11 /usr/local/bin/afl-showmap
-rwxr-xr-x 1 root root 5816 Jun 3 10:11 /usr/local/bin/afl-system-config
-rwxr-xr-x 1 root root 329224 Jun 3 10:11 /usr/local/bin/afl-tmin
-rwxr-xr-x 1 root root 7594 Jun 3 10:11 /usr/local/bin/afl-whatsup