This repository has been archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
yowsapp_installer_osx.sh
executable file
·161 lines (138 loc) · 4.64 KB
/
yowsapp_installer_osx.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env bash
RED='\033[1;31m'
ORANGE='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
assistant() {
printf "Prepare ${ORANGE}Yowsapp Installer Assistant${NC}\n"
printf "${NC}--------------------------\n"
printf "${NC}Select the option that best suits your needs: \n"
printf "${CYAN}1. ${NC}Install Yowsapp Framework: \n"
printf "${CYAN}2. ${NC}Full Update Yowsapp Framework: \n"
printf "${CYAN}3. ${NC}Register new Whatsapp Phone on Yowsapp Framework: \n"
read -p "${CYAN}Insert your option: " installOption
if [ $installOption == 1 ]
then
fullYowsappInstall
fi
if [ $installOption == 2 ]
then
updateYowsapp
fi
if [ $installOption == 3 ]
then
loginWhatsapp
fi
wait
}
prepare_enviroment() {
printf "Prepare ${ORANGE}OSX Enviroment${NC}\n"
printf "${NC}--------------------------\n"
sudo brew update
wait
sudo brew install python && sudo brew install python-pip && sudo brew install python3 && sudo brew install python3-pip
wait
sudo brew install openssl
wait
sudo pip install yowsup && sudo pip3 install yowsup && pip install pycrypto && pip install blinker && pip3 install pycrypto && pip3 install blinker && pip install cryptography==2.6.1 && pip3 install cryptography==2.6.1 && pip install flask && sudo pip3 install flask
wait
}
install_requirements() {
module_requirements="$1"
#printf "pip3 -qqq install -r $module_requirements"
pip3 -qqq install -r $module_requirements
return_code=$?
if [ $return_code != 0 ]; then
printf "${RED}Error:[%d]. Try running it with root privilages\n" $return_code
exit $return_code
fi
}
install_forked_yowsup() {
printf "Installing ${ORANGE}yowsup libraries${NC}\n"
printf "${NC}--------------------------\n"
cd libs/
sudo rm -R yowsup
wait
sudo rm -R yowsup.egg-info
wait
sudo rm -R build
wait
git clone https://github.com/tgalal/yowsup.git
wait
sudo python yowsup/setup.py install && sudo python3 yowsup/setup.py install
wait
cd python-axolotl
python3 setup.py -qqq install
wait
printf "${NC}--------------------------\n"
# Return to root
cd ../../
}
whatsapp_login() {
printf "Sign in on ${CYAN}WhatsApp${NC}\n"
printf "${NC}Set your whatsapp information here. If the validation if success, yo receive a sms or call with WhatsApp code: \n"
printf "${NC}--------------------------\n"
read -p "Enter your country code: " countryCode
read -p "Enter your mobile number without country code and + and 00: " mobileNumber
read -p "Enter your MCC code <Lis of all MCC codes: https://www.mcc-mnc.com/>: " mccCode
read -p "Enter your MNC code <Lis of all MCC codes: https://www.mcc-mnc.com/>: " mncCode
read -p "Insert option number for code validation: 1. SMS - 2. VOICE: " validationOption
if [ $validationOption == 1 ]
then
sudo yowsup-cli registration --requestcode sms --config-phone $countryCode$mobileNumber --config-cc $countryCode --config-mcc $mccCode --config-mnc $mncCode
fi
if [ $validationOption == 2 ]
then
sudo yowsup-cli registration --requestcode voice --config-phone $countryCode$mobileNumber --config-cc $countryCode --config-mcc $mccCode --config-mnc $mncCode
fi
wait
printf "WhatsApp Code Validation\n"
printf "${NC}Insert the code: \n"
read -p "Enter a 6 numbers code: " smsCode
sudo yowsup-cli registration --register $smsCode --config-phone $countryCode$mobileNumber
wait
}
install_modules() {
printf "Configuring modules\n"
printf "${NC}--------------------------\n"
cd modules
for D in *; do
if [ -d "${D}" ] && [ "${D}" != "__pycache__" ]; then
if [ -f ${D}/requirements.txt ]; then
printf "[${CYAN}${D}${NC}] Installing dependencies...\n"
module_requirements="${D}/requirements.txt"
install_requirements "$module_requirements"
else
printf "[${CYAN}${D}${NC}] All good...\n"
fi
fi
done
wait
printf "${NC}--------------------------\n"
# Return to root
cd ../
}
install_app_dependencies() {
printf "Configuring framework\n"
printf "${NC}--------------------------\n"
printf "[${CYAN}mac${NC}] Installing dependencies...\n"
app_requirements="app/requirements.txt"
install_requirements "$app_requirements"
wait
}
fullYowsappInstall () {
prepare_enviroment
install_forked_yowsup
install_modules
install_app_dependencies
whatsapp_login
}
updateYowsapp () {
install_forked_yowsup
install_modules
install_app_dependencies
}
loginWhatsapp () {
whatsapp_login
}
assistant