Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147820975
D23935.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D23935.diff
View Options
Index: head/security/Makefile
===================================================================
--- head/security/Makefile
+++ head/security/Makefile
@@ -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
Index: head/security/py-angr/Makefile
===================================================================
--- head/security/py-angr/Makefile
+++ head/security/py-angr/Makefile
@@ -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@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>
Index: head/security/py-angr/distinfo
===================================================================
--- head/security/py-angr/distinfo
+++ head/security/py-angr/distinfo
@@ -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
Index: head/security/py-angr/files/patch-native_Makefile
===================================================================
--- head/security/py-angr/files/patch-native_Makefile
+++ head/security/py-angr/files/patch-native_Makefile
@@ -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
Index: head/security/py-angr/files/patch-native_log.c
===================================================================
--- head/security/py-angr/files/patch-native_log.c
+++ head/security/py-angr/files/patch-native_log.c
@@ -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;
Index: head/security/py-angr/files/patch-setup.py
===================================================================
--- head/security/py-angr/files/patch-setup.py
+++ head/security/py-angr/files/patch-setup.py
@@ -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:
Index: head/security/py-angr/pkg-descr
===================================================================
--- head/security/py-angr/pkg-descr
+++ head/security/py-angr/pkg-descr
@@ -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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 14, 10:19 PM (8 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29689598
Default Alt Text
D23935.diff (8 KB)
Attached To
Mode
D23935: New port: security/py-angr: multi-architecture binary analysis toolkit
Attached
Detach File
Event Timeline
Log In to Comment