From db852f51447a9f372494733496dbeae3c636899e Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Tue, 6 May 2025 16:23:27 +0200 Subject: [PATCH] nu: Add macos network util scripts --- tree/.local/nu/macos.nu | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tree/.local/nu/macos.nu diff --git a/tree/.local/nu/macos.nu b/tree/.local/nu/macos.nu new file mode 100644 index 0000000..c9531ac --- /dev/null +++ b/tree/.local/nu/macos.nu @@ -0,0 +1,23 @@ +# Utility commands for macos + +def "net route 4" [ +] { + netstat -rnl -f inet | tail +4 | from ssv -m 1 | into int Refs Use Mtu +} + +def "net route 6" [ +] { + netstat -rnl -f inet6 | tail +4 | from ssv -m 1 | into int Refs Use Mtu +} + +def "net fw rule" [ + --anchor (-a): string +] { + sudo pfctl -sr -a $anchor | lines +} + +def "net fw nat" [ + --anchor (-a): string +] { + sudo pfctl -sn -a $anchor | lines +}