-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinux_Script.sh
More file actions
196 lines (188 loc) · 5.19 KB
/
linux_Script.sh
File metadata and controls
196 lines (188 loc) · 5.19 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
#use lynis for more things to add to script
################# Imports ##############
. linux_basicfunctions.sh #location of functions used by start script
. linux_mmfunctions.sh #location of functions used for main menu
. linux_ugmfunctions.sh #location of functions used for User and Group Settings menu
. ScriptSettings.sh
######## Global Variables ##############
thedate=$(date)
####################################################################################
###################################### MENU's ######################################
function main_menu {
clear
#if statement for determining which title to show
if [[ ${dist} = "Ubuntu" ]] || [[ ${dist} = "ubuntu" ]]; then
linUbunut
elif [[ ${dist} = "Debian" ]] || [[ ${dist} = "debian" ]]; then
linDebian
fi
echo -e "SCRIPT SETTINGS:\n" | tee Script_log.txt
echo -e " ${ssh} \n ${ftp} \n ${proftp} \n ${vsftpd} \n ${web} \n ${apaweb} \n ${nginweb} \n ${smb} \n ${sql} \n ${rsnc}" >> Script_log.txt
echo -e "END OF SCRIPT SETTINGS\n\n" | tee Script_log.txt
#Main Menu for most functions
echo "If there is a * after the command, then the command has either not been made yet or is not finished."
echo ""
echo "Main Menu"
echo ""
echo "Commands:"
echo "1.) Updates 2.) User Settings "
echo "3.) Firewall Settings 4.) Services Settings*"
echo "5.) Remove Prohibited Software* 6.) Malware Removal"
echo "7.) Audit using Lynis 8.) Basic Configurations*"
echo "9.) Search for Prohibited Media"
echo ""
echo "85.) Run all at once*"
echo "99.) Quit 100.) Restart"
echo ""
echo ""
read -p 'Which command would you like to use? : ' com
if [[ ${com} = 1 ]]; then
clear
updt
echo ""
echo "Please restart for full update to complete..."
read -p 'Press Enter key to continue: '
clear
main_menu
elif [[ ${com} = 2 ]]; then
clear
usr_gru
elif [[ ${com} = 3 ]]; then
clear
fwset
read -p 'Press Enter key to continue: '
clear
main_menu
elif [[ ${com} = 6 ]]; then
clear
clamtime
read -p 'Press Enter key to continue: '
clear
main_menu
elif [[ ${com} = 7 ]]; then
clear
alyn
read -p 'Press Enter key to continue: '
clear
main_menu
elif [[ ${com} = 8 ]]; then
clear
basic_config
read -p 'Press Enter key to continue: '
clear
main_menu
elif [[ ${com} = 9 ]]; then
clear
srchmedia
read -p 'Press Enter key to continue: '
clear
main_menu
elif [[ ${com} = 99 ]]; then
clear
exit
elif [[ ${com} = 100 ]]; then
sudo reboot
fi
}
function usr_gru {
clear
#for determining which title to show
if [[ ${dist} = "Ubuntu" ]] || [[ ${dist} = "ubuntu" ]]; then
linUbunut
elif [[ ${dist} = "Debian" ]] || [[ ${dist} = "debian" ]]; then
linDebian
else
return
fi
#Menu for user and Group settings
echo ""
echo "User and Group settings"
echo ""
echo "Commands:"
echo "1.) Add User 2.) Remove User"
echo "3.) Add Group 4.) Remove Group"
echo "5.) Add user to Group 6.) Remove user from Group"
echo "7.) List local users 8.) List Local Groups"
echo "9.) List members of group 10.) List the groups an user is in"
echo "11.) Change all users passwords at once "
echo ""
echo "99.) Back to Main Menu"
read -p 'Which command would you like to use? : ' com
if [[ ${com} = 1 ]]; then
clear
aduser
usr_gru
elif [[ ${com} = 2 ]]; then
clear
rmuser
usr_gru
elif [[ ${com} = 3 ]]; then
clear
crtgru
usr_gru
elif [[ ${com} = 4 ]]; then
clear
rmgru
usr_gru
elif [[ ${com} = 5 ]]; then
clear
usrtogru
usr_gru
elif [[ ${com} = 6 ]]; then
clear
rmfrogru
usr_gru
elif [[ ${com} = 7 ]]; then
clear
lsusrs
usr_gru
elif [[ ${com} = 8 ]]; then
clear
lsgrus
usr_gru
elif [[ ${com} = 9 ]]; then
clear
grumem
usr_gru
elif [[ ${com} = 10 ]]; then
clear
usrgrumem
usr_gru
elif [[ ${com} = 11 ]]; then
clear
chpaswdall
usr_gru
elif [[ ${com} = 99 ]]; then
main_menu
fi
}
########################################
############### Start Script ###########
function start_scrpt {
clear
sudo chsh /bin/bash
echo ""
if [[ $(/usr/bin/id -u) -ne 0 ]]; then #this statement checks for if you are running as superuser (sudo)
echo "You are not root. You must be running as root to use this script"
sleep 1s
exit
fi
echo "Log Created ${thedate}" > Script_log.txt
sudo chmod 777 Script_log.txt
read -p 'Have you completed all of the Forensics Questions? [y/n] : ' fqs
if [[ ${fqs} = "y" ]]; then
echo
elif [[ ${fqs} = "debug" ]]; then #for debugging
set -x #Displays script code while running
echo
else
echo "Please complete the Forensics Questions first before you use this script."
sleep 3s
exit
fi
distro_select #asks users what distro they are using, then open main menu for that 'distro'
}
########################################
start_scrpt
########################################