Last active
March 19, 2025 09:23
-
-
Save oeai/d4c502e6169efe0a26ab4cfecf6ebcf7 to your computer and use it in GitHub Desktop.
nft script to forward ports in the system to send outer space data from exact port into the void network
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
| #// code by OeAi / Symbiants // in date of Aug 2024 | |
| #// [+gp] - free to use for good purposes. prohibited for crimes and all such bad stuff against people o[r/a]nd systems | |
| #// in other terms more like GPLv3(-xk +gp) * -xk means except sign keys and such - as this is a part of author?publisher identity | |
| #// so you don't need to give it away, but you need to provide compatibility to use with other modded soft | |
| #// Basically this script has come with peace from years before with the code made in March 2006 | |
| #// by Craig Zeller's (zeller@fatpenguin.com), Bob Sully (rcs@malibyte.net), Jeff Carlson (jeff@ultimateevil.org) | |
| #// Rohan Amin (rohan@rohanamin.com) and Erik Wasser (erik.wasser@iquer.com) $ GPLv2+ i guess | |
| EIF = "your.extremal.netw.interface" | |
| IIF = "your.internal.netw.iface" | |
| NETW = "your.network.ip/addr" | |
| function forwardPortToDest () | |
| { #PROTO = $3; #CLIENT = $2; #PORT = $1; | |
| nft add rule ip filter FORWARD iif $IIF oif $EIF ip protocol $3 ip saddr $2 $3 dport $1 accept | |
| nft add rule ip nat PREROUTING iif $IIF $3 dport $1 ip saddr $2 accept | |
| nft add rule ip filter FORWARD iif $EIF oif $IIF ip protocol $3 ip daddr $2 $3 sport $1 ct state established,related accept | |
| } | |
| function forwardPortInNetw () | |
| { #PROTO = $3; #CLIENT = $2; #PORT = $1; | |
| nft add rule ip filter FORWARD iif $IIF oif $EIF ip protocol $3 ip saddr $2 $3 sport $1 accept | |
| nft add rule ip nat PREROUTING iif $IIF $3 sport $1 ip saddr $2 accept | |
| nft add rule ip filter FORWARD iif $EIF oif $IIF ip protocol $3 ip daddr $2 $3 dport $1 ct state established,related,new accept | |
| } | |
| function fwdTcpNetw (){ | |
| # openPortToDest "{ $1 }" "{$NETW}" "tcp" | |
| forwardPortToDest "{ $1 }" "{$NETW}" "tcp" | |
| } | |
| function fwdUdpNetw (){ | |
| # openPortToDest "{$1}" "{$NETW}" "udp" | |
| forwardPortToDest "{$1}" "{$NETW}" "udp" | |
| } | |
| # single ip addr or almost { m }any you can use the first forwardPortToDest() | |
| function fwdTcpIpS (){ | |
| # openPortToDest "{ $1 }" "$2" "tcp" | |
| forwardPortToDest "{ $1 }" "$2" "tcp" | |
| } | |
| function fwdUdpIpS (){ | |
| # openPortToDest "{$1}" "$2" "udp" | |
| forwardPortToDest "{$1}" "$2" "udp" | |
| } | |
| fwdTcpNetw 443 | |
| fwdTcpNetw 80 | |
| fwdTcpIpS "465" "single.ip.addr" | |
| THISIP = "my.lovely.ip.addr" | |
| fwdTcpIpS 965 $THISIP | |
| # open port func using gist.github.com/oeai/faded32d1684f8806ddb1bfa9e7a5002 | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for the NAT and portForwarding - it is not clear for ipv6, you can add those tables, but address range actually goes in-direct, so you need just open ports for that and allow somehow to move packets between interfaces - that is what is not clear. how, if there's no translation, should be like you just need to open ports on each interface and it will be alright. so i'm up for ipv6, expecially if they don't know the exact address, they just never find you.
from this point you just need to use openPort script for each iif oif iface
https://gist.github.com/oeai/faded32d1684f8806ddb1bfa9e7a5002 - also see this