Last active
September 22, 2023 21:04
-
-
Save yunginnanet/909c4870beb39123460010f1def29dcf to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
_IF=$1 | |
# note that if you have different masks i'm bad at bash and this is only removing '/24' atm | |
/bin/ip --brief a | grep "$_IF" | sed 's|/24||g' | awk -F 'P' '{print $NF}' | sed 's| |\n|g' | grep \. | sort | while read line; do | |
echo -e "-A INPUT -i $_IF -s $line -j LOG --log-prefix '[$line SPOOF DROP] '\n-A INPUT -i $_IF -s $line -j DROP"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment