forked from bata24/gef
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·117 lines (94 loc) · 2.45 KB
/
install.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
#!/bin/sh -eu
GEF24_INSTALLATION_PATH="${HOME}/.gdbinit-gef24.py"
INFOF=$(tput setaf 255)
INFOB=$(tput setab 235)
SUCCESSF=$(tput setaf 46)
SUCCESSB=
RESET=$(tput sgr0)
# Simple log function
log() {
typem=$2
message=$1
case $typem in
info)
echo "${INFOB}${INFOF}[?] Info: ${RESET}${INFOB} $message ${RESET}"
;;
success)
echo "${SUCCESSB}${SUCCESSF}[@] Success: ${RESET}${SUCCESSB} $message ${RESET}"
;;
esac
}
log "Installing Gef24!" info
log "Installing dependencies" info
log "Installing python3-pip dependencies" info
set -x
pip3 install ropper keystone-engine --break-system-packages
set +x
if [ ! "$(command -v seccomp-tools)" ]; then
log "Installing seccomp-tools" info
set -x gem install --user seccomp-tools
set +x
else
log "Detected seccomp-tools, skipping..." info
fi
if [ ! "$(command -v one_gadget)" ]; then
log "Installing one_gadget" info
set -x
gem install --user one_gadget
set +x
else
log "Detected one_gadget, skipping..." info
fi
log "Installing rp++" info
if [ "$(uname -m)" = "x86_64" ]; then
if [ ! "$(command -v rp-lin)" ]; then
set -x
wget -q https://github.com/0vercl0k/rp/releases/download/v2.1.1/rp-lin-clang.zip -P /tmp
unzip /tmp/rp-lin-clang.zip -d "${HOME}/.local/bin/"
chmod +x "${HOME}/.local/bin/rp-lin"
rm /tmp/rp-lin-clang.zip
set +x
else
log "Detected rp-lin, skipping..." info
fi
fi
log "Installing vmlinux-to-elf" info
if [ ! "$(command -v vmlinux-to-elf)" ]; then
set -x
pip3 install --user --upgrade lz4 zstandard git+https://github.com/clubby789/python-lzo@b4e39df git+https://github.com/marin-m/vmlinux-to-elf --break-system-packages
set +x
fi
log "Downloading Gef24" info
set -x
wget -q https://raw.githubusercontent.com/timetravelthree/gef24/dev/gef.py -O "${GEF24_INSTALLATION_PATH}"
set +x
log "Setting up" info
STARTUP_COMMAND="source ${GEF24_INSTALLATION_PATH}"
if [ -e "${HOME}/.gdbinit" ] && grep -q "${STARTUP_COMMAND}" "${HOME}/.gdbinit"; then
log "Gef24 seems to be already installed" info
else
set -x
cat <<EOH >>"${HOME}/.gdbinit"
# --Gef24 source file--
define init-gef24
${STARTUP_COMMAND}
end
document init-gef24
Initializes Gef24
end
# --Gef24 EOH--
init-gef24
EOH
set +x
fi
log "Installing Gef24 script into ${HOME}/.local/bin/gef24" info
set -x
cat <<EOH >"${HOME}/.local/bin/gef24"
#!/bin/sh
exec gdb -q -ex init-gef24 "\$@"
EOH
chmod +x ${HOME}/.local/bin/gef24
set +x
log "Installation finished successfully!" success
log 'Now try to run `gef24 ${BINARY_NAME}`' success
exit 0