Initial commit
This commit is contained in:
41
IpTables/autoIpTables.sh
Normal file
41
IpTables/autoIpTables.sh
Normal file
@ -0,0 +1,41 @@
|
||||
# =============================================================================
|
||||
# autoIpTables.sh
|
||||
#
|
||||
# Setup multiple IpTables incoming and outgoing port mappings for easy setup.
|
||||
#
|
||||
# Copyright (c) 2025 VELENDEU, eetnaviation
|
||||
#
|
||||
# https://velend.eu/
|
||||
# https://git.velend.eu/eetnaviation/shscripts
|
||||
#
|
||||
# All rights reserved unless otherwise stated.
|
||||
#
|
||||
# Permission is hereby denied to copy, modify, distribute, sublicense,
|
||||
# or sell copies of this software without explicit prior written consent.
|
||||
#
|
||||
# All dependency trademarks and names if included are subject to copyright
|
||||
# of their respective owners.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# =============================================================================
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
declare -A PORT_MAPS=( # Write your ports in here, example [80]=1234 would direct outside port 80 to inside port 1234
|
||||
[80]=1234
|
||||
)
|
||||
|
||||
# Apply iptables rule for each mapping
|
||||
for outsidePort in "${!PORT_MAPS[@]}"; do
|
||||
insidePort="${PORT_MAPS[$outsidePort]}"
|
||||
iptables -t nat -A PREROUTING -p tcp --dport "$outsidePort" -j REDIRECT --to-port "$insidePort"
|
||||
done
|
||||
|
||||
# Display all mappings
|
||||
iptables -t nat -L -v -n
|
44
IpTables/easyIpTables.sh
Normal file
44
IpTables/easyIpTables.sh
Normal file
@ -0,0 +1,44 @@
|
||||
# =============================================================================
|
||||
# easyIpTables.sh
|
||||
#
|
||||
# Allows you to easily set IpTables mappings for incoming and outgoing ports.
|
||||
#
|
||||
# Copyright (c) 2025 VELENDEU, eetnaviation
|
||||
#
|
||||
# https://velend.eu/
|
||||
# https://git.velend.eu/eetnaviation/shscripts
|
||||
#
|
||||
# All rights reserved unless otherwise stated.
|
||||
#
|
||||
# Permission is hereby denied to copy, modify, distribute, sublicense,
|
||||
# or sell copies of this software without explicit prior written consent.
|
||||
#
|
||||
# All dependency trademarks and names if included are subject to copyright
|
||||
# of their respective owners.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
# =============================================================================
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
while true; do
|
||||
echo "easyIpTables.sh // (c) Copyright 2025 VELENDEU , eetnaviation // See source for more info."
|
||||
echo "Press CTRL+C (^C) to quit."
|
||||
read -p "Enter outside port: " outsidePort
|
||||
read -p "Enter inside port: " insidePort
|
||||
|
||||
if [[ "$outsidePort" =~ ^[0-9]+$ && "$insidePort" =~ ^[0-9]+$ ]]; then
|
||||
iptables -t nat -A PREROUTING -p tcp --dport "$outsidePort" -j REDIRECT --to-port "$insidePort"
|
||||
echo "Redirected TCP $outsidePort -> $insidePort, Here are your current IpTables mappings:"
|
||||
# Display all mappings
|
||||
iptables -t nat -L -v -n
|
||||
else
|
||||
echo "Invalid input, must be numeric ports."
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user