-
Notifications
You must be signed in to change notification settings - Fork 4
/
run
94 lines (70 loc) · 2.66 KB
/
run
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
#!/bin/bash
# MAAS
# Multiplexer Adaptive Adminstrator Solution
# Configuration file
# Copyright (C) 2016 Aurélien DESBRIÈRES <aurelien@hackers.camp>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
tput clear
printf "\033[1;32mWelcome to MAAS - Multiplexer Adaptive Adminstrator Solution\033[0m%s\\n"
printf "\033[1;32mThis program will install needed dependencies\033[0m%s\\n"
printf "\033[1;32mTHIS VERSION OF MAASS WILL GRAB MUSSH TO USE IT WITHOUT INSTALL IT ON YOUR SYSTEM\033[0m%s\\n"
printf "\033[1;32mPlease report your needs to:\033[0m aurelien@hackers.camp%s\\n"
printf "\033[1;32mYou need root privileges to run it\033[0m%s\n"
the_user="$(whoami)"
# request the user approbation
while true; do
read -p "Do you wish to run MAAS $the_user? Y/n " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer Yes or no.";;
esac
done
# Verify that directory MAAS exist or create it (-p option)
mkdir -p ~/MAAS/
# Verify that maas-hostfile exist or create it
touch ~/MAAS/maas-hostfile || exit
# Clear or not the host target file
while true; do
read -p "Do you wish to create/clear your old host file or use it $the_user? C/u " cu
case $cu in
[Cc]* ) # Clear the target file
printf "%s\nMAAS will now create/clear your host list of remote machine%s\n%s\n"
truncate -s 0 ~/MAAS/maas-hostfile
break;;
[Uu]* ) break;;
* ) echo "Please answer Clear or use.";;
esac
done
# append or not new target in the target file
while true; do
read -p "Do you wish to target new machine $the_user? Y/n " yn
case $yn in
[Yy]* ) # adding remote machine to the list of hostfile
printf "MAAS will now create a host list of remote machine to analysis%s\n"
printf "Enter one IP by line (ex:root@192.168.0.2) and hit Ctrl+d to finish%s\n"
while
read line
do
my_array=("${my_array[@]}" $line)
done
printf -- '%s\n ' "${my_array[@]}" | tee -a ~/MAAS/maas-hostfile
set -f ~/MAAS/maas-hostfile
break;;
[Nn]* ) break;;
* ) echo "Please answer Yes or no.";;
esac
done
cp maas update.sh scan.awk ~/MAAS/
chmod +x ~/MAAS/maas ~/MAAS/update.sh
echo "Loading MAAS please wait"
sleep 2
sh maas