-
Notifications
You must be signed in to change notification settings - Fork 4
/
setup.bash
executable file
·86 lines (73 loc) · 1.83 KB
/
setup.bash
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
#!/bin/bash
<<com
Author: Abhinav Thakur
Email : compilepeace@gmail.com
File : setup.bash
PoE:
To automate the environment setup process for ARM shellcode development. Setup currently
installs emulation, static and dynamic analysis toolchain.
Usage:
$ ./setup.bash
com
# Default CONFIGURATION parameters (global variables)
ARM_SHELLCODE_DEV=true
x86_SHELLCODE_DEV=true
x64_SHELLCODE_DEV=true
COLOR_BRED="\033[1m\033[31m"
COLOR_BGREEN="\033[1m\033[32m"
COLOR_BYELLOW="\033[1m\033[33m"
COLOR_RESET="\033[0m"
STATUS="failed"
# $1 : msg string
# $2 : one of the cases (done/fail/info)
debugMsg()
{
MSG_STRING=""
case "$2" in
SUCCESS | success | DONE | done)
MSG_STRING="$COLOR_BGREEN[+]"
;;
ERROR | error | FAIL | fail | FAILED | failed)
MSG_STRING="$COLOR_BRED[-]"
;;
INFO | info | WARN | warn)
MSG_STRING="$COLOR_BYELLOW[*]"
;;
*) # default case
MSG_STRING="$COLOR_RESET[ ]"
esac
MSG_STRING="$MSG_STRING $1 $COLOR_RESET"
echo -e "$MSG_STRING"
}
# $1 : send "$?"
updateStatus()
{
STATUS="failed"
if [ "$1" -eq "0" ]; then
STATUS="done"
else
STATUS="failed"
fi
}
setupStaticAnalysisEnv()
{
# getting arm-linux-gnueabi-* (gcc, objdump, objcopy etc.)
# can verify toochain installed at /usr/arm-linux-gnueabi/
sudo apt install -y gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
updateStatus "$?"
debugMsg "installed ARM EABI (ARMel) toochain !" "$STATUS"
}
setupDynamicAnalysisEnv()
{
sudo apt install -y qemu-user-static
updateStatus "$?"
debugMsg "downloaded usermode-emulation tool for foreign CPU architecture !" "$STATUS"
sudo apt install -y gdb-multiarch
updateStatus "$?"
debugMsg "installed gdb-multiarch !" "$STATUS"
bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
updateStatus "$?"
debugMsg "installed GEF extension to GNU Gdb !" "$STATUS"
}
setupStaticAnalysisEnv
setupDynamicAnalysisEnv