2014-12-04 21:00:45 +00:00
|
|
|
class AflFuzz < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "American fuzzy lop: Security-oriented fuzzer"
|
2014-12-04 21:00:45 +00:00
|
|
|
homepage "http://lcamtuf.coredump.cx/afl/"
|
2016-07-03 12:16:36 +00:00
|
|
|
url "http://lcamtuf.coredump.cx/afl/releases/afl-2.18b.tgz"
|
|
|
|
sha256 "cffcdcd9f02f81634b82c2b34a174c1c2552fbc9be92245d8fb87c78b37d06a4"
|
2014-12-04 21:00:45 +00:00
|
|
|
|
2014-12-06 22:36:01 +00:00
|
|
|
bottle do
|
2016-07-03 12:18:56 +00:00
|
|
|
sha256 "2fc711e05568970bca1d02966f497b2eeab44531957ed2b5276af67bec1ca06d" => :el_capitan
|
|
|
|
sha256 "98b0fa1d7ad6ff5f98dbf4476e0e1bb27e241ce53e3bafc863d3ae476a0da353" => :yosemite
|
|
|
|
sha256 "2a8c089ec92772c01156a6df8936119f842f50267728446a5bb2f694479cd314" => :mavericks
|
2014-12-06 22:36:01 +00:00
|
|
|
end
|
|
|
|
|
2014-12-04 21:00:45 +00:00
|
|
|
def install
|
2016-04-07 04:43:33 +00:00
|
|
|
# test_build dies with "Oops, the instrumentation does not seem to be
|
|
|
|
# behaving correctly!" in a nested login shell.
|
|
|
|
# Reported to lcamtuf@coredump.cx 6th Apr 2016.
|
|
|
|
inreplace "Makefile" do |s|
|
|
|
|
s.gsub! "all: test_x86 $(PROGS) afl-as test_build all_done", "all: test_x86 $(PROGS) afl-as all_done"
|
|
|
|
s.gsub! "all_done: test_build", "all_done:"
|
|
|
|
end
|
2014-12-04 21:00:45 +00:00
|
|
|
system "make", "PREFIX=#{prefix}"
|
|
|
|
system "make", "install", "PREFIX=#{prefix}"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
cpp_file = testpath/"main.cpp"
|
2014-12-07 17:42:13 +00:00
|
|
|
exe_file = testpath/"test"
|
2014-12-04 21:00:45 +00:00
|
|
|
|
2014-12-07 17:42:13 +00:00
|
|
|
cpp_file.write <<-EOS.undent
|
2014-12-04 21:00:45 +00:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
int main() {
|
2014-12-07 17:42:13 +00:00
|
|
|
std::cout << "Hello, world!";
|
2014-12-04 21:00:45 +00:00
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
2014-12-07 17:42:13 +00:00
|
|
|
system "#{bin}/afl-clang++", "-g", cpp_file, "-o", exe_file
|
|
|
|
output = `#{exe_file}`
|
|
|
|
assert_equal 0, $?.exitstatus
|
|
|
|
assert_equal output, "Hello, world!"
|
2014-12-04 21:00:45 +00:00
|
|
|
end
|
|
|
|
end
|