SHARE
TWEET

ddosfilter.net | Layer7 DOS Protection

DSTAT Apr 18th, 2019 (edited) 192 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // Coded by DSTAT | Instagram: @DDoS_Filter
  3. // Public release of layer7.php from http://ddosfilter.net/
  4. //*********************************************************************************
  5. // In the command line type:
  6. // crontab -e
  7. // Paste this into the crontab and save: (Change directory to match your setup.)
  8. //
  9. // */1 * * * * > /var/www/html/conns.txt
  10. // 0 */1 * * * > /var/www/html/blacklist.txt
  11. //
  12. // Create files: blacklist.txt and conns.txt and put them in the layer7 directory.
  13. // IMPORTANT! Set both files permissions to 646.
  14. //
  15. // To protect a page with layer7.php add this code to the top of your pages:
  16. //
  17. // require '/var/www/html/layer7.php';
  18. /*
  19.  
  20. Copyright (c) <2019> <@DDoS_Filter>
  21.  
  22. Permission is hereby granted, free of charge, to any person obtaining a copy
  23. of this software and associated documentation files (the "Software"), to deal
  24. in the Software without restriction, including without limitation the rights
  25. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  26. copies of the Software, and to permit persons to whom the Software is
  27. furnished to do so, subject to the following conditions:
  28.  
  29. The above copyright notice and this permission notice shall be included in all
  30. copies or substantial portions of the Software.
  31.  
  32. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  33. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  36. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  38. SOFTWARE.
  39. /**********************************************************************************/
  40.  
  41. $A = '/var/www/html/';                      // Full path to layer7 files.
  42. $B = 'DOS Protection by @DDoS_Filter';      // Page title when displaying layer7.php.
  43. $C = 10;                                    // SETS MAX REQUESTS PER MINUTE LIMIT.
  44.  
  45. 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top