A simple PHP Toolkit to parallel generate combinations, save and use the generated terms to brute force attack via the http protocol.

Related tags

HTTP brutal
Overview

Brutal

A simple PHP Toolkit to parallel generate combinations, save and use the generated terms to apply brute force attack via the http protocol.

Brutal uses a simple combination algorithm to generate unique and limited number of combinations in chunk files

Installation

*Under construction

Brutal is written in PHP and distributed as package via composer. Make sure you have PHP (>= 7.3) installed.

Using composer:

composer install brutal

Using Brutal

Generating and saving combinations dictionaries:

//Instance BrutalService (the facade)
$brutalService = new BrutalService();

//Call generate and pass an implementation of Combinable interface, an array of words and the size of combination
$combinations = $brutalService->generate(new SimpleCombination(), ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 3);

//Create a concrete repository of Combination and pass the combinations generated, a path to save the combinations and the format of content
$from = '/tmp/brutal';
$combinationRepository = CombinationRepositoryFactory::createRepository($combinations, $from, CombinationRepository::FORMAT_TEXT);

//Call save method passing the concrete repository
$brutalService->save($combinationRepository);

Loading dictionaries chunks, attacking the target and reporting results

//Create a concrete repository of Loader and pass the path where saved the combinations
$loadRepository = LoadRepositoryFactory::createRepository($from);
//Load chunks calling load method and passing concrete load repository
$chunks = $brutalService->load($loadRepository);

//Instance HttpOptions passing the http target, method, format, body and headers (optional). Use '$term' where you need override to generated combination term
$httpOptions = new HttpOptions('http://localhost:3000/test_server.php', 'POST', HttpFormat::JSON, ['test' => '$term']);
//Create a concrete attack repository calling HttpAttackFactory and passing $httpOptions
$httpAttackRepository = HttpAttackRepositoryFactory::createRepository($httpOptions);
//Call attack method passing the concrete attack repository and loaded chunks
$attackResult = $brutalService->attack($httpAttackRepository, $chunks);

//Create a concrete report repository passing http options
$reportRepository = CLIReportRepositoryFactory::createRepository($httpOptions);
//Call report method passing the concrete report repository and attack results
$brutalService->report($reportRepository, $attackResult);

//You can run the test_server.php to test this

Try it at hack a infosec first programming challenge.
Look at brutal_hackinfosec.php file(put your cookie on GET_YOUR_REQUEST_COOKIE_FROM_YOUR_BROWSER) to help you 😁

Using Brutal CLI

*Under construction

To generate combinations

$ php brutal.php generate <options>

Generate options:

  • -c : Characters token separeted comma to generate combinations term.
  • -s : Size of generated terms.
  • -p : Output path of generated combinations.
  • -i : Type of output file(s) chunk or single. Default is chunk.
  • -f : Format of combinations file(s) content TEXT or SERIALIZED. Default is text.
  • -r : Maximum ram memory in megabytes (important increase to generate and attack higher volume of combinations)
  • -v : Verbose mode.

Examples:

Generate combination of 0,1,2,3,4,5,6,7,8,9 with size 3 and save in path /home/user/chunks inside multiple chunks text files:

$ brutal generate -c 0,1,2,3,4,5,6,7,8,9 -s 3 -p /home/user/chunks -i chunk -f TEXT

Generate combination of 0,1,2,3,4,5,6,7,8,9 with size 3 and save in path /home/user/chunks inside multiple chunks using maximum of 700 megabytes ram text files:

$ brutal generate -c 0,1,2,3,4,5,6,7,8,9 -s 3 -p /home/user/chunks -i chunk -r 700 -f TEXT

Generate combination of a,b,c,d with size 4 and save in path /home/user inside single serialized file:

$ brutal generate -c a,b,c,d -s 4 -p /home/user -i single -f SERIALIZED

Attacking target

$ php brutal.php attack <options>

Attack options:

  • -t : Target HTTP(s) to execute attack.
  • -p : Chunks path or specific generated file.
  • -m : HTTP method.
  • -f : Format of request json or form-params.
  • -b : Content body. Use $term to replace string by generated combinations term.
  • --headers : Request headers.
  • -r : Maximum ram memory in megabytes (important increase to generate and attack higher volume of combinations)
  • -v : Verbose mode.

Examples:

Attack from chunks combination generated in folder /home/user to target http://target.test with method POST and json body (note $term matches each combination term inside chunk file):

$ brutal attack -p /home/user -t 'http://target.test' -m POST -f json -b ['user' => 'root', 'password' => '$term']

Attack from specific generated in file /home/user/combination to target http://target.test with method POST using header User-Agent, Host and Cookie with form params body:

$ brutal attack -f /home/user/combination -p 'http://target.test' -m POST --headers ['User-Agent' => 'Test', 'Host' => 'test.local', 'Cookie' => 'qwerty123'] -f form-params ['user' => 'root', 'password' => '$term']

Contribute

