Bash3lper/install-script-git.sh

189 lines
3.8 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
#***************************************************
# $ ./superTool.sh install|uninstall|update
#***************************************************
readonly PROGNAME=$(basename $0)
readonly PROGDIR=$(readlink -m $(dirname $0))
readonly ARGS="$@"
PATH_DEST="$PROGDIR/source"
NAME_PROGRAM="
Arachni/arachni
scrapy/dirbot
fwaeytens/dnsenum
golismero/golismero
NikolaiT/GoogleScraper
rapid7/metasploit-framework
sullo/nikto
rfunix/Pompem
smicallef/spiderfoot
sqlmapproject/sqlmap
vanhauser-thc/thc-hydra
andresriancho/w3af
anestisb/WeBaCoo
urbanadventurer/WhatWeb
wpscanteam/wpscan
epsylon/xsser
"
write_header_acsii() {
cat <<-"EOFB"
____ _ ____ _
| _ \ | | |___ \| |
| |_) | __ _ ___| |__ __) | |_ __ ___ _ __
| _ < / _` / __| '_ \ |__ <| | '_ \ / _ \ '__|
| |_) | (_| \__ \ | | |___) | | |_) | __/ |
|____/ \__,_|___/_| |_|____/|_| .__/ \___|_|
| |
|_|
EOFB
}
##### Header
write_header() {
tput clear
local h="$@"
# Move cursor to screen location Y,X (top left is 0,0)
tput setaf 6
tput cup 0 0
write_header_acsii
tput sgr0
tput cup 7 18
# Set a foreground colour using ANSI escape
tput setaf 3
echo " "
tput sgr0
tput cup 7 52
# Set a foreground colour using ANSI escape
tput setaf 3
echo " V0.32"
tput sgr0
# Set reverse video mode
tput cup 11 12
tput rev
echo -e "${h}"
tput sgr0
# rc revenir position initial
#tput rc
#tput cup 13 16
}
write_header
write_header " I N S T A L L A T I O N "
echo >&2
echo -e " ✌ Will install all ressources needed "
echo >&2
echo -e " Arachni, dirbot, dnsenum, GoLismero, GoogleScraper, "
echo -e " metasploit, nikto, Pompem, spiderfoot, sqlmap, "
echo -e " thc-hydra, W3AF, WeBacoo, WhatWeb, WPScan y XSSer."
echo >&2
if [ ! "${UID}" = 0 ]
then
echo >&2
echo >&2
echo >&2 "Only user root can run superTool."
echo >&2
exit 1
fi
which_cmd() {
local block=1
if [ "a${1}" = "a-n" ]
then
local block=0
shift
fi
unalias $2 >/dev/null 2>&1
local cmd=`which $2 2>/dev/null | head -n 1`
if [ $? -gt 0 -o ! -x "${cmd}" ]
then
if [ ${block} -eq 1 ]
then
echo >&2
echo >&2 "ERROR: Command '$2' not found in the system path."
echo >&2
echo >&2 " which $2"
exit 1
fi
return 1
fi
eval $1=${cmd}
return 0
}
# Commands.
which_cmd GIT git
which_cmd AWK awk
which_cmd RM rm
repository_clone() {
# $1 PATH_DEST
# $2 Name Program
# $3 GitHub
$GIT clone git://github.com/$3.git $1/$2
}
repository_install() {
for name in $NAME_PROGRAM
do
DIRECTORY=`echo $name | $AWK -F"/" '{ print $2 }'`
repository_clone ${PATH_DEST} $DIRECTORY $name
done
}
repository_uninstall() {
for name in $NAME_PROGRAM
do
DIRECTORY=`echo $name | $AWK -F"/" '{ print $2 }'`
if [ -d ${PATH_DEST}/$DIRECTORY ];
then
echo -e "Remove " $PATH_DEST/$DIRECTORY
$RM ${PATH_DEST}/$DIRECTORY -r
fi
done
}
repository_update() {
for name in $NAME_PROGRAM
do
DIRECTORY=`echo $name | $AWK -F"/" '{ print $2 }'`
if [ -d $PATH_DEST/$DIRECTORY ];
then
cd ${PATH_DEST}/$DIRECTORY
$GIT pull origin --verbose --progress
fi
done
}
case "$1" in
install)
repository_install
;;
uninstall)
repository_uninstall
;;
update)
repository_update
;;
*)
echo -e >&2 "Usage: install|uninstall|update \n"
;;
esac
exit 0