Traffic blocking

Hi everybody. I detect a lot of bots on the site. How to create a rule to block all users or display a captcha if they are not from search engines?