summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-08-25 03:30:39 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-08-25 03:30:39 +0200
commit35fde3c5b004788e7bf837c2f4aba531f6076759 (patch)
tree1c83c87b6f7a931e5f97857a33e6b3a8c8e86a1f
parentf35d59e4bd138e4410d8d6713722be29a3c10b99 (diff)
downloadconky-35fde3c5b004788e7bf837c2f4aba531f6076759.tar.gz
conky-35fde3c5b004788e7bf837c2f4aba531f6076759.tar.bz2
conky-35fde3c5b004788e7bf837c2f4aba531f6076759.tar.xz
conky-35fde3c5b004788e7bf837c2f4aba531f6076759.zip
Add script checking outgoing network connections
-rw-r--r--.gitignore1
-rwxr-xr-xscripts/netstat-out.sh10
2 files changed, 11 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index ae5a993..6345a48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
+security/*
example.conf
diff --git a/scripts/netstat-out.sh b/scripts/netstat-out.sh
new file mode 100755
index 0000000..57fcc28
--- /dev/null
+++ b/scripts/netstat-out.sh
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+# Finish later... By app first. Than destinations. Separate firefox, chromium, etc.? What else?
+query=""
+for port in `netstat -ntup | tail -n +3 | grep -v "127.0.0.1" | awk -e '{print $4}' | rev | cut -d ':' -f 1 | rev | sort -n | uniq`; do
+ [ $port -gt 32768 ] && continue;
+ [ -z "$query" ] && query="sport = :$port" || query="$query or sport = :$port"
+done
+
+eval /sbin/ss -nrtu state established "'( $query ) '" | tail -n +2 | grep -v localhost | awk -F'[:\t ]+' -e '$6 != $4 { print $6, $5 }'