You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#Metasploit-like print statements: status, good, bad and notification. Gratouitiously copied from Darkoperator's metasploit install script.
12
+
13
+
functionprint_status ()
14
+
{
15
+
echo -e "\x1B[01;34m[*]\x1B[0m $1"
16
+
}
17
+
18
+
functionprint_good ()
19
+
{
20
+
echo -e "\x1B[01;32m[*]\x1B[0m $1"
21
+
}
22
+
23
+
functionprint_error ()
24
+
{
25
+
echo -e "\x1B[01;31m[*]\x1B[0m $1"
26
+
}
27
+
28
+
functionprint_notification ()
29
+
{
30
+
echo -e "\x1B[01;33m[*]\x1B[0m $1"
31
+
}
32
+
33
+
########################################
34
+
#Error Checking function. Checks for exist status of last command ran. If non-zero assumes something went wrong and bails script.
35
+
36
+
functionerror_check
37
+
{
38
+
39
+
if [ $?-eq 0 ];then
40
+
print_good "$1 successfully completed."
41
+
else
42
+
print_error "$1 failed. Please check $logfile for more details, or contact deusexmachina667 at gmail dot com for more assistance."
43
+
exit 1
44
+
fi
45
+
46
+
}
47
+
48
+
########################################
49
+
#Pre-setup. First, if the aanval directory exists, delete it. It causes more problems than it resolves, and usually only exists if the install failed in some way. Wipe it away, start with a clean slate.
50
+
51
+
if [ -d /var/www/html/aanval ];then
52
+
print_notification "aanval directory exists. Deleting to prevent issues.."
53
+
rm -rf /var/www/html/aanval
54
+
fi
55
+
execdir=`pwd`
56
+
if [ !-f$execdir/full_autosnort.conf ];then
57
+
print_error "full_autosnort.conf was NOT found in $execdir. This script relies HEAVILY on this config file. The main autosnort script, full_autosnort.conf and this file should be located in the SAME directory to ensure success."
#Creating the database infrastructure for Aanval -- We make the database aanvaldb and give the snort user the ability to do work on it.
92
+
#This database is totally separate from the snort database, BOTH must be present.
93
+
94
+
print_status "Configuring mysql to work with Aanval.."
95
+
96
+
mysql -u root -p$root_mysql_pass -e "create database aanvaldb;"&>>$aanval_logfile
97
+
error_check 'Aanval database creation'
98
+
99
+
100
+
#granting the snort user the ability to maintain the snort database so Aanval doesn't need root dba creds.
101
+
102
+
print_status "Granting snort database user permissions to operate on aanval's database.."
103
+
mysql -u root -p$root_mysql_pass -e "grant create, insert, select, delete, update on aanvaldb.* to snort@localhost identified by '$snort_mysql_pass';"&>>$aanval_logfile
104
+
error_check 'Grant permissions to aanval database'
105
+
106
+
########################################
107
+
108
+
#Here we're making some virtual hosts in /etc/httpd/conf/httpd.conf to support SSL, and ensuring proper file perms for aanval
109
+
110
+
111
+
print_status "Adding Virtual Host settings and reconfiguring httpd to use SSL.."
print_status "Adding init/systemd script for aanval background processors.."
164
+
165
+
#This is code to check what centOS release it is we're running on and copy either the sys V init script and include it, or the systemd script for aanval's BPUs. We do some checks to make sure the systemd/init script are in the same directory the aanval installer script is in.
chkconfig aanvalbpu --level 345 on &>>$aanval_logfile
203
+
error_check 'Init Script creation'
204
+
print_notification "aanvalbpu init script located in /etc/init.d/aanvalbpu"
205
+
fi
206
+
fi
207
+
208
+
########################################
209
+
#This restart is to make sure the configuration changes to httpd were performed succesfully and do not cause any problems starting/stopping the service.
210
+
print_status "Restarting httpd.."
211
+
service httpd restart &>>$aanval_logfile
212
+
error_check 'httpd restart'
213
+
214
+
print_notification "The log file for this interface installation is located at: $aanval_logfile"
0 commit comments