Created
December 16, 2020 20:32
-
-
Save cutaway/855f47750aa885c3a371ecef730ac667 to your computer and use it in GitHub Desktop.
Script to use IPTables to prevent outbound traffic when using network taps and monitoring network traffic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ipt4='/sbin/iptables' | |
ipt6='/sbin/ip6tables' | |
for i in $ipt4 $ipt6; do | |
# Flush Rules | |
echo 'Flushing IPTables: ' $i | |
$i -F | |
$i -X | |
# If there is a parameter, then disable outbound | |
if test $# -gt 0; then | |
if [[ "$1" == "start" ]]; then | |
# Block Rules | |
echo 'Blocking outbound traffic' | |
$i -A OUTPUT -j DROP | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment