PHP Classes
elePHPant
Icontem

PHP Brute Force Protection: Protect pages access against brute force attacks

Recommend this page to a friend!
  Info   View files Documentation   View files View files (18)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2018-09-25 (23 hours ago) RSS 2.0 feedNot enough user ratingsTotal: 154 This week: 12All time: 8,554 This week: 44Up
Version License PHP version Categories
brutalforce 1.0.1The PHP License5PHP 5, Security
Description Author

This package can protect pages access against brute force attacks.

It can track and store in a file the number of repeated accesses from users of the same IP address.

When the accesses exceed a given limit, a form is presented with a CAPTCHA form using Recaptcha.

  Performance   Level  
Name: rodrigomanara <contact>
Classes: 1 package by
Country: United Kingdom United Kingdom

Details

Latest Stable Version Total Downloads License composer.lock Build Status

brutalforce

  • Repository: https://github.com/rodrigomanara/brutalforce
  • Version: 1.0.7.1

    composer require rmanara/brutalforce

Brute-Force method is used from many hackers but the <b>brutalforce</b> will help you void this problem by check the client IP and will count how many request in less than a 2 seconds how many request was done. Automaticly a file will be create and saved that ip and will save for futures request.

It is very simple setup and can be used in any frameworks.

very simple setup

<?php
$firewall = new BrutalForce\Firewall\Firewall(__DIR__, "sitekey", "secret");

specify type of handler

<?php
 $firewall->initializer(BrutalForce\Firewall\Firewall::TYPE_FILE);

check if the firewall is locked

<?php
if ($firewall->isLocked()) {
    // here you check the recaptcha is already able to display
    if ($firewall->verify()->recaptcha['valid'] == false) {
        echo "<form method='post' action=''>";
        // diplay message 
        echo $firewall->verify()->recaptcha['form_message'];
        // show input
        echo $firewall->verify()->recaptcha['form'];
        
        echo "<button>send</button></form>";
    } else {
        echo $firewall->verify()->recaptcha['form_message']; PHP_EOL;
    }
} else {
    echo "free to go" . PHP_EOL;
}

Reset the lock completely to original

by doing this the cound down will start from zero and the recaptcha will be called again from the last 3 counts


$firewall->resetLock(true);

Bugs:

  • found issue on setup the file and folder to holder the ip

enhancement:

  • add new method to reset lock
  • remove setup file on handler
  • add request uri so the full url is recored and can be redirect to it if is need to
  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetests (1 file, 1 directory)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageBrutalForce (4 directories)

  Files folder image Files  /  src  /  BrutalForce  
File Role Description
Files folder imageComponent (2 files)
Files folder imageFileManager (1 file)
Files folder imageFirewall (3 files)
Files folder imageHandler (4 files)

  Files folder image Files  /  src  /  BrutalForce  /  Component  
File Role Description
  Plain text file CheckTime.php Class Class source
  Plain text file RequestWrapper.php Class Class source

  Files folder image Files  /  src  /  BrutalForce  /  FileManager  
File Role Description
  Plain text file File.php Class Class source

  Files folder image Files  /  src  /  BrutalForce  /  Firewall  
File Role Description
  Plain text file Firewall.php Class Class source
  Plain text file Holder.php Class Class source
  Plain text file interfaceFirewall.php Class Class source

  Files folder image Files  /  src  /  BrutalForce  /  Handler  
File Role Description
  Plain text file ByAbstract.php Class Class source
  Plain text file byFile.php Class Class source
  Plain text file ByInterface.php Class Class source
  Plain text file HandlerInterface.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageBrutalForce (2 files)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script

  Files folder image Files  /  tests  /  BrutalForce  
File Role Description
  Plain text file ByFileTest.php Class Class source
  Plain text file FirewallTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:154
This week:12
All time:8,554
This week:44Up