-
Notifications
You must be signed in to change notification settings - Fork 175
/
setup_mac.sh
executable file
·129 lines (92 loc) · 2.51 KB
/
setup_mac.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
#!/usr/bin/env bash
# MARA_Framework/setup_mac.sh
# setup_mac.sh
# Install MARA dependencies
# Tested on:
# macOS Mojave (10.14.4)
set -euo pipefail
# -e exit if any command returns non-zero status code
# -u prevent using undefined variables
# -o pipefail force pipelines to fail on first non-zero status code
IFS=$'\n\t'
# Set Internal Field Separator to newlines and tabs
# This makes bash consider newlines and tabs as separating words
# See: http://redsymbol.net/articles/unofficial-bash-strict-mode/
function check_brew_installed {
if ! [ -x "$(command -v brew)" ]; then
echo "Brew not installed"
echo "It is required to install some dependencies"
echo "https://brew.sh"
exit 1
fi
}
function brew_deps {
# Update brew and all formulas
brew update -v
brew_packages=(python python2 bash gnu-sed git tree figlet aha)
# Sed will replace your BSD sed with GNU sed
# aha - Ansi HTML Adapter
for package in "${brew_packages[@]}"; do
brew install "${package}"
done
}
function install_java {
# Java JDK
brew cask install java
}
function pip_deps {
pip3_packages=(Jinja2 pydot configparser smalisca trueseeing)
# Jinja2 - Androwarn dependencies
# pydot - Smali graph generation dependency
# Upgrade pip
sudo -H pip install --upgrade pip
sudo -H pip3 install --upgrade pip
for package in "${pip3_packages[@]}"; do
sudo -H pip3 install "${package}"
done
sudo -H pip2 install unirest
}
function install_apkid {
sudo -H pip2 install wheel
sudo -H pip2 wheel --wheel-dir=/tmp/yara-python --build-option="build" --build-option="--enable-dex" git+https://github.com/VirusTotal/yara-python.git@v3.10.0
sudo -H pip2 install --no-index --find-links=/tmp/yara-python yara-python
sudo -H pip2 install apkid
}
function make_shell_files_executable {
for file in $(echo ./*.sh); do
if ! [ -x "${file}" ]; then
chmod +x "${file:?}"
fi
done
}
function clean_up {
# Clean up
cleanup_dirs=(documentation_old tools_old update)
for dir in "${cleanup_dirs[@]}"; do
if [[ -d "${dir}" ]]; then
rm -rf "{dir:?}"
fi
done
}
function main {
declare -a brew_packages
declare -a pip3_packages
declare -a cleanup_dirs
make_shell_files_executable
check_brew_installed
brew_deps
install_java
pip_deps
install_apkid
# TODO: Install whatweb
# https://github.com/urbanadventurer/WhatWeb
# Increase maximum java heap size for Jadx
echo "export JAVA_OPTS='-Xmx4G'" >> ~/.bashrc
source ~/.bashrc
# Make tools executable
sudo chown -R "${USER}" tools/
chmod -R +x tools/
clean_up
exit 0
}
main "$@"