Skip to content

Instantly share code, notes, and snippets.

@p4p1
Last active May 21, 2020
Embed
What would you like to do?
🍨🍨🍨🍨
#!/bin/bash
# tools.sh
# Created on: mer. 06 mai 2020 09:54:03 CEST
#
# ____ __ ____ __
# ( _ \ /. |( _ \/ )
# )___/(_ _))___/ )(
# (__) (_)(__) (__)
#
# Usage:
# sudo BROWSER=firefox ./tools.sh
#
# Description:
# General purpose installer for linux. Direct links will be
# saved in /var/www/html/ and wordlists in /opt/wordlists
#
# Dependencies:
# jq curl
#
# Tools links:
# Scripts:
# LinPeas.sh -> https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS
# LinEnum.sh -> https://github.com/rebootuser/LinEnum
# phpbash.php -> https://github.com/Arrexel/phpbash
# Install scripts:
# msfinstall -> https://github.com/rapid7/metasploit-framework
# Empire -> https://github.com/BC-SECURITY/Empire/
# TODO: Releases:
# pspy64 -> https://github.com/DominicBreuker/pspy
# Website:
# Burp suite -> https://portswigger.net/burp
# ZapProxy -> https://www.zaproxy.org/
# Wordlists:
# RockYou -> https://www.scrapmaker.com/data/wordlists/dictionaries/rockyou.txt
# directory-list-2.3-medium.txt -> https://raw.githubusercontent.com/thesp0nge/enchant/master/db/directory-list-2.3-medium.txt
USER=p4p1
TMP_DIR=/tmp/tools
WEB_DIR=/var/www/html
WOR_DIR=/opt/wordlists
releases_author=("DominicBreuker")
releases_app=("pspy")
website_links=("https://portswigger.net/burp" \
"https://www.zaproxy.org/")
direct_links=("https://raw.githubusercontent.com/carlospolop/privilege-escalation-awesome-scripts-suite/master/linPEAS/linpeas.sh" \
"https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh" \
"https://raw.githubusercontent.com/Arrexel/phpbash/master/phpbash.php" \
"https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb" \
"https://www.scrapmaker.com/data/wordlists/dictionaries/rockyou.txt")
scripts=("linpeas.sh" "LinEnum.sh" "phpbash.php")
installers=("msfupdate.erb")
wordlists=("rockyou.txt")
# Initial setup
if [ "$EUID" -ne 0 ]; then
echo -e "\e[41mError:\e[m Must run as root."
exit 84
fi
if [ -z "$BROWSER" ]; then
echo -e "\e[41mError:\e[m Set your \$BROWSER variable."
exit 84
else
if ! hash $BROWSER &> /dev/null; then
echo -e "\e[41mError:\e[m Can't find browser: $BROWSER."
exit 84
fi
fi
if [ ! -d "$TMP_DIR" ]; then
mkdir $TMP_DIR
fi
echo -e "\e[93mInfosec tools installer:\e[m"
# Banner
echo -e "\e[96m , ,\e[m"
echo -e "\e[96m (\\____/)\e[m"
echo -e "\e[96m (_\e[101;39moo\e[49;96m_)\e[m"
echo -e "\e[96m (O)\e[m"
echo -e "\e[96m __||__ \\)\e[m"
echo -e "\e[96m []/______\\[] /\e[m"
echo -e "\e[96m / \\______/ \\/\e[m"
echo -e "\e[96m / /__\\ \e[m"
echo -e "\e[96m (\\ /____\\ \e[m"
# Download direct links
echo
echo -e "\e[96;5;4mDownload ...\e[m"
for item in ${direct_links[*]}; do
FILE_NAME=$(echo $item| awk -F'/' '{print $NF}')
echo -n "Checking $FILE_NAME -> "
if [ -f $TMP_DIR/$FILE_NAME ]; then
echo -e "\e[1;34m:)\e[m"
else
echo -e "\e[1;31m:(\e[m"
echo "Saving script in $TMP_DIR"
curl $item --output $TMP_DIR/$FILE_NAME
fi
[[ $installers =~ (^|[[:space:]])$FILE_NAME($|[[:space:]]) ]] && chmod -v +x $TMP_DIR/$FILE_NAME
done
echo "Downloading finished"
echo
# Executing the installer scripts
echo -e "\e[96;5;4mRunning installers ...\e[m"
for item in ${installers[*]}; do
bash "$TMP_DIR/$item"
TMP=$?
if [ $TMP -ne 0 ]; then
echo -e "\e[41mError:\e[0m return value $TMP."
fi
done
echo "Install finished"
echo
# Moving scripts to the webserver for easy remote access
echo -e "\e[96;5;4mCopying to webserver ...\e[m"
for FILE_NAME in ${scripts[*]}; do
[[ $installers =~ (^|[[:space:]])$FILE_NAME($|[[:space:]]) ]] && continue
echo -n "Checking if $FILE_NAME is in $WEB_DIR -> "
if [ -f $WEB_DIR/$FILE_NAME ]; then
echo -e "\e[1;34m:)\e[m"
else
echo -e "\e[1;31m:(\e[m"
mv $TMP_DIR/$FILE_NAME $WEB_DIR/$FILE_NAME
fi
done
echo
# Setting the wordlist directory
echo -e "\e[96;5;4mCreating wordlist dir ...\e[m"
echo -n "does $WOR_DIR exist? -> "
if [ -d $WOR_DIR ]; then
echo -e "\e[1;34m:)\e[m"
else
echo -e "\e[1;31m:(\e[m"
mkdir $WOR_DIR
fi
for FILE_NAME in ${wordlists[*]}; do
echo -n "Checking if $FILE_NAME is in $WOR_DIR -> "
if [ -f $WOR_DIR/$FILE_NAME ]; then
echo -e "\e[1;34m:)\e[m"
else
echo -e "\e[1;31m:(\e[m"
mv $TMP_DIR/$FILE_NAME $WOR_DIR/$FILE_NAME
fi
done
echo
# Openning webbrowser to launch other installers
echo -e "\e[96;5;4mBrowser installers ...\e[m"
echo -e "Place the installers in this directory: \e[1;34m$PWD/installers\e[m"
mkdir $PWD/installers
for links in ${website_links[*]}; do
echo $BROWSER
su $USER -c "$BROWSER $links"
done
echo -n "Press enter when ready -> "
read a
echo -e "\b\e[32mStatus: OK\e[m"
for prog in $(ls $PWD/installers); do
bash $PWD/installers/$prog
done
echo
rm -rf $PWD/installers
echo -e "\e[96;5;4mReleases installer ...\e[m"
mkdir $TMP_DIR/bin/
for (( i=0; i < ${#releases_app[@]}; i++ )); do
let i=0
echo ${releases_app[$i]} ${releases_author[$i]}
curl https://api.github.com/repos/${releases_author[$i]}/${releases_app[$i]}/releases --output $TMP_DIR/releases
current_link=$(jq ".[0].assets[$i].browser_download_url" $TMP_DIR/releases)
while [[ $current_link != "null" ]]; do
link=${current_link//\"}
echo -e "Downloading \e[1;34m${link##*/}\e[m"
curl -L ${current_link//\"} --output $TMP_DIR/bin/${link##*/}
chmod +x $TMP_DIR/bin/${link##*/}
cp -r $TMP_DIR/bin/${link##*/} $WEB_DIR
let i=($i + 1)
current_link=$(jq ".[0].assets[$i].browser_download_url" $TMP_DIR/releases)
done
done
echo -n "All done thank you "
echo -e "\e[1;34m:)\e[m"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment