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 249
/
build.sh
executable file
·137 lines (123 loc) · 4.06 KB
/
build.sh
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
#!/bin/bash
# -------------------------------------------------------------------------------
#
# 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.
#
# -------------------------------------------------------------------------------
root_path=$(pwd)
pyrebox_path=$root_path/pyrebox
volatility_path=$root_path/volatility
qemu_path=$root_path/qemu
sleuthkit_path=$root_path/sleuthkit
show_help="no"
debug="no"
rebuild_vol="no"
reconfigure="no"
jobs=8
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
for opt do
optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
case "$opt" in
--help|-h) show_help="yes"
;;
--debug) debug="yes"
;;
--reconfigure) reconfigure="yes"
;;
--jobs=*) jobs=$optarg
;;
*) echo "ERROR: unknown option $opt"; show_help="yes"
;;
esac
done
if test x"$show_help" = x"yes" ; then
cat << EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
EOF
echo "Standard options:"
echo " --help print this message"
echo " --debug compile for debug"
echo " --jobs=n build using n parallel processes"
echo " --reconfigure reconfigure pyrebox"
echo ""
exit 1
fi
#----------------------- QEMU -----------------------
if [ x"${reconfigure}" = xyes ] || [ ! -f ${qemu_path}/config-host.mak ] || [ ! -f ${sleuthkit_path}/Makefile ]; then
echo -e "\n${GREEN}[*] Configuring The Sleuth Kit...${NC}\n"
cd ${sleuthkit_path}
./bootstrap
if [ $? -ne 0 ]; then
echo -e "\n${RED}[!] Could not configure The Sleuth Kit!${NC}\n"
exit 1
fi
./configure
if [ $? -ne 0 ]; then
echo -e "\n${RED}[!] Could not configure The Sleuth Kit!${NC}\n"
exit 1
fi
cd $root_path
echo -e "\n${GREEN}[*] Configuring qemu...${NC}\n"
git submodule deinit -f .
git submodule init
git submodule update -f --recursive
cd ${qemu_path}
qemu_configure_flags=""
if [ x"${debug}" = xyes ]
then
qemu_configure_flags='--enable-debug'
fi
./configure --disable-docs --disable-libiscsi --target-list=i386-softmmu,x86_64-softmmu ${qemu_configure_flags}
if [ $? -ne 0 ]; then
echo -e "\n${RED}[!] Could not configure QEMU${NC}\n"
exit 1
fi
#----------------------- PYREBOX -----------------------
echo -e "\n${GREEN}[*] Configuring pyrebox...${NC}\n"
config_h=$pyrebox_path/config.h
test -f $config_h && rm $config_h
echo "//# Automatically generated by configure - do not modify" > $config_h
echo "#define VOLATILITY_PATH \"$volatility_path\"" >> $config_h
echo "#define PYREBOX_PATH \"$pyrebox_path\"" >> $config_h
echo "#define ROOT_PATH \"$root_path\"" >> $config_h
fi
#----------------------- PYREBOX -----------------------
echo -e "${GREEN}\n[*] Building The Sleuth Kit...${NC}\n"
cd $sleuthkit_path
make -j${jobs}
if ! [ -f $sleuthkit_path/tsk/.libs/libtsk.so ]; then
echo -e "${RED}\n[!] Oops... build failed!${NC}\n"
exit 1
fi
echo -e "${GREEN}\n[*] Building pyrebox...${NC}\n"
cd $root_path
make -j${jobs}
if ! [ -f qemu/i386-softmmu/qemu-system-i386 ]; then
echo -e "${RED}\n[!] Oops... build failed!${NC}\n"
exit 1
fi
if ! [ -f qemu/x86_64-softmmu/qemu-system-x86_64 ]; then
echo -e "${RED}\n[!] Oops... build failed!${NC}\n"
exit 1
fi
echo -e "${GREEN}\n\n[*] Done, enjoy!${NC}"