PHP code example of vadimermolenko8787 / scanner-trap
1. Go to this page and download the library: Download vadimermolenko8787/scanner-trap 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/ */
vadimermolenko8787 / scanner-trap example snippets
return [
'local' => ['type' => 'file', 'dir' => __DIR__ . '/var/scanner-trap'],
];
\ScannerTrap\ScannerTrap::guard(__DIR__ . '/../scanner-trap.php');
return [
'local' => ['type' => 'file', 'dir' => __DIR__ . '/var/scanner-trap'],
'blocking' => true,
'logger' => $logger,
];
return [
'local' => [
'type' => 'redis',
'host' => '10.0.0.5',
'port' => 6379,
'database' => 0,
'password' => 'secret', // only if your Redis needs one
'prefix' => 'scanner-trap:',
'persistent' => true, // reuse the connection between requests
],
'blocking' => true,
];
return [
'local' => ['type' => 'redis', 'host' => '127.0.0.1'],
'central' => [
'dsn' => 'mysql:host=db.internal;dbname=app',
'user' => 'trap',
'password' => 'secret',
'tablePrefix' => 'scanner_trap_',
],
'blocking' => true,
];
$trap = \ScannerTrap\ScannerTrap::fromConfig(y));
use ScannerTrap\DefaultPatterns;
return [
'local' => ['type' => 'file', 'dir' => __DIR__ . '/var/scanner-trap'],
'patterns' => [...DefaultPatterns::LIST, ...DefaultPatterns::WORDPRESS_PROBES, '/old-admin'],
];
'subnets' => ['v4Prefix' => 24, 'v4Threshold' => 3, 'v6Prefix' => 64, 'v6Threshold' => 1, 'window' => 86400],
// or turn it off:
'subnets' => false,
'lists' => [
'spamhaus-drop',
'firehol-level1',
['name' => 'blocklist-de', 'url' => 'https://lists.blocklist.de/lists/all.txt'],
['name' => 'own', 'file' => __DIR__ . '/deny.txt'],
],
'trustedProxies' => [...\ScannerTrap\TrustedProxies::CLOUDFLARE, '10.0.0.0/8'],
nginx
try_files $uri /index.php?$query_string;