svn commit: r528280 - in head/security: . py-angr py-angr/files
Mateusz Piotrowski
0mp at FreeBSD.org
Thu Mar 12 09:13:38 UTC 2020
Author: 0mp
Date: Thu Mar 12 09:13:35 2020
New Revision: 528280
URL: https://svnweb.freebsd.org/changeset/ports/528280
Log:
New port: security/py-angr
angr is a platform-agnostic binary analysis framework in a form of a suite
of Python 3 libraries that let you load a binary and do a lot of cool
things to it:
- Disassembly and intermediate-representation lifting
- Program instrumentation
- Symbolic execution
- Control-flow analysis
- Data-dependency analysis
- Value-set analysis (VSA)
- Decompilation
The most common angr operation is loading a binary:
p = angr.Project('/bin/bash')
If you do this in an enhanced REPL like IPython, you can use
tab-autocomplete to browse the top-level-accessible methods and their
docstrings.
angr is brought to you by the Computer Security Lab at UC Santa Barbara,
SEFCOM at Arizona State University, their associated CTF team, Shellphish,
the open source community, and @rhelmot.
WWW: https://github.com/angr/angr
PR: 244562
Requested by: lwhsu@ (via wiki.freebsd.org/WantedPorts)
Reviewed by: kaktus (local patches for native_log.c)
Differential Revision: https://reviews.freebsd.org/D23935
Added:
head/security/py-angr/
head/security/py-angr/Makefile (contents, props changed)
head/security/py-angr/distinfo (contents, props changed)
head/security/py-angr/files/
head/security/py-angr/files/patch-native_Makefile (contents, props changed)
head/security/py-angr/files/patch-native_log.c (contents, props changed)
head/security/py-angr/files/patch-setup.py (contents, props changed)
head/security/py-angr/pkg-descr (contents, props changed)
Modified:
head/security/Makefile
Modified: head/security/Makefile
==============================================================================
--- head/security/Makefile Thu Mar 12 09:03:04 2020 (r528279)
+++ head/security/Makefile Thu Mar 12 09:13:35 2020 (r528280)
@@ -844,6 +844,7 @@
SUBDIR += py-acme
SUBDIR += py-acme-tiny
SUBDIR += py-ailment
+ SUBDIR += py-angr
SUBDIR += py-argon2-cffi
SUBDIR += py-artifacts
SUBDIR += py-asyncssh
Added: head/security/py-angr/Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/py-angr/Makefile Thu Mar 12 09:13:35 2020 (r528280)
@@ -0,0 +1,97 @@
+# $FreeBSD$
+
+PORTNAME= angr
+DISTVERSION= 8.20.1.7
+CATEGORIES= security devel python
+MASTER_SITES= CHEESESHOP
+PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
+DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
+
+MAINTAINER= 0mp at FreeBSD.org
+COMMENT= Multi-architecture binary analysis toolkit
+
+LICENSE= BSD3CLAUSE
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}pyvex>=${DISTVERSION}:security/py-pyvex@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}unicorn>0:emulators/py-unicorn@${PY_FLAVOR}
+LIB_DEPENDS= libunicorn.so:emulators/unicorn
+RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}ailment>=${DISTVERSION}:security/py-ailment@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}cachetools>=0:devel/py-cachetools@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}capstone>=3.0.5:devel/py-capstone@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}cffi>=1.7.0:devel/py-cffi@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}claripy>=${DISTVERSION}:math/py-claripy@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}cle>=${DISTVERSION}:devel/py-cle@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}dpkt>=0:net/py-dpkt@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}GitPython>=0:devel/py-gitpython@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}itanium_demangler>=0:devel/py-itanium_demangler@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}mulpyplexer>=0:devel/py-mulpyplexer@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}networkx>=2.0:math/py-networkx@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}progressbar2>=0:misc/py-progressbar2@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}protobuf>=0:devel/py-protobuf@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}psutil>=0:sysutils/py-psutil@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pycparser>2.18:devel/py-pycparser@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}rpyc>0:devel/py-RPyC@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}sortedcontainers>=0:devel/py-sortedcontainers@${PY_FLAVOR}
+TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}nose>=0:devel/py-nose@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}keystone-engine>=0:devel/py-keystone-engine@${PY_FLAVOR} \
+ z3>=0:math/z3
+
+USES= gmake localbase python:3.5+
+USE_GITHUB= nodefault
+GH_TUPLE= ${PORTNAME}:${PORTNAME}:6b1a0825cbe156e2d32c577ba47ff50920f005aa:tests \
+ ${PORTNAME}:binaries:f2de6d7a0474d22130ffadd042327536a6fda114:binaries
+USE_PYTHON= autoplist distutils
+
+TEST_ENV= ${MAKE_ENV} NOSE_EXCLUDE="${_NOSE_EXCLUDE}"
+
+# Problem: the following tests require PySoot: https://github.com/angr/pysoot
+_EXCLUDED_TESTS+= test_simple1
+_EXCLUDED_TESTS+= test_simple2
+_EXCLUDED_TESTS+= test_fauxware
+_EXCLUDED_TESTS+= test_cmd_line_args
+_EXCLUDED_TESTS+= test_jni_version_information
+_EXCLUDED_TESTS+= test_jni_global_and_local_refs
+_EXCLUDED_TESTS+= test_jni_object_operations
+_EXCLUDED_TESTS+= test_jni_string_operations
+_EXCLUDED_TESTS+= test_jni_field_access
+_EXCLUDED_TESTS+= test_jni_method_calls
+_EXCLUDED_TESTS+= test_jni_primitive_datatypes
+_EXCLUDED_TESTS+= test_jni_object_arrays
+_EXCLUDED_TESTS+= test_jni_array_operations
+_EXCLUDED_TESTS+= test_method_calls
+_EXCLUDED_TESTS+= test_array_operations
+_EXCLUDED_TESTS+= test_multiarray_operations
+_EXCLUDED_TESTS+= test_loading
+_EXCLUDED_TESTS+= test_toggling_of_simstate
+# Problem: "TypeError: %d format: a number is required, not NoneType"
+_EXCLUDED_TESTS+= test_fastmem.*
+# Problem: "angr.errors.AngrIncongruencyError: Different constraints!"
+_EXCLUDED_TESTS+= test_similarity_fauxware
+# Problem: "IndexError: list index out of range"
+_EXCLUDED_TESTS+= test_self_modifying_code
+# Problem: "Exception: Not a valid binary file: '/bin/false'"
+_EXCLUDED_TESTS+= test_project
+
+# Create a regular expression out of the excluded tests.
+_NOSE_EXCLUDE= (${_EXCLUDED_TESTS:S, ,|,gW})
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|%%CC%%|${CC}|g' \
+ -e 's|%%CXX%%|${CXX}|g' \
+ -e 's|%%CFLAGS%%|${CFLAGS}|g' \
+ -e 's|%%LDFLAGS%%|${LDFLAGS}|g' \
+ -e 's|%%LIBS%%|${LIBS}|g' \
+ ${WRKSRC}/native/Makefile
+
+post-install:
+ @${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/${PORTNAME}/lib/angr_native.so
+
+pre-test:
+ @${LN} -Fs ${WRKSRC_tests}/tests ${WRKSRC}/tests
+ @${LN} -Fs ${WRKSRC_binaries} ${WRKDIR}/binaries
+
+do-test:
+ @(cd ${WRKSRC}/tests && ${SETENV} ${TEST_ENV} nosetests-${PYTHON_VER} -v)
+
+.include <bsd.port.mk>
Added: head/security/py-angr/distinfo
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/py-angr/distinfo Thu Mar 12 09:13:35 2020 (r528280)
@@ -0,0 +1,7 @@
+TIMESTAMP = 1583576024
+SHA256 (angr-8.20.1.7.tar.gz) = f6c67806240b5ee5e309ec7565ef756107afb11f62d5424e474e0b0cc0637cea
+SIZE (angr-8.20.1.7.tar.gz) = 894100
+SHA256 (angr-angr-6b1a0825cbe156e2d32c577ba47ff50920f005aa_GH0.tar.gz) = ff0156bd839d02ad4b11351cf5747b59b9a419f58ca79ef4ab4ab49bab197925
+SIZE (angr-angr-6b1a0825cbe156e2d32c577ba47ff50920f005aa_GH0.tar.gz) = 1228522
+SHA256 (angr-binaries-f2de6d7a0474d22130ffadd042327536a6fda114_GH0.tar.gz) = 7bdc710d10db37d3105038eb4efda1b39e9d1149ecfaf35b1157381fe7275a4a
+SIZE (angr-binaries-f2de6d7a0474d22130ffadd042327536a6fda114_GH0.tar.gz) = 56385140
Added: head/security/py-angr/files/patch-native_Makefile
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/py-angr/files/patch-native_Makefile Thu Mar 12 09:13:35 2020 (r528280)
@@ -0,0 +1,24 @@
+--- native/Makefile.orig 2020-03-02 20:56:13 UTC
++++ native/Makefile
+@@ -2,15 +2,18 @@ UNAME := $(shell uname)
+ ifeq ($(UNAME), Darwin)
+ LIB_ANGR_NATIVE=angr_native.dylib
+ endif
++ifeq ($(UNAME), FreeBSD)
++ LIB_ANGR_NATIVE=angr_native.so
++endif
+ ifeq ($(UNAME), Linux)
+ LIB_ANGR_NATIVE=angr_native.so
+ endif
+
+-CC := gcc
+-C++C := g++
++CC := %%CC%%
++C++C := %%CXX%%
+ CFLAGS := -I "${UNICORN_INCLUDE_PATH}" -I "${PYVEX_INCLUDE_PATH}" \
+ -L "${UNICORN_LIB_PATH}" -L "${PYVEX_LIB_PATH}" \
+- -O3 -fPIC -std=c++11
++ %%CFLAGS%% %%LDFLAGS%% %%LIBS%% -fPIC -std=c++11
+ ifneq ($(DEBUG), )
+ CFLAGS := $(CFLAGS) -O0 -g
+ endif
Added: head/security/py-angr/files/patch-native_log.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/py-angr/files/patch-native_log.c Thu Mar 12 09:13:35 2020 (r528280)
@@ -0,0 +1,24 @@
+--- native/log.c.orig 2019-04-16 21:08:57 UTC
++++ native/log.c
+@@ -34,6 +34,9 @@
+ #include <unistd.h>
+
+ #include <sys/syscall.h>
++#ifdef __FreeBSD__
++#include <pthread_np.h>
++#endif
+
+ static int log_fd = STDERR_FILENO;
+ static bool log_fd_isatty = true;
+@@ -107,7 +110,11 @@ void logLog(enum llevel_t ll, const char *fn, int ln,
+ dprintf(log_fd, "%s", logLevels[ll].prefix);
+ }
+ if (logLevels[ll].print_funcline) {
++#ifdef __FreeBSD__
++ dprintf(log_fd, "[%s][%s][%d] %s():%d ", timestr, logLevels[ll].descr, (pid_t)pthread_getthreadid_np, fn, ln);
++#else
+ dprintf(log_fd, "[%s][%s][%d] %s():%d ", timestr, logLevels[ll].descr, (pid_t)syscall(__NR_gettid), fn, ln);
++#endif
+ }
+
+ va_list args;
Added: head/security/py-angr/files/patch-setup.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/py-angr/files/patch-setup.py Thu Mar 12 09:13:35 2020 (r528280)
@@ -0,0 +1,11 @@
+--- setup.py.orig 2020-03-02 20:55:10 UTC
++++ setup.py
+@@ -68,7 +68,7 @@ def _build_native():
+ pass
+
+ cmd1 = ['nmake', '/f', 'Makefile-win']
+- cmd2 = ['make']
++ cmd2 = ['gmake']
+ for cmd in (cmd1, cmd2):
+ try:
+ if subprocess.call(cmd, cwd='native', env=env) != 0:
Added: head/security/py-angr/pkg-descr
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/security/py-angr/pkg-descr Thu Mar 12 09:13:35 2020 (r528280)
@@ -0,0 +1,24 @@
+angr is a platform-agnostic binary analysis framework in a form of a suite
+of Python 3 libraries that let you load a binary and do a lot of cool things
+to it:
+
+- Disassembly and intermediate-representation lifting
+- Program instrumentation
+- Symbolic execution
+- Control-flow analysis
+- Data-dependency analysis
+- Value-set analysis (VSA)
+- Decompilation
+
+The most common angr operation is loading a binary:
+
+ p = angr.Project('/bin/bash')
+
+If you do this in an enhanced REPL like IPython, you can use tab-autocomplete
+to browse the top-level-accessible methods and their docstrings.
+
+angr is brought to you by the Computer Security Lab at UC Santa Barbara, SEFCOM
+at Arizona State University, their associated CTF team, Shellphish, the open
+source community, and @rhelmot.
+
+WWW: https://github.com/angr/angr
More information about the svn-ports-head
mailing list