From 7731aad4f1322465b97aba7eefc48d8d26d5508c Mon Sep 17 00:00:00 2001 From: Sebastian <379651+czarly@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:42:08 +0200 Subject: [PATCH] a few scripts --- utils/get-connections-on-port.sh | 6 ++++++ utils/get-public-network-interface.sh | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 utils/get-connections-on-port.sh create mode 100644 utils/get-public-network-interface.sh diff --git a/utils/get-connections-on-port.sh b/utils/get-connections-on-port.sh new file mode 100644 index 00000000..3052e014 --- /dev/null +++ b/utils/get-connections-on-port.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +ip="$(curl -s ipinfo.io/ip)" +interface="$(ip addr | awk -v ip="$ip" '$1 == "inet" && $2 ~ "^" ip "/" {print $NF}')" + +pktstat -n -i $interface port ${1:-3042} diff --git a/utils/get-public-network-interface.sh b/utils/get-public-network-interface.sh new file mode 100644 index 00000000..38e274ae --- /dev/null +++ b/utils/get-public-network-interface.sh @@ -0,0 +1,4 @@ +#!/bin/bash + + +ip addr | awk -v ip="$(curl -s ipinfo.io/ip)" '$1 == "inet" && $2 ~ "^" ip "/" {print $NF}'