Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Coded by DSTAT | Instagram: @DDoS_Filter
- // Public release of layer7.php from http://ddosfilter.net/
- //*********************************************************************************
- // In the command line type:
- // crontab -e
- // Paste this into the crontab and save: (Change directory to match your setup.)
- //
- // */1 * * * * > /var/www/html/conns.txt
- // 0 */1 * * * > /var/www/html/blacklist.txt
- //
- // Create files: blacklist.txt and conns.txt and put them in the layer7 directory.
- // IMPORTANT! Set both files permissions to 646.
- //
- // To protect a page with layer7.php add this code to the top of your pages:
- //
- // require '/var/www/html/layer7.php';
- /*
- Copyright (c) <2019> <@DDoS_Filter>
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, and/or, sublicense
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
- /**********************************************************************************/
- $A = '/var/www/html/'; // Full path to layer7 files.
- $B = 'DOS Protection by @DDoS_Filter'; // Page title when displaying layer7.php.
- $C = 10; // SETS MAX REQUESTS PER MINUTE LIMIT.
- if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $D = $_SERVER['HTTP_CF_CONNECTING_IP']; } else { $D = $_SERVER['REMOTE_ADDR']; } $E = file_get_contents($A.'blacklist.txt'); if (strpos($E, $D) !== false) { die('<html><head><title>'.$B.'</title></head><body><center><h1>Your IP is temporarily blacklisted.</h1><p>DOS Protection by @DDoS_Filter<br>http://ddosfilter.net/</p></center></body></html>'); } file_put_contents($A.'conns.txt',$D."\n", FILE_APPEND); $H = 0; if ($F = fopen($A.'conns.txt', 'r')) { while (!feof($F)) { $G = fgets($F); if ($D."\n" == $G) { $H++; if ($H == $C) { fclose($F); file_put_contents($A.'blacklist.txt',$D."\n", FILE_APPEND); die('<html><head><title>'.$B.'</title></head><body><center><h1>Your IP ('.$D.') has been temporarily blacklisted. Please try again later.</h1><p>DOS Protection by @DDoS_Filter<br>http://ddosfilter.net/</p></center></body></html>'); }}} fclose($F); } ?>
RAW Paste Data