Skip to content

Commit

Permalink
Merge pull request #13 from bglebrun/master
Browse files Browse the repository at this point in the history
Everything is working. Merging. Any further changes can be made with new pull requests. Thanks!
  • Loading branch information
joelillo authored Jan 27, 2017
2 parents a415bbf + 28a8b66 commit a4f1809
Showing 1 changed file with 105 additions and 10 deletions.
115 changes: 105 additions & 10 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
#
# RITA is brought to you by Offensive CounterMeasures.
# offensivecountermeasures.com
# offensivecountermeasures.com

set -o errexit
set -o pipefail
Expand All @@ -15,23 +15,38 @@ __help() {
Welcome to the RITA installer.
Usage:
Usage:
${_NAME} [<arguments>]
${_NAME} -h | --help
Options:
-h --help Show this help message.
-i --install-dir Directory to install to.
HEREDOC
}

__prep() {
cat <<HEREDOC
So here's what this script will need to do to prepare for RITA:
1) Download and install GNU Netcat, Bro, Golang, and the latest version of MongoDB.
The MongoDB, netcat and golang versions we'd like aren't a part of the regular Ubuntu apt packages, but this script will add the key to the latest MongoDB repo to your package manager and install/auto config it and everything else.
2) Set up a Golang development enviornment in order to 'go get' and 'build' RITA.
This requires us to create directory "go" in your home folder and add a new PATH and GOPATH entry to your .bashrc
HEREDOC
}

__title() {
cat <<HEREDOC
_ \ _ _| __ __| \
/ | | _ \
_|_\ ___| _| _/ _\
_ \ _ _| __ __| \
/ | | _ \
_|_\ ___| _| _/ _\
Brought to you by the Offensive CounterMeasures
Expand All @@ -55,9 +70,77 @@ __install() {
fi
fi

sudo apt update

sudo apt install -y bro
sudo apt install -y broctl
sudo apt install -y build-essential

# golang most recent update
wget https://storage.googleapis.com/golang/go1.7.1.linux-amd64.tar.gz
sudo tar -zxvf go1.7.1.linux-amd64.tar.gz -C /usr/local/
sudo rm go1.7.1.linux-amd64.tar.gz

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc

echo -e "
[+] Done! Now just need to configure Go dev environment...
\e[0m"

sleep 3s

if [[ -z "${GOPATH}" ]];
then
mkdir -p $HOME/go/{src,pkg,bin}
echo 'export GOPATH=$HOME/go' >> $HOME/.bashrc
export GOPATH=$HOME/go
echo 'export PATH=$PATH:$GOPATH/bin' >> $HOME/.bashrc
export PATH=$PATH:$GOPATH/bin
else
echo -e "[+] GOPATH seems to be set, we'll skip this part then for now
"
fi

echo -e "[+] Now we need to get package key and MongoDB package...
"

sleep 3s

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6

echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list

sudo apt update
sudo apt install -y mongodb-org

sudo mkdir -p /data/db
sudo chown -R $USER /data

printf "[+] Running 'go get github.com/ocmdev/rita'\n\n"

/usr/local/go/bin/go get github.com/ocmdev/rita
cd $GOPATH/src/github.com/ocmdev/rita

printf "[+] Done! Now we just have to build and install RITA.\n"
/usr/local/go/bin/go build
/usr/local/go/bin/go install

echo "[+] Make sure you also configure Bro and run with 'sudo broctl deploy' and make sure MongoDB is running with the command 'mongo' or 'sudo mongo'.
"



echo -e "
[+] If you need to stop Mongo at any time, run 'sudo service mongod stop'
[+] In order to finish the installation, reload bash config with 'source ~/.bashrc'.
[+] Also make sure to start the mongoDB service with 'sudo service mongod start before running RITA.
[+] You can access the mongo shell with 'sudo mongo'
"

printf "[+] Transferring files\n"
mkdir $_RITADIR

cp -r etc $_RITADIR/etc
cp LICENSE $_RITADIR/LICENSE

Expand All @@ -78,6 +161,18 @@ __install() {
fi
fi

printf "[+] Installing gnu-netcat to /usr/local/rita\n"
# gnu-netcat
wget https://sourceforge.net/projects/netcat/files/netcat/0.7.1/netcat-0.7.1.tar.gz
tar -zxf netcat-0.7.1.tar.gz
rm netcat-0.7.1.tar.gz
cd netcat-0.7.1
./configure --prefix=/usr/local/rita
sudo make
sudo make install
cd ..
rm -rf netcat-0.7.1

printf "Thank you for installing RITA!\n"
printf "OCMDev Group projects IRC #ocmdev on OFTC\n"
printf "Happy hunting\n"
Expand All @@ -97,9 +192,9 @@ __entry() {
fi

# Check to see if the user has permission to install to this directory
if [ -w $_INSDIR ]
if [ -w $_INSDIR ]
then
__install
__install
else
printf "You do NOT have permission to write to $_INSDIR\n\n"
__help
Expand Down

0 comments on commit a4f1809

Please sign in to comment.