From 42f2001651413179ba49f3b76e28f175de599eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Choch=C3=B3=C5=82?= Date: Thu, 14 Sep 2017 15:41:37 +0200 Subject: [PATCH] Added mount comparison and saving iptables rules to iptables-save format --- statesnap.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/statesnap.sh b/statesnap.sh index 9288a26..d151953 100755 --- a/statesnap.sh +++ b/statesnap.sh @@ -15,6 +15,8 @@ function makeSnap { ps aux | awk '{ print $11 }' | sort | uniq | egrep -v '^\[' > $FOLDER/ps.out netstat -lpn | egrep "(tcp.*LISTEN|udp)" | sort | uniq | awk '{split($NF,arr,"/"); print $1 " " $4 " " arr[2]}' > $FOLDER/netstat.out (/sbin/iptables -L -n; echo -e "\n#NAT\n"; /sbin/iptables -L -nt nat) > $FOLDER/iptables.out + /sbin/iptables-save > $FOLDER/iptables-save.out + mount > $FOLDER/mount.out /sbin/ip route > $FOLDER/routing.out msg "Written state snapshot to $FOLDER" } @@ -31,6 +33,9 @@ function compare { echo -e "$GREEN\nFirewall rules diff$RST" echo -e "$BLUE============================================================================$RST" (/sbin/iptables -L -n; echo -e "\n#NAT\n"; /sbin/iptables -L -nt nat) | diff - $FOLDER/iptables.out + echo -e "$GREEN\nMounts diff$RST" + echo -e "$BLUE============================================================================$RST" + mount | diff - $FOLDER/mount.out echo -e "$GREEN\nRouting table diff$RST" echo -e "$BLUE============================================================================$RST" /sbin/ip route | diff - $FOLDER/routing.out