#!/bin/bash

#	TeamSploit - Pen Testing With Friends
#	Copyrighted:  Justin M. Wray (wray.justin@gmail.com)
#	Special Thanks: Ben Heise (Twitter:@benheise)   Team ICF (Twitter:@ICFRedTeam)
#
#    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, or
#    (at your option) any later version.
#
#    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/>.

echo '___________                     _________      .__         .__  __   '
echo '\__    ___/___ _____    _____  /   _____/_____ |  |   ____ |__|/  |_ '
echo '  |    |_/ __ \\__  \  /     \ \_____  \\____ \|  |  /  _ \|  \   __\'
echo '  |    |\  ___/ / __ \|  Y Y  \/        \  |_> >  |_(  <_> )  ||  |  '
echo '  |____| \___  >____  /__|_|  /_______  /   __/|____/\____/|__||__|  '
echo '             \/     \/      \/        \/|__|  By:  Justin M. Wray    '
echo
echo '====================================================================='

#  Config...because we can
source teamsploit.conf

#  Notice
echo "You may need to authenticate, as MSF typical requires administrative rights"

#  Did you config it yet?
if [ $TS_CONFIG != 1 ]; then
	echo "Error, No Config...Wait...WHAT ARE YOU DOING? (Go Edit teasmploit.conf)"
	exit 1;
fi

#  Okay, we need to setup the enviroment...cause I don't know your setup...
./.setup

#  Wow..the person in front of me put there seat back, I can't see the screen..ahhh
echo "TeamSploit - Pen Testing With Friends"

echo -n "Loading Enviroment..."
for i in $(seq 1 $TS_WINDOWS); do
	if [ $i == 1 ]; then
		gnome-terminal -e 'sudo msfconsole -m .msf -r .teamsploit.rc.primary' -t "TeamSploit: Primary $i"
	else
		gnome-terminal -e 'sudo msfconsole -m .msf -r .teamsploit.rc.primary.sub' -t "TeamSploit: Primary $i"
	fi
done
gnome-terminal -e 'sudo msfconsole -m .msf -r .teamsploit.rc.listener' -t 'TeamSploit: Listener'
if [ $TS_MSFD_CONNECT == 1 ]; then
	gnome-terminal -e "nc $TS_MSFD_HOST $TS_MSFD_PORT" -t 'TeamSploit: MSFD Client'
fi

echo "Done"
