In cakePHP, bans user's IP-s if they trying to accessing unavailable controllers/action (error - not found) more then 5 times

In CakePHP-3, How can I block users IP, if he get ‘Missing Controller/action’ or error404, more then 5 times on hitting unavailable urls…( means if he tries to access unavailable sources the his IP should get blocked )

can you give me any idea or suggest any related plugin

Thanks in advance

This is not exactly what you want but can give you some ideas how to do something like this.

Thanks @rrd, I went through this plugin. This is specific for login/authentication purpose… here I need if the user hits unavailable URL the will get error404 , should be counted accessing from same IP and if he crosses the limit then he should be a ban for a few time.

Thanks a lot again.

@rrd i did the same by putting the code in ErrorController : beforeFielter() and also ‘checkUrl’ to false in RBruteForce Component.
Thanks.