From 3d75cdd09990e78b2cb68d00d5c429459fd408e9 Mon Sep 17 00:00:00 2001 From: jbubik Date: Thu, 24 Feb 2022 21:29:57 +0100 Subject: [PATCH 1/2] Create ping_udp --- usr/lib/telegramopenwrt/plugins/ping_udp | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 usr/lib/telegramopenwrt/plugins/ping_udp diff --git a/usr/lib/telegramopenwrt/plugins/ping_udp b/usr/lib/telegramopenwrt/plugins/ping_udp new file mode 100644 index 0000000..75fc78a --- /dev/null +++ b/usr/lib/telegramopenwrt/plugins/ping_udp @@ -0,0 +1,26 @@ +#!/bin/sh +# Create a UDP packet to puncture a hole through a NAT firewall of your ISP +# Useful with OpenVPN in UDP mode +# Needs nping to create raw IP packet (cannot use nc/ncat because local socket is already used) +# Use DDNS, STUN or chekip service to find your current public NAT IP + +SPORT="$1" +DADDR="$2" +DPORT="$3" + +if echo "$SPORT"|grep -q -E -e '^[0-9]{1,5}$'; then +if echo "$DPORT"|grep -q -E -e '^[0-9]{1,5}$'; then +if echo "$DADDR"|grep -q -E -e '^[0-9a-zA-Z][0-9a-zA-Z\.\-]*\.[0-9a-zA-Z\.\-]*[0-9a-zA-Z]$'; then +if [ -x /usr/bin/nping ]; then + nping --udp -N --send-ip -v4 -g "${SPORT}" -p "${DPORT}" -c 1 "${DADDR}"|grep SENT + exit 0 +else + echo "NPING not installed. Use '*opkg install nping*'." + exit 1 +fi +fi +fi +fi + +echo "Wrong parameters. Use '*/ping_udp *'." +exit 1 From 0ddb0539e96e1d95d01702f8fdab6bbbd6db029d Mon Sep 17 00:00:00 2001 From: jbubik Date: Thu, 24 Feb 2022 21:31:06 +0100 Subject: [PATCH 2/2] Create ping_udp --- usr/lib/telegramopenwrt/plugins/help/ping_udp | 1 + 1 file changed, 1 insertion(+) create mode 100644 usr/lib/telegramopenwrt/plugins/help/ping_udp diff --git a/usr/lib/telegramopenwrt/plugins/help/ping_udp b/usr/lib/telegramopenwrt/plugins/help/ping_udp new file mode 100644 index 0000000..8493eff --- /dev/null +++ b/usr/lib/telegramopenwrt/plugins/help/ping_udp @@ -0,0 +1 @@ +Create a UDP packet to puncture a hole through a NAT firewall of your ISP