Block list of ip addresses linux
<p>I'm running Kali on a computer that has port forwarding so I can access it while away from my desk.  Upon looking at /var/log/auth.log I find a number of IP addresses that have been trying to log in which I don't recognise.  I've managed to extract all the IPs and put them in a file, and want to run a script to block them using iptables.  So far, I've come up with this, but it's not working:</p>

<pre><code>#!/bin/bash
NUMBEROFIPS=cat "ipaddresses.txt" | wc -l
for i in `seq 0 $NUMBEROFIPS`;
 do
        IP=awk 'NR==$i' ipaddresses.txt
        iptables -A INPUT -s $IP -j DROP
done
</code></pre>

<p>What am I doing wrong?</p>