https://github.com/yidas/brute-force-attacker-php
Brute-force attack tool for generating all possible string and executing function
https://github.com/yidas/brute-force-attacker-php
brute-force brute-force-attacks cryptanalysis php
Last synced: 11 months ago
JSON representation
Brute-force attack tool for generating all possible string and executing function
- Host: GitHub
- URL: https://github.com/yidas/brute-force-attacker-php
- Owner: yidas
- License: mit
- Created: 2019-07-31T10:50:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-28T09:29:47.000Z (about 3 years ago)
- Last Synced: 2025-03-28T12:51:15.640Z (12 months ago)
- Topics: brute-force, brute-force-attacks, cryptanalysis, php
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Brute Force Attacker for PHP
Brute-force attack tool for generating all possible string and executing function
[](https://packagist.org/packages/yidas/brute-force-attacker)
[](https://packagist.org/packages/yidas/brute-force-attacker)
OUTLINE
-------
- [Demonstration](#demonstration)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)
---
DEMONSTRATION
-------------
```php
\yidas\BruteForceAttacker::run([
'length' => 2,
'callback' => function ($string) {
echo "{$string} ";
},
]);
/* Result
AA AB AC ... AX AY AZ Aa Ab Ac ... Ax Ay Az A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 BA ...
*/
```
Generates `0`-`9` string and matches target string:
```php
\yidas\BruteForceAttacker::run([
'length' => 6,
'charMap' => range('0', '9'),
'callback' => function ($string, $count) {
if ($string=="264508") {
echo "Matched `{$string}` with {$count} times\n";
return true;
}
},
]);
```
---
REQUIREMENTS
------------
This library requires the following:
- PHP 5.4.0+\|7.0+\|8.0+
---
INSTALLATION
------------
Run Composer in your project:
composer require yidas/brute-force-attacker
Then you could call it after Composer is loaded depended on your PHP framework:
```php
require __DIR__ . '/vendor/autoload.php';
use yidas\BruteForceAttacker;
```
---
USAGE
-----
Call the `run()` static method and bring in the options to start:
```php
\yidas\BruteForceAttacker::run(array $options)
```
### Options
Setting all options including skip mechanism:
```php
$hash = '5b7476628919d2d57965e25ba8b2588e94723b76';
\yidas\BruteForceAttacker::run([
'length' => 8,
'charMap' => array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'), ["+", "/"]),
'callback' => function ($key, & $count) use ($hash) {
if (sha1($key) == $hash) {
echo "Matched `{$key}` | Hash: {$hash}\n";
exit;
}
// Display key every some times
if ($count == 0 || $count > 10000000) {
echo "{$key} | " . date("H:i:s") . "\n";
$count = 0;
}
},
'startFrom' => 'AABAAAAA', // Start from `AABAAAAA` -> `AABAAAAB` ...
'skipLength' => 8, // Select 8st character for skipCount
'skipCount' => 1, // Start from `B` (Skip 1 arrangement form charMap)
]);
```
#### length
String length for generating
#### charMap
Character map used to generate strings
#### callback
Customized function for performing brute-force attack
```php
function (string $key, integer & $count)
```
#### startFrom
Start running from the givien charset string
#### skipLength
String length for skipping based on `skipCount` setting
#### skipCount
Skip count of the `charMap` based on `skipLength`