seanhayes-com / laravel-probe-detection
A Laravel package to log known website probing attacks.
Requires
- php: ^7.2
- laravel/framework: ^6.0
- torann/geoip: ^1.1
Requires (Dev)
- league/flysystem: >=1.0.8
- mockery/mockery: ^1.0
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
README
Log and ban known website probing attacks and eliminate wasted site resources
Minimum Requirements
Laravel 6.0 and PHP 7.2
Installation
You can install the package via composer:
composer require seanhayes-com/laravel-probe-detection
The package will automatically register itself.
You can publish the migration with:
php artisan vendor:publish --provider="SeanHayes\Probe\ProbeServiceProvider" --tag="migrations"
After the migration has been published you can create the prob_log
table by running the migrations:
php artisan migrate
You can optionally publish the config file with:
php artisan vendor:publish --provider="SeanHayes\Probe\ProbeServiceProvider" --tag="config"
Configuration
Change settings in config/probe.php
Add routes to handle certain common attack vectors or URIs added to watch_uris in config/probe.php
Route::get('/wp-login.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::get('/{name}/wp-login.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::get('/wp-admin/', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::get('/wp-content/', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::get('/{name}/wp-admin/', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::get('/xmlrpc.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::get('/wp-cron.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::post('/wp-login.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::post('/{name}/wp-login.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::post('/wp-admin/', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::post('/{name}/wp-admin/', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::post('/xmlrpc.php', function () { \SeanHayes\Probe\Probe::logRequest(); }); Route::post('/wp-cron.php', function () { \SeanHayes\Probe\Probe::logRequest(); });
Usage
Include the path in your Controller or AppServiceProvider
use SeanHayes\Probe\Probe;
And the call to process the request in your method
Probe::logRequest();
Troubleshooting
If you experience file cache errors, you can change your CACHE_DRIVER to array in your .env file.
CACHE_DRIVER=array