From 9f9fb5fffa87af1e5829ef9e41cc1b40cfe2ef6b Mon Sep 17 00:00:00 2001 From: AlbertoPellitteri <66901396+AlbertoPellitteri@users.noreply.github.com> Date: Tue, 24 Sep 2024 10:51:36 +0200 Subject: [PATCH] Fixing test T1562.004-19 (#2943) Co-authored-by: Hare Sudhan --- atomics/T1562.004/T1562.004.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atomics/T1562.004/T1562.004.yaml b/atomics/T1562.004/T1562.004.yaml index 62dddaa0..b1f7c3d9 100644 --- a/atomics/T1562.004/T1562.004.yaml +++ b/atomics/T1562.004/T1562.004.yaml @@ -387,12 +387,12 @@ atomic_tests: if [ ! -x "$(command -v iptables)" ]; then echo -e "\n***** iptables NOT installed *****\n"; exit 1; fi if ! echo "$(iptables -L)" | grep -q "DROP .*dpt:ftp"; then echo -e "\n***** this firewall rule is NOT activated *****\n***** activate it by executing \"iptables -A OUTPUT -p tcp --dport 21 -j DROP\" *****\n"; exit 1; fi get_prereq_command: | - echo "" + iptables-save > /tmp/iptables.rules + if echo "$(iptables -L)" | grep -q "DROP .*dpt:ftp"; then echo "Rule found"; else echo "Rule not found. Setting it..."; iptables -A OUTPUT -p tcp --dport 21 -j DROP; fi executor: name: sh elevation_required: true command: | - iptables-save > /tmp/iptables.rules iptables -D OUTPUT -p tcp --dport 21 -j DROP cleanup_command: | iptables-restore < /tmp/iptables.rules