-
Notifications
You must be signed in to change notification settings - Fork 8
/
install.sh
executable file
·134 lines (101 loc) · 3.69 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
# Samsung Shannon Modem Loader, Installer Script
# A lean IDA Pro loader for fancy baseband research
# Alexander Pick 2024
declare -a IDADIRA=("ida-home-arm-9.0" "idaarm-8.4" "idaarm-8.3" "ida-pro-9.0" "idapro-8.4" "idapro-8.3")
declare -a IDABINA=("ida" "ida64" "ida64" "ida64" "ida" "ida")
echo -e ""
echo "░▀█▀░█▀▄░█▀█░░░█▀▀░█▀▀░█▄█░█░░░░░▀█▀░█▀█░█▀▀░▀█▀░█▀█░█░░░█░░░█▀▀░█▀▄"
echo "░░█░░█░█░█▀█░░░▀▀█░▀▀█░█░█░█░░░░░░█░░█░█░▀▀█░░█░░█▀█░█░░░█░░░█▀▀░█▀▄"
echo "░▀▀▀░▀▀░░▀░▀░░░▀▀▀░▀▀▀░▀░▀░▀▀▀░░░▀▀▀░▀░▀░▀▀▀░░▀░░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀░▀"
echo -e "Install Samsung Shannon Modem Loader, 2024 by Alexander Pick"
echo -e "https://github.com/alexander-pick/shannon_modem_loader\n"
function help() {
echo -e "commandline options:"
echo -e "-d <dir> specify IDA installation directory"
echo -e "-r run IDA after installation"
echo -e "-a auto mode, find IDA installation dir automatically"
echo -e "-t test mode, combines -a -r and enabled logging in IDA"
echo -e "-h print help"
exit 0
}
function install() {
cp -v shannon_load.py ${IDADIR}/loaders/
cp -v shannon_postprocess.py ${IDADIR}/python/
cp -v shannon_pal_reconstructor.py ${IDADIR}/python/
cp -v shannon_mpu.py ${IDADIR}/python/
cp -v shannon_scatterload.py ${IDADIR}/python/
cp -v shannon_generic.py ${IDADIR}/python/
cp -v shannon_structs.py ${IDADIR}/python/
cp -v shannon_names.py ${IDADIR}/python/
cp -v shannon_debug_traces.py ${IDADIR}/python/
cp -v shannon_funcs.py ${IDADIR}/python/
cp -v sig/*.sig ${IDADIR}/sig/arm/
}
function findIDA() {
if [ -z ${IDADIR} ]; then
if [ -z ${1} ]; then
ALEN=${#IDADIRA[@]}
# use for loop to read all values and indexes
for (( i=0; i<${ALEN}; i++ ));
do
echo -e "[i] checking for ${IDADIRA[$i]}"
if [ -d "${HOME}/${IDADIRA[$i]}" ]; then
IDADIR="${HOME}/${IDADIRA[$i]}"
IDABIN=${IDABINA[$i]}
echo -e "[i] found - installing and starting ${IDABINA[$i]}"
break
fi
done
else
IDADIR=${1}
if [ -z ${2} ]; then
IDABIN=ida
else
IDABIN=${2}
fi
fi
else
echo -e "[i] IDADIR env is set, overriding commandline selection"
fi
}
function run_IDA() {
IDADEBUGLOG="/tmp/ida_shannon.log"
rm -f ${IDADEBUGLOG}
touch ${IDADEBUGLOG}
# -z3003 - for performance issues
eval "${IDADIR}/${IDABIN} -L${IDADEBUGLOG} &"
tail -f ${IDADEBUGLOG}
exit 0
}
while getopts d:b:rath FLAG
do
case "${FLAG}" in
d) IDADIR_OPT=${OPTARG};;
b) IDABIN_OPT=${OPTARG};;
r) IDARUN_OPT=1;;
a) IDAAUTO_OPT=1;;
t) IDATEST_OPT=1;;
h) help;;
esac
done
if [ -n "${IDATEST_OPT}" ]; then
echo -e "[i] running in auto test mode"
findIDA
install
echo -e "[i] starting IDA with logging"
run_IDA
fi
if [ -z "${IDAAUTO_OPT}" ]; then
if [ -z "${IDADIR_OPT}" ]; then
help
fi
fi
findIDA ${IDADIR_OPT} ${IDABIN_OPT}
echo -e "[i] IDA at ${IDADIR}/${IDABIN}"
install
echo -e "[i] installation done"
if [ -n "${IDARUN_OPT}" ]; then
echo -e "[i] starting IDA"
run_IDA
fi