首页 > 解决方案 > 如何在终端上使用 AFL 运行代码

问题描述

我有一些我正在尝试使用 AFL 运行的 github。代码:https ://github.com/karimmd/CScanner/tree/cfe7d08bf46b1eed0443f9e27bc089d68a830a45

我想运行该项目并找到漏洞。我已经把github的所有文件都放在了一个文件夹里面code,所以文件结构是CScanner-master/code/all the files here。我在终端上使用这个命令:

   hemlatamahaur@Hemlatas-MacBook-Pro desktop % afl-fuzz -i CScanner-master -o code ./input-testcode.c
afl-fuzz 2.56b by <lcamtuf@google.com>
[+] You have 4 CPU cores and 2 runnable tasks (utilization: 50%).
[+] Try parallel jobs - see /usr/local/Cellar/afl-fuzz/2.57b/share/doc/afl/parallel_fuzzing.txt.
[*] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[*] Deleting old session data...
[+] Output dir cleanup successful.
[*] Scanning 'CScanner-master'...
[+] No auto-generated dictionary tokens to reuse.
[*] Creating hard links for all input files...
[*] Validating target binary...

[-] PROGRAM ABORT : Program './input-testcode.c' not found or not executable
         Location : check_binary(), afl-fuzz.c:6873

它一直说没有文件作为 input-testcode.c

我是 AFL 的新手,所以我可能做错了。如何使用 AFL 运行此代码以查找漏洞。非常感谢任何帮助。

标签: c++cunit-testingtestingterminal

解决方案


您必须先使用 afl-clang 构建代码

afl-clang

$ afl-clang input-testcode.c -o input-testcode .

然后:

$ afl-fuzz -i CScanner-master -o code ./input-testcode .

我希望它有效 Afl-fuzz 适用于可执行文件


推荐阅读