Here is a version of iptables which will not brick your machine. Be careful on the internet. Check my old github for info on how to block ip addresses semi-permanently. Of course, you need to run the script in the link upon every reboot and make sure there are no errors.