#!/bin/bash
# ==============================================================================
#    _____                  __ _                 
#   / ____|                / _(_)                
#  | (___  _ __   ___   ___| |_ _ _ __   __ _    
#   \___ \| '_ \ / _ \ / _ \  _| | '_ \ / _` |   
#   ____) | |_) | (_) | (_) | | | | | | | (_| |  
#  |_____/| .__/ \___/ \___/|_| |_|_| |_|\__, |  
#         | |                             __/ |  
#         |_|                            |___/   
#                    SPOOFING.CC                 
# ==============================================================================
# Fast, local IPHM setup for Debian/Ubuntu based systems.
# Buy High-Performance Spoofing Servers at https://spoofing.cc
# ==============================================================================

# Ensure script is run as root
if [ "$EUID" -ne 0 ]; then
    echo ''
    echo '[!] Error: This installation script must be run with root privileges.'
    echo '    Please run as root or prefix with sudo:'
    echo '    sudo ./spoof_check_apt.sh'
    echo ''
    exit 1
fi

echo ''
echo '[+] Spoofing.cc Installation Script for Debian/Ubuntu (*NIX)'
echo '[*] This tool securely installs dependencies for local IPHM testing.'
echo '[*] We do not use CAIDA tools. Protect your server. Keep testing local.'
echo ''
echo '[+] Installing scapy, tcpdump, and required dependencies...'
echo '[-] This may take up to 2-3 minutes depending on your network.'

# Optimized silent installation with error checks
apt-get update -qq && apt-get install net-tools bind9-dnsutils inetutils-tools tcpdump python3-scapy -y -qq
if [ $? -ne 0 ]; then
    echo ''
    echo '[!] Error: Package installation failed. Please check your internet connection and APT sources.'
    echo ''
    exit 1
fi

echo ''
echo '[+] Downloading payload: spoof_test.py from spoofing.cc...'
wget -qO spoof_test.py https://spoofing.cc/spoof_test.py || curl -sLo spoof_test.py https://spoofing.cc/spoof_test.py
if [ $? -ne 0 ]; then
    echo ''
    echo '[!] Warning: Could not download spoof_test.py from spoofing.cc.'
    echo '    Please ensure your DNS is configured properly or transfer the file manually.'
    echo ''
else
    chmod +x spoof_test.py
fi

echo ''
echo '[=============================================================]'
echo ' [SUCCESS] Installation Complete.'
echo ' [ACTION]  Next, launch the testing script against your target:'
echo '           sudo python3 spoof_test.py <target_ip>'
echo '[=============================================================]'
echo ''
