Skip to content

Commit

Permalink
Merge pull request #36 from keepittechie/update-installsh
Browse files Browse the repository at this point in the history
Update installsh
  • Loading branch information
SofianeHamlaoui authored Jul 23, 2024
2 parents aa55067 + d405f39 commit a5f447d
Showing 1 changed file with 92 additions and 87 deletions.
179 changes: 92 additions & 87 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,147 +1,152 @@
#!/bin/bash
#Let's Begin ::

# Let's Begin
# Colors
b='\033[1m'
u='\033[4m'
bl='\E[30m'
r='\E[31m'
g='\E[32m'
y='\E[33m'
bu='\E[34m'
m='\E[35m'
c='\E[36m'
w='\E[37m'
endc='\E[0m'
colors=( '\E[30m' '\E[31m' '\E[32m' '\E[33m' '\E[34m' '\E[35m' '\E[36m' '\E[37m' '\E[0m' )
bl=${colors[0]}
r=${colors[1]}
g=${colors[2]}
y=${colors[3]}
bu=${colors[4]}
m=${colors[5]}
c=${colors[6]}
w=${colors[7]}
endc=${colors[8]}
enda='\033[0m'

trap ctrl_c INT

function ctrl_c() {
echo ""
echo -e " ${r} Do you want to leave installation ?${endc}"
read -p " (Y/N) : " yn
echo -e " ${r}Do you want to leave the installation?${endc}"
read -p " (Y/N): " yn
case $yn in
[Yy]* ) exit;;
[Nn]* ) install;;
* ) install;;
esac
echo ""
}

