Last active
November 24, 2018 17:02
-
-
Save oakaigh/c86c7f1cccb4285dc63776ad1c1c8f16 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
ELTXTOK="elitex.ext.caraconnects.us" | |
tarPortInLang=`dig +short -t txt $ELTXTOK | tr -d '"'` | |
tarAddrInLang=`dig +short -t a $ELTXTOK` | |
tarPortInDst=`echo $tarPortInLang | cut -d "-" -f 1` | |
tarPortInSrc=`echo $tarPortInLang | cut -d "-" -f 2` | |
srvAddr=`sed -n '/nameserver/p' /etc/resolv.conf | head -1` | |
echo | |
echo " __ _ __ __ Servicing"; | |
echo " ___ / / (_) /____ / /_ $srvAddr"; | |
echo "/ -_) /__/ / __/ -_) __/ eLitet Inc."; | |
echo "\__/____/_/\__/\__/\__/ Internet For All."; | |
echo " "; | |
echo "eLitex HTTP Extension: Settings Updated..." | |
echo "Extensión HTTP de eLitex: configuración actualizada..." | |
echo "Port redirection from $tarPortInDst to $tarPortInSrc that applies to the following:" | |
echo "Redirección de puerto desde $tarPortInDst a $tarPortInSrc que se aplica a lo siguiente:" | |
echo | |
sysctl -w net.ipv4.ip_forward=1 | |
for tarAddr in $tarAddrInLang | |
do | |
printf "$tarAddr " | |
iptables -t nat -A OUTPUT -d $tarAddr -p tcp --dport $tarPortInDst -j DNAT --to-destination $tarAddr:$tarPortInSrc | |
iptables -t nat -A PREROUTING -d $tarAddr -p tcp --dport $tarPortInDst -j DNAT --to-destination $tarAddr:$tarPortInSrc | |
done | |
echo |
Author
oakaigh
commented
Nov 24, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment