seanhayes-com/laravel5-probe-detection

A Laravel 5 package to log known website probing attacks.

0.1.2 2020-02-17 21:53 UTC

This package is auto-updated.

Last update: 2024-04-19 00:26:07 UTC


README

Log and ban known website probing attacks and eliminate wasted site resources

Minimum Requirements

Laravel 5.1 and PHP 5.5.9

Installation

You can install the package via composer:

composer require seanhayes-com/laravel5-probe-detection

Step 2: Configuration

Add the following to your config/app.php in the providers array:

SeanHayes\Probe\ProbeServiceProvider::class,
Torann\GeoIP\GeoIPServiceProvider::class,

You should also add the following to the aliases array:

'Probe'     => SeanHayes\Probe\ProbeFacade::class,
'GeoIP'     => Torann\GeoIP\GeoIPFacade::class,

You can then 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