diff options
-rw-r--r-- | .SRCINFO | 28 | ||||
-rw-r--r-- | PKGBUILD | 67 |
2 files changed, 95 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..fa31e5869942 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,28 @@ +pkgbase = afl-unicorn-git + pkgdesc = Lets you fuzz any piece of binary that can be emulated by Unicorn Engine. + pkgver = r228.44a50c8 + pkgrel = 1 + url = https://github.com/Battelle/afl-unicorn + arch = any + license = apache + depends = glibc + depends = bash + depends = python + depends = python2 + depends = python-setuptools + provides = afl + provides = unicorn + provides = python-unicorn + conflicts = afl + conflicts = unicorn + conflicts = python-unicorn + options = staticlibs + options = !emptydirs + options = !strip + source = git+https://github.com/Battelle/afl-unicorn + source = https://github.com/unicorn-engine/unicorn/archive/1.0.1.tar.gz + md5sums = SKIP + md5sums = 2a2b619e7517781750da75adee6d2e08 + +pkgname = afl-unicorn-git + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..f3870cea566e --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,67 @@ +# Maintainer: Asger Hautop Drewsen <asgerdrewsen@gmail.com> +pkgname=afl-unicorn-git +pkgver=r228.44a50c8 +pkgrel=1 +pkgdesc="Lets you fuzz any piece of binary that can be emulated by Unicorn Engine." +arch=('any') +url="https://github.com/Battelle/afl-unicorn" +license=('apache') +depends=('glibc' 'bash' 'python' 'python2' 'python-setuptools') +provides=('afl' 'unicorn' 'python-unicorn') +conflicts=('afl' 'unicorn' 'python-unicorn') +options=('staticlibs' '!emptydirs' '!strip') +unicorn_version="1.0.1" +source=( + "git+https://github.com/Battelle/afl-unicorn" + "https://github.com/unicorn-engine/unicorn/archive/${unicorn_version}.tar.gz" +) +md5sums=('SKIP' + '2a2b619e7517781750da75adee6d2e08') + +pkgver() { + cd "${srcdir}/afl-unicorn" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" +} + +prepare() { + cd "${srcdir}/afl-unicorn/unicorn_mode" + rm -rf "unicorn-${unicorn_version}" + mv "${srcdir}/unicorn-${unicorn_version}" . + + for p in patches/*.diff; do + patch -p0 < "$p" + done + + cd "unicorn-${unicorn_version}" + sed 's|-O3|-O2|g' -i Makefile qemu/configure + sed 's|-g ||g' -i qemu/configure + sed 's|UNICORN_DEBUG ?= yes|UNICORN_DEBUG ?= no|g' -i config.mk +} + +build() { + cd "${srcdir}/afl-unicorn" + make PREFIX=/usr + make -C llvm_mode PREFIX=/usr + + cd "unicorn_mode/unicorn-${unicorn_version}" + make UNICORN_QEMU_FLAGS="--python=/usr/bin/python2" + + cd "bindings" + python const_generator.py python + cd "python" + python setup.py build +} + +package() { + cd "${srcdir}/afl-unicorn" + make PREFIX=/usr DESTDIR="${pkgdir}" install + install -Dm 644 llvm_mode/README.llvm -t "${pkgdir}/usr/share/doc/${pkgname}" + + cd "unicorn_mode/unicorn-${unicorn_version}" + make DESTDIR="${pkgdir}" install + install -Dm 644 samples/*.c -t "${pkgdir}/usr/share/doc/${pkgname}/samples" + + cd bindings/python + python setup.py install --root="${pkgdir}" -O1 --skip-build + install -Dm 644 sample* shellcode.py -t "${pkgdir}/usr/share/doc/${pkgname}/samples" +} |