This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 247
/
Makefile
102 lines (82 loc) · 3.86 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -------------------------------------------------------------------------------
#
# Copyright (C) 2017 Cisco Talos Security Intelligence and Research Group
#
# PyREBox: Python scriptable Reverse Engineering Sandbox
# Author: Xabier Ugarte-Pedrero
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# -------------------------------------------------------------------------------
include qemu/config-host.mak
DEFINES=-I. -I..
CC=gcc
CPP=g++
PYTHON_CFLAGS = -I./pyrebox/ -I/usr/include/python2.7 -I/usr/include/python2.7 -fno-strict-aliasing -DNDEBUG -fwrapv -fstack-protector --param=ssp-buffer-size=4
PYTHON_LIBS = -L/usr/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Wl,-O1 -Wl,-Bsymbolic-functions -Xlinker -export-dynamic
CFLAGS=-Wall -O2 -g -fPIC -MMD -std=c++11 -std=gnu++11
CFLAGS+=$(PYTHON_CFLAGS)
LDFLAGS=-g -shared
LDFLAGS+=$(PYTHON_LIBS)
#Triggers for i386-softmmu
%-i386-softmmu.o: %.c
@$(CC) $(CFLAGS) $(DEFINES) -I./qemu/i386-softmmu -c -o $@ $< ; \
echo $(CPP) $@ ;
%-i386-softmmu.o: %.cpp
@$(CPP) $(CFLAGS) $(DEFINES) -I./qemu/i386-softmmu -c -o $@ $< ; \
echo $(CPP) $@ ;
%-i386-softmmu.so: %-i386-softmmu.o pyrebox/trigger_helpers-i386-softmmu.o pyrebox/utils-i386-softmmu.o
@$(CPP) -Wno-builtin-macro-redefined $(CFLAGS) $(DEFINES) -I./qemu/i386-softmmu -shared -o $@ $^ ; \
echo $(CPP) $@
#Triggers for x86-64-softmmu
%-x86_64-softmmu.o: %.c
@$(CC) $(CFLAGS) $(DEFINES) -I./qemu/x86_64-softmmu -c -o $@ $< ; \
echo $(CPP) $@ ;
%-x86_64-softmmu.o: %.cpp
@$(CPP) $(CFLAGS) $(DEFINES) -I./qemu/x86_64-softmmu -c -o $@ $< ; \
echo $(CPP) $@ ;
%-x86_64-softmmu.so: %-x86_64-softmmu.o pyrebox/trigger_helpers-x86_64-softmmu.o pyrebox/utils-x86_64-softmmu.o
@$(CPP) -Wno-builtin-macro-redefined $(CFLAGS) $(DEFINES) -I./qemu/x86_64-softmmu -shared -o $@ $^ ; \
echo $(CPP) $@
clean-triggers:
rm -f triggers/*.so triggers/*.o triggers/*.d exploit_detect/*.so exploit_detect/*.o exploit_detect/*.d
documentation:
$(MAKE) -C ./docs/ html
#We place these 2 rules so that we can compile more comfortably from this directory
all:
rm -f pyrebox-i386
rm -f pyrebox-x86_64
cp -f .pyrebox-i386 pyrebox-i386
cp -f .pyrebox-x86_64 pyrebox-x86_64
@[ ! -f ./sleuthkit/Makefile ] && ./build.sh --reconfigure || true
@$(MAKE) -C ./qemu $@
clean: clean-triggers clean-sleuthkit
@$(MAKE) -C ./qemu $@
clean-sleuthkit:
@[ -f ./sleuthkit/Makefile ] && $(MAKE) -C ./sleuthkit clean || true
test_scripts:
flake8 ./scripts --count --select=E901,E999,F821,F822,F823 --show-source --statistics
flake8 ./scripts --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics
test_plugins:
flake8 ./plugins --count --select=E901,E999,F821,F822,F823 --show-source --statistics
flake8 ./plugins --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics
test_pyrebox_test:
flake8 ./pyrebox_test --count --select=E901,E999,F821,F822,F823 --show-source --statistics
flake8 ./pyrebox_test --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics
test_pyrebox:
flake8 ./pyrebox/*.py --count --select=E901,E999,F821,F822,F823 --show-source --statistics
flake8 ./pyrebox/*.py --count --exit-zero --max-complexity=20 --max-line-length=127 --statistics
test:
@$(MAKE) test_scripts test_pyrebox_test test_pyrebox test_plugins