CodeIgniter Forums
block hacker - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: block hacker (/showthread.php?tid=86084)



block hacker - badger - 01-08-2023

I'm sure there is a better way to do the following. My aim was to stop a hack attempt at the very start, so in routes, at the very top, I have
Code:
$sUrl = strtolower(uri_string());
if(str_starts_with($sUrl,'wp-')  || str_starts_with($sRUrl,'admin')  || str_starts_with($sUrl,'view-')   || str_starts_with($sUrl,'misc/')){
    // definite hacker - set default controller to Controllers/Home which shows simply "Site Under Construction"
    $routes->get('(:any)',$sHackerController );
    $routes->post('(:any)', $sHackerController);
    $routes->put('(:any)', $sHackerController);
    $routes->delete('(:any)', $sHackerController);
    service('auth')->routes($routes);
    return;
}
// and then come the proper routes
what is the right way to do this?
thanks, Bill


RE: block hacker - superior - 01-09-2023

On what level do you define a 'hacker', looks to me like you want to stop the 'auto bots' with directory/credentials sniffing.


RE: block hacker - badger - 01-09-2023

Well I knew it was a bot but I class them all as hacking attempts. Anyway, I've just learned something new from you. So how do i stop the auto bots please?
Thanks, Bill


RE: block hacker - InsiteFX - 01-09-2023

This may help you figure it out.

Control bots, spiders, and crawlers


RE: block hacker - badger - 01-10-2023

Many thanks