PHP code example of noobsec / antiscanscanclub-laravel

1. Go to this page and download the library: Download noobsec/antiscanscanclub-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

noobsec / antiscanscanclub-laravel example snippets




namespace App\Http\Middleware;

use Closure;
use noobsec\AntiScanScanClub\AntiScanScanClub;

class AntiScanScanMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $ASSC = new AntiScanScanClub();
        $blocker = TRUE;
        $ASSC->checkIp($request->ip());

        if ($request->isMethod('GET') && $request->getQueryString() === NULL) {
            /**
             * Prevention of access to credentials and/ important files/path
             * (e.g: wp-admin.php, .git/, backups.tar.gz, www.sql)
             */

            $ASSC->filterFile($request->getPathInfo(), $blocker, $request->ip());
        } else {
            $ASSC->filterInput($request->all(), $blocker, $request->ip());
        }

        return $next($request);
    }
}

    protected $middleware = [
        ...
        \App\Http\Middleware\AntiScanScanMiddleware::class,
    ];

use noobsec\AntiScanScanClub\AntiScanScanClub;

$ASSC = new AntiScanScanClub();

$clientIp = '127.0.0.1';

var_dump($ASSC->checkIp($clientIp)); // @return void/bool

$clientIp = '127.0.0.1';
$attack_type = 'Added manually';

var_dump($ASSC->addToBlacklisted($clientIp, $attack)); // @return bool

$data = [
    "input" => "Test payload",
    "textarea" => "<object/onerror=write`1`//"
];
$blocker = TRUE;
$clientIp = '127.0.0.1';

$ASSC->filterInput($data, $blocker, $clientIp); // @return void/bool

$url = "/wp-admin.php";
$blocker = TRUE;
$clientIp = '127.0.0.1';

$ASSC->filterFile($url, $blocker, $clientIp); // @return void/bool

$clientIp = '127.0.0.1';

var_dump($ASSC->removeFromBlacklists($clientIp)); // @return bool

var_dump($ASSC->purgeBlacklistsFile()); // @return bool

var_dump($ASSC->whitelistFile('wp-admin.php')); // @return bool

var_dump(whitelistPublicFiles()); // @return array

var_dump(whitelistAllRoutes()); // @return array

$file = "api/adminLists";

var_dump(addToFilterFiles($file)); // @return integer/bool

var_dump($ASSC->restoreFilterFiles()); // @return bool
ssh
php artisan vendor:publish --provider="noobsec\AntiScanScanClub\AntiScanScanClubServiceProvider"
bash
$ php artisan make:middleware AntiScanScanMiddleware