forked from c3rb3ru5d3d53c/binlex
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
163 lines (131 loc) · 3.82 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.PHONY: all
.PHONY: docs
.PHONY: docker
threads=1
config=Release
all: python docs
cli: git-unsafe
mkdir -p build/
cd build/ && \
cmake -S ../ \
-B . \
${args} && \
cmake --build . --config ${config} -- -j ${threads}
python: git-unsafe
mkdir -p build/
cd build/ && \
cmake -S ../ \
-B . \
-DBUILD_PYTHON_BINDINGS=true \
-DPYBIND11_PYTHON_VERSION=`python -c "import platform; print(platform.python_version())"` \
${args} && \
cmake --build . --config ${config} -- -j ${threads}
python-whl:
virtualenv -p python3 venv/
bash -c "source venv/bin/activate; BUILD_DIR=`pwd` python3 -m pip wheel -v -w build/ ."
rm -rf venv/
docs:
mkdir -p build/docs/html/docs/
cp -r docs/img/ build/docs/html/docs/
(cat Doxyfile; echo "NUM_PROC_THREADS=${threads}") | doxygen -
docs-update:
rm -rf docs/html/
cp -r build/docs/html/ docs/
docker:
@./docker.sh
docker-build:
@docker-compose build
docker-start:
@docker-compose up -d
docker-logs:
@docker-compose logs -f -t --tail 32
docker-stop:
@docker-compose stop
docker-init:
@cd scripts/ && \
./init-all.sh
docker-restart-blapi:
@docker stop $(shell docker container list --all -aqf name="blapi1")
@docker rm $(shell docker container list --all -aqf name="blapi1")
@docker-compose build blapi1
@docker-compose up -d blapi1
mongodb-shell:
@cd scripts/ && \
./mongodb-shell.sh mongodb-router1
pkg:
cd build/ && \
cpack
dist:
cd build/ && \
make package_source
git-unsafe:
@git config --global --add safe.directory `pwd`/build/capstone/src/capstone
@git config --global --add safe.directory `pwd`/build/LIEF/src/LIEF
@git config --global --add safe.directory `pwd`/build/tlsh/src/tlsh
install: git-unsafe
cd build/ && \
make install && \
ldconfig
uninstall:
cd build/ && \
make uninstall
traits: check-parameter-source check-parameter-dest check-parameter-type check-parameter-format check-parameter-arch
@echo "[-] building traits..."
@find ${source} -type f | while read i; do \
mkdir -p ${dest}/${type}/${format}/${arch}/; \
filename=`basename $${i}`; \
echo "binlex -m ${format}:${arch} -i $${i} | jq '.[] | .trait' > ${dest}/${type}/${format}/${arch}/$${filename}.traits"; \
done | parallel -u --progress -j ${threads} {}
@echo "[*] trait build complete"
traits-combine: check-parameter-source check-parameter-dest check-parameter-type check-parameter-format check-parameter-arch
@find ${source}/${type}/${format}/${arch}/ -type f -name "*.traits" | while read i; do \
echo "cat $${i} && rm -f $${i}"; \
done | parallel --halt 1 -u -j ${threads} {} | sort | uniq > ${dest}/${type}.${format}.${arch}.traits
traits-clean: check-parameter-remove check-parameter-source check-parameter-dest
awk 'NR==FNR{a[$$0];next} !($$0 in a)' ${remove} ${source} | sort | uniq | grep -Pv '^(\?\?\s?)+$$' > ${dest}
check-parameter-remove:
@if [ -z ${remove} ]; then \
echo "[x] missing remove parameter"; \
exit 1; \
fi
check-parameter-source:
@if [ -z ${source} ]; then \
echo "[x] missing source parameter"; \
exit 1; \
fi
check-parameter-dest:
@if [ -z ${dest} ]; then \
echo "[x] missing dest parameter"; \
exit 1; \
fi
check-parameter-type:
@if [ -z ${type} ]; then \
echo "[x] missing type parameter"; \
exit 1; \
fi
check-parameter-arch:
@if [ -z ${arch} ]; then \
echo "[x] missing arch parameter"; \
exit 1; \
fi
check-parameter-format:
@if [ -z ${format} ]; then \
echo "[x] missing format parameter"; \
exit 1; \
fi
clean:
rm -rf build/
rm -rf dist/
rm -rf pybinlex.egg-info/
rm -f *.so
rm -f *.whl
rm -f docker-compose.yml
rm -rf scripts/
rm -rf config/
rm -rf venv/
clean-docker:
@docker stop $(shell docker ps -a -q) 2>/dev/null || echo > /dev/null
@docker rm $(shell docker ps -a -q) 2>/dev/null || echo > /dev/null
@docker rmi $(shell docker images -a -q) 2>/dev/null || echo > /dev/null
clean-data:
rm -rf data/