Skip to content

Instantly share code, notes, and snippets.

@scmanjarrez
Last active September 2, 2024 21:31
Show Gist options
  • Save scmanjarrez/3b27bc4912916eeedca575d219267bd3 to your computer and use it in GitHub Desktop.
Save scmanjarrez/3b27bc4912916eeedca575d219267bd3 to your computer and use it in GitHub Desktop.
Script to convert kali into a router for HTB.
#!/bin/env bash
# Route openvpn traffic. Thanks @ippsec!
# 192.168.15.0/24 is the subnet shared betwen my kali and windows box, modify accordingly.
sudo iptables -A FORWARD -i eth0 -o tun0 -j ACCEPT
sudo iptables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -t nat -A POSTROUTING -s 192.168.15.0/24 -o tun0 -j MASQUERADE
# windows
# 192.168.15.134 is the IP of my kali box
# route add 10.0.0.0 mask 255.0.0.0 192.168.15.134
# Route ligolo-ng traffic. These routes allow accessing ligolo-ng 240.0.0.1 in windows through 10.255.255.255
sudo iptables -t nat -A PREROUTING -d 10.255.255.255/32 -i eth0 -j DNAT --to-destination 240.0.0.1
sudo iptables -A FORWARD -i eth0 -o ligolo -j ACCEPT
sudo iptables -A FORWARD -i ligolo -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# windows
# route add 10.255.255.255 mask 255.255.255.255 192.168.15.134
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment