Firstly, there's not much point in trying to trace back an attack. As you suggest, it is probably an automated script so you have not been targeted specifically.
Secondly, use the firewalling capabilities in the Linux kernel. Search freshmeat for 'firewall script' and you should find something...