It can be dangerous, depending on how it's done. The best way to do this is to integrate into some external monitoring system like OSSEC with active response.
More importantly, while it may sound like a good idea, it's pointless. Anybody that scans you from one IP and then launches further attacks from the same IP is a clueless script kiddie, and if you're vulnerable to something a clueless script kiddie is throwing at you, you're going to get compromised by someone with a clue who won't trigger this.
|