scripting fun
Bart Silverstrim
bsilver at chrononomicon.com
Thu Jun 5 17:45:13 UTC 2008
Okay...closer...combining what others have given (thank you everyone!),
I currently have
******
#!/bin/sh
grep -i slurp /var/log/apache-perl/access.log |awk '{print$1}' >
~/temp/tmp.txt
sort ~/temp/tmp.txt > ~/temp/tmp2.txt
uniq ~/temp/tmp2.txt > ~/temp/slurps.txt
iptables -L INPUT -v -n |awk '{print$8}' |grep '[0-9]' > ~/temp/blocked.txt
join -v2 < (sort <~/temp/blocked.txt | uniq ) < (sort <~/temp/slurps.txt
| uniq ) > ~/temp/newaddresses.txt
for i in `cat ~/temp/newaddresses.txt`
do
iptables -A INPUT -s $i -j DROP
done
******
The command line of join... worked, but bash is trying to reorder
something near the parenthesis and that causes it to stop the script.
Trying \ didn't seem to help so I am probably missing something obvious.
More information about the ubuntu-users
mailing list