├── .gitignore ├── README.md ├── composer.json ├── publishable └── config │ └── frustration.php └── src ├── FrustrationServiceProvider.php └── Http └── Middleware └── Frustrate.php /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore IntelliJ 2 | .idea/ 3 | 4 | # ignore Vendor 5 | vendor/ 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel Frustration 2 | 3 | ![hero](https://res.cloudinary.com/ichtrojan/image/upload/v1589558568/frstration_ddnv00.png) 4 | 5 | ## Introduction 6 | 7 | This package main purpose is to "Frustrate your enemies". Alright, let's be serious. This package will redirect URL guessers to any of the random URL that you specify. 8 | 9 | ## Use case 10 | 11 | This is a laravel package but you will have some users that want to access `/wp-admin.php` trying to assume that your application is built on Wordpress. By default, it will return a 404 but let's not let it end there, let's frustrate them. 12 | 13 | ## Installation 14 | 15 | To install this package run: 16 | 17 | ```bash 18 | composer install ichtrojan/laravel-frustration 19 | ``` 20 | 21 | This will install the madness in this repo. 22 | 23 | Next, export the config file by running: 24 | 25 | ```bash 26 | php artisan vendor:publish --tag=frustration 27 | ``` 28 | 29 | This will publish the default config in `config/frustration.php`. 30 | 31 | ## Usage 32 | 33 | The only source of truth is `frustration.php`, here's what it looks like: 34 | 35 | ```php 36 | [ 40 | 'wp-admin.php', 'index.php', 'wp-login.php' 41 | ], 42 | 43 | 'redirect' => [ 44 | 'https://www.fbi.gov/wanted', 45 | 'https://www.youtube.com/watch?v=pok8H_KF1FA', 46 | 'https://fast.com', 47 | 'http://www.omfgdogs.com', 48 | 'https://cat-bounce.com' 49 | ] 50 | ]; 51 | ``` 52 | 53 | the `routes` key is an array of forbidden routes while the `redirect` key is an array of random URLs that you decide to redirect your victims to. 54 | 55 | >**NOTE**
56 | > * The forbidden routes should exist without the forward-slash `/` 57 | > * It will be nice to sneak in pornhub in there, just saying 🤫 58 | 59 | ## Conclusion 60 | 61 | I want to do more with this package, probably when I get bored next. Special thanks to Vibes and Insha-Allah. Please if you find any issue or have a cool feature idea do send in a PR. 62 | 63 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ichtrojan/laravel-frustration", 3 | "type": "library", 4 | "license": "MIT", 5 | "authors": [ 6 | { 7 | "name": "Michael Okoh", 8 | "email": "michael@okoh.co.uk" 9 | } 10 | ], 11 | "minimum-stability": "dev", 12 | "autoload": { 13 | "psr-4": { 14 | "Ichtrojan\\Frustration\\": "src/" 15 | } 16 | }, 17 | "autoload-dev": { 18 | "psr-4": { 19 | "Ichtrojan\\Frustration\\Middleware": "src/Http/Middleware" 20 | } 21 | }, 22 | "scripts": { 23 | "test": "vendor/bin/phpunit tests" 24 | }, 25 | "extra": { 26 | "laravel": { 27 | "providers": [ 28 | "Ichtrojan\\Frustration\\FrustrationServiceProvider" 29 | ] 30 | } 31 | }, 32 | "require": { 33 | "illuminate/support": "^5.0|^6.0|^7.0" 34 | }, 35 | "require-dev": { 36 | "mockery/mockery": "^1.0", 37 | "orchestra/testbench": "3.8.*|4.*", 38 | "phpunit/phpunit": "^8.0" 39 | }, 40 | "description": "A package to frustrate URL attackers" 41 | } -------------------------------------------------------------------------------- /publishable/config/frustration.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'wp-admin.php', 'index.php', 'wp-login.php' 6 | ], 7 | 8 | 'redirect' => [ 9 | 'https://www.fbi.gov/wanted', 10 | 'https://www.youtube.com/watch?v=pok8H_KF1FA', 11 | 'https://fast.com', 12 | 'http://www.omfgdogs.com', 13 | 'https://cat-bounce.com' 14 | ] 15 | ]; -------------------------------------------------------------------------------- /src/FrustrationServiceProvider.php: -------------------------------------------------------------------------------- 1 | mergeConfigFrom(__DIR__ . "/../publishable/config/frustration.php", 'frustration'); 17 | } 18 | 19 | /** 20 | * Bootstrap any application services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel'); 27 | $kernel->pushMiddleware('Ichtrojan\Frustration\Http\Middleware\Frustrate'); 28 | 29 | if ($this->app->runningInConsole()) { 30 | $this->publishConfigs(); 31 | } 32 | } 33 | 34 | protected function publishConfigs() 35 | { 36 | $this->publishes([ 37 | __DIR__ . "/../publishable/config/frustration.php" => config_path('frustration.php'), 38 | ], 'frustration'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Http/Middleware/Frustrate.php: -------------------------------------------------------------------------------- 1 | getRequestUri()), config('frustration.routes'))) { 20 | $routes = config('frustration.redirect'); 21 | $route = $routes[array_rand($routes)]; 22 | return redirect($route); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } --------------------------------------------------------------------------------