function showlogo {
clear
echo """
echo """
.____ __ .__ .__
| | ____ ____ | | _______ | | | | ___________
| | / _ \_/ ___\| |/ /\__ \ | | | | _/ __ \_ __ \
| | / _ \_/ ___\| |/ /\__ \ | | | | _/ __ \_ __ \\
| |__( <_> ) \___| < / __ \| |_| |_\ ___/| | \/
|_______ \____/ \___ >__|_ \(____ /____/____/\___ >__|
\/ \/ \/ \/ \/
Sofiane Hamlaoui | 2021 | v2.3
""";
"""
echo
}
function checkroot {
showlogo
if [[ $(id -u) = 0 ]]; then
echo -e " Checking For ROOT: ${g}PASSED${endc}"
echo ""
else
echo -e " Checking For ROOT: ${r}FAILED${endc}
${y}This Script Needs To Run As ROOT${endc}"
echo ""
echo -e " ${g}Lockdoor Installer${enda} Will Now Exit"
echo
sleep 1
exit
fi
}

function chkapt {
which apt > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e " ${g} [-] Installing the Packages${endc}"
function checkroot {
showlogo
if [[ $(id -u) = 0 ]]; then
echo -e " Checking For ROOT: ${g}PASSED${endc}"
echo ""
apt-get install -y golang-go python python3-pip python3 python3-requests python3-pip gcc ruby php git wget bc curl netcat subversion openjdk-11-jre make automake gcc gzip rsync wget
gem install bundler:1.17.2
else
echo -e " ${g} [-] Skipping apt${endc}"
fi

}

function chkpacman {
which pacman > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e " ${g} [-] Installing the Packages${endc}"
echo -e " Checking For ROOT: ${r}FAILED${endc}
${y}This Script Needs To Run As ROOT${endc}"
echo ""
pacman -S go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gcc linux-headers gzip rsync wget
gem install bundler:1.17.2
else
echo -e " ${g} [-] Skipping pacman${endc}"
echo -e " ${g}Lockdoor Installer${enda} Will Now Exit"
echo
sleep 1
exit
fi
}

function chkzypper {
which zypper > /dev/null 2>&1
function install_packages {
local pkg_manager=$1
local install_cmd=$2
which $pkg_manager > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e " ${g} [-] Installing the Packages${endc}"
echo ""
zypper install go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gcc linux-headers gzip rsync wget
gem install bundler:1.17.2
echo -e " ${g} [-] Installing the Packages with $pkg_manager${endc}"
$install_cmd > /dev/null 2>&1
gem install bundler:1.17.2 > /dev/null 2>&1
else
echo -e " ${g} [-] Skipping zypper${endc}"
echo -e " ${g} [-] Skipping $pkg_manager${endc}"
fi
sleep 1
}

function chkdnf {
which dnf > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e " ${g} [-] Installing the Packages${endc}"
echo ""
dnf install go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gcc linux-headers gzip rsync wget
gem install bundler:1.17.2
else
echo -e " ${g} [-] Skipping dnf${endc}"
function install_pv {
which pv > /dev/null 2>&1
if [ "$?" -ne "0" ]; then
echo -e " ${y} [-] 'pv' not found. Installing 'pv'...${endc}"
install_packages "apt" "apt-get install -y pv"
install_packages "pacman" "pacman -S --noconfirm pv"
install_packages "zypper" "zypper install -y pv"
install_packages "dnf" "dnf install -y pv"
install_packages "yum" "yum install -y pv"
fi
sleep 1
}

function chkyum {
which yum > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e " ${g} [-] Installing the Packages${endc}"
echo ""
yum install go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gcc linux-headers gzip rsync wget
gem install bundler:1.17.2
else
echo -e " ${g} [-] Skipping yum${endc}"
fi
sleep 1
function show_progress {
local pid=$1
local delay=0.5
local spinstr='|/-\'
echo -n "Installing... "
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
local temp=${spinstr#?}
printf " [%c] " "$spinstr"
local spinstr=$temp${spinstr%"$temp"}
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
echo ""
}

function install {
showlogo && checkroot && chkapt && chkzypper && chkdnf && chkyum && chkpacman
showlogo && checkroot

install_pv

echo "Starting installation..."

(
install_packages "apt" "apt-get install -y golang-go python3 python3-pip python3-requests gcc ruby php git wget bc curl netcat-traditional subversion openjdk-11-jre make automake gzip rsync"
install_packages "pacman" "pacman -S go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gzip rsync"
install_packages "zypper" "zypper install -y go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gzip rsync"
install_packages "dnf" "dnf install -y go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gzip rsync"
install_packages "yum" "yum install -y go python python-pip python-requests python2 python2-pip gcc ruby php git wget bc curl netcat subversion jre-openjdk make automake gzip rsync"
) &
show_progress $!

clear
showlogo
echo ""
echo -e "\e[32m[-] : Where do you want to install the script [/opt/sofiane/Pentest] !\e[0m"
echo -e "\e[32m[-] : Where do you want to install the script [/opt/sofiane/Pentest]? \e[0m"
read installdir
: ${installdir:=/opt/sofiane/Pentest}
echo ""
echo -e "\e[32m[-] Installing .... !\e[0m"
echo ""

mkdir -p $installdir
mkdir -p $HOME"/.config/lockdoor"
grep -l Sofiane /usr/local/bin/* | xargs rm
echo "Location:"$installdir > $HOME"/.config/lockdoor/lockdoor.conf"
rsync -a ToolsResources/* $installdir
pip3 install lockdoor
files=$(grep -l Sofiane /usr/local/bin/* 2>/dev/null)
if [ -n "$files" ]; then
echo "$files" | xargs rm
fi
echo "Location: $installdir" > $HOME"/.config/lockdoor/lockdoor.conf"

echo "Syncing files..."
rsync -a --info=progress2 ToolsResources/* $installdir | pv -lep -s $(du -sb ToolsResources | awk '{print $1}') > /dev/null 2>&1

pip3 install lockdoor > /dev/null 2>&1

clear
# RUN
showlogo
echo -e " ${y}Lockdoor Installed Succesfully !${endc}
${y}Type ${g}lockdoor${endc}${y} in ${r} Terminl${endc}${y} to use it${endc}"
echo -e " ${y}Lockdoor Installed Successfully!${endc}
${y}Type ${g}lockdoor${endc}${y} in the ${r}Terminal${endc}${y} to use it${endc}"
}

#main
# main
install

0 comments on commit a5f447d

Please sign in to comment.