Giter Site home page Giter Site logo

dosdetector's Introduction

PHP DosDetector Class Documentation

Version: 1.0

Release: June 2013

Keyword: security, php, class, firewall, DoS Attack, IDS/IPS

1. What is this class?

This PHP Class used for preventing Denial of Service (DoS) attack to your web server written by PHP. Running this script will monitoring all requests from an IP address and logged it into memory cache (PHP APC Caching). If an IP address sends too much request to your server, it will trigger the Intrustion Preventing System (IPS) and auto-ban this IP Address.

2. System Requirement

3. Installation

  • First, copy class.dosdetector.php file to your project, such as ./classes/ directory on your project.

  • Next, including class.docsdetector.php file.

  • Now, just create an object from this class and call run method before the first line of your project (usally in bootstrap, start up or index file) to start monitoring. You can pass an URL to run method in case banned IP will be redirect to passed URL. If you do not pass this parameter, banned IP will see a default message on screen.

  • Example code:

		//Put this in the beginning of your all page
		include_once('./classes/class.dosdetector.php');
		$myDosDetector = new DosDetector();

		//Default Running
		$myDosDetector->run();

		//Default Running with Custom Landing Page for Banned IP Access
		//$myDosDetector->run('http://url/to/your/landing/page');

		//////////////////////////////
		// YOUR SITE SOURCE CODE HERE
		//....

4. Editable Properties & Constants

  • $ignoreIpAddress: IP Address in this array will be ignored by this detector. Usually your Company IP...
  • PHPIDS_QUOTA_IDS_TRIGGER: if in a second, an IP Address request more than this value will be trigger method idsWorker() in this class. You can implement you code for this function (line 161 in class.dosdetector.php) to get the notification.
  • PHPIDS_DURATION_IPS_TRIGGER: The number of second to check for IPS (auto-banning) trigger.
  • PHPIDS_QUOTA_IPS_TRIGGER: if in PHPIDS_DURATION_IPS_TRIGGER seconds, same IP have more request than this value will be auto-banned by system.

5. Monitoring

  • Only in Codecanyon Package. Buy on Codecanyon to get monitor.php script to monitoring. http://codecanyon.net/item/php-dosdetector-class/4899130

  • This package came with a standalone script to monitor the traffic (logged by DosDtector class). You can put this script anywhere on your web server (with PHP read permission), and run this script from browser to access monitor tool. Example: http://yoursite.com/monitor.php.

  • This page will show all the request (with IP Address, Time, User-Agent, Cookie status, Request URI, Referer URL) logged by DosDetector. Logged Accesses will be cached for 2 hours for performance.

  • This page will show you banned IP address (from auto-ban or manual-ban IP Address). You can manual-ban an IP Address if you see that IP request too much and have weird access. Banned IP addresses will not be clear automatically. This banned list only clear by you or by clear from APC cache.

  • You can detect whether a request have cookie or not, because a request without cookie is usually a search engine robot (Googlebot,..) or an automatic script crawling/flooding your website.

Thank you!

dosdetector's People

Contributors

voduytuan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.