-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
55 lines (36 loc) · 1.59 KB
/
setup.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
#!/bin/sh
# Initial version 2020-09-10 by Tim Fournet <[email protected]>
# Updated 2020-09-10 by Tim Fournet <[email protected]>
basedir=/opt/imp_hunter
dbdir=$basedir/var
confdir=$basedir/etc
domainfile=$confdir/domains.txt
ignorefile=$confdir/domains-ignore.txt
foundfile=$dbdir/found-domains.txt
clear
echo "Making sure required packages are installed (docker, bind-utils, Perch SIEM Functionality)"
which docker || yum -y install docker
sed -ie "s/enabled=1/enabled=0/g" /etc/yum/pluginconf.d/subscription-manager.conf # Docker installs this for some stupid reason
which dig || yum -y install bind-utils
rpm -q perch_siem || (yum -y install perch_siem && systemctl restart logstash)
echo "Creating Blank Config Files"
if [[ ! -d $basedir ]]; then mkdir -p $basedir; fi
if [[ ! -d $dbdir ]]; then mkdir -p $dbdir; fi
if [[ ! -d $confdir ]]; then mkdir -p $confdir; fi
if [[ ! -f $ignorefile ]] ; then touch $ignorefile; fi
if [[ ! -f $domainfile ]] ; then touch $domainfile; fi
echo "Installing Scripts"
installdir="/opt/imp_hunter"
scriptfile="imp_hunter.sh"
updatescript="update_imp_hunter.sh"
mkdir -p $installdir
cp -f sh/$scriptfile $installdir
chmod a+x $installdir/$scriptfile
cp -f sh/$updatescript $installdir
chmod a+x $installdir/$updatescript
echo "Setting up Cron Job"
ln -s $installdir/$scriptfile /etc/cron.daily
ln -s $installdir/$updatescript /etc/cron.weekly
echo "Initial setup complete. Add domain(s) to monitor to $domainfile and run $installdir/$scriptfile to run manually."
echo "Add domains you wish to ignore to $ignorefile"
echo "System will automatically scan nightly"