To customize and add new features consider extends (open-closed principle) following steps:

  1. Generate
    BrutalService::generate(Combinable) : Combinations
    Build your custom combination algorithm implementing Combinable interface to generate terms
  2. Save
    BrutalService::save(CombinationRepositoryInterface, $chunk = true) : void
    Build your custom saver algorithm implementing CombinationRepositoryInterface
  3. Load
    BrutalService::load(LoadRepositoryInterface) : Chunks
    Build your custom loader algorithm implementing LoadRepositoryInterface
  4. Attack
    BrutallService::attack(AttackRepositoryInterface $attackRepository, Chunks $chunks) : array
    Build your custom attacker algorithm implementing AttackRepositoryInterface
  5. Report
    BrutalService::report(ReportRepositoryInterface $report, array $attackResult)
    Builder your custom reporter implementing ReportRepositoryInterface
You might also like...
Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.

Requests for PHP Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent Requests Python librar

PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs

PHP Curl Class: HTTP requests made easy PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs. Installation Requirements Quic

🐼 Framework agnostic package using asynchronous HTTP requests and PHP generators to load paginated items of JSON APIs into Laravel lazy collections.

Framework agnostic package using asynchronous HTTP requests and generators to load paginated items of JSON APIs into Laravel lazy collections.

Composer package providing HTTP Methods, Status Codes and Reason Phrases for PHP

HTTP Enums For PHP 8.1 and above This package provides HTTP Methods, Status Codes and Reason Phrases as PHP 8.1+ enums All IANA registered HTTP Status

HTTP header kit for PHP 7.1+ (incl. PHP 8) based on PSR-7

HTTP header kit for PHP 7.1+ (incl. PHP 8) based on PSR-7 Installation composer require sunrise/http-header-kit How to use? HTTP Header Collection Mor

Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP.

express.php Express.php is a new HTTP - Server especially made for RESTful APIs written in PHP. Features Fast The Library is handles requests fast and

Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.

This is a port of the VCR Ruby library to PHP. Record your test suite's HTTP interactions and replay them during future test runs for fast, determinis

Application for logging HTTP and DNS Requests

Request Logger Made by Adam Langley ( https://twitter.com/adamtlangley ) What is it? Request logger is a free and open source utility for logging HTTP

librestful is a virion for PocketMine servers that make easier, readable code and for async http requests.

librestful is a virion for PocketMine servers that make easier, readable code for async rest requests.

Owner
Jean Carlo de Souza
I am fascinated by troubleshooting using technology
Jean Carlo de Souza
Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests

laminas-http provides the HTTP message abstraction used by laminas-mvc, and also provides an extensible, adapter-driven HTTP client library.

Laminas Project 33 Aug 27, 2022
A simple script i made that generate a valid http(s) proxy in json format with its geo-location info

Gev Proxy Generator GPG is a simple PHP script that generate a proxy using free services on the web, the proxy is HTTP(s) and it generate it in json f

gev 1 Nov 15, 2021
Declarative HTTP Clients using Guzzle HTTP Library and PHP 8 Attributes

Waffler How to install? $ composer require waffler/waffler This package requires PHP 8 or above. How to test? $ composer phpunit Quick start For our e

Waffler 3 Aug 26, 2022
A simple yet powerful HTTP metadata and assets provider for NFT collections using Symfony

Safe NFT Metadata Provider A simple yet powerful HTTP metadata and assets provider for NFT collections using Symfony.

HashLips Lab 66 Oct 7, 2022
Zenscrape package is a simple PHP HTTP client-provider that makes it easy to parsing site-pages

Zenscrape package is a simple PHP HTTP client-provider that makes it easy to parsing site-pages

Andrei 3 Jan 17, 2022
Simple HTTP cURL client for PHP 7.1+ based on PSR-18

Simple HTTP cURL client for PHP 7.1+ based on PSR-18 Installation composer require sunrise/http-client-curl QuickStart composer require sunrise/http-f

Sunrise // PHP 15 Sep 5, 2022
A simple OOP wrapper to work with HTTP headers in PHP

Headers This package is to allow you to create HTTP Headers in PHP, in a simple and reliable way. Installation composer require http-php/headers Usage

null 5 Aug 9, 2022
A HTTP Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack.

A HTTP Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack.

Kevin Robatel 371 Dec 17, 2022
KTMB (Keretapi Tanah Melayu Berhad) Station Schedule Checker in PHP via MyRailTime 2.0's API

KTM Station Schedule Checker & Journey Planner in Web Form (PHP) KTMB (Keretapi Tanah Melayu Berhad) Station Schedule Checker & Journey Planner in Web

Sam Sam 1 Jun 24, 2022
Requests for PHP is a humble HTTP request library. It simplifies how you interact with other sites and takes away all your worries.

Requests for PHP Requests is a HTTP library written in PHP, for human beings. It is roughly based on the API from the excellent Requests Python librar

null 3.5k Dec 31, 2022