Skip to content

Commit

Permalink
Merge pull request #4 from codedsprit/blunder
Browse files Browse the repository at this point in the history
chore(project): src improvements and .github file upgrade
  • Loading branch information
bibashjaprel authored Jun 9, 2024
2 parents 1176c28 + eb371f1 commit b7fcc44
Show file tree
Hide file tree
Showing 10 changed files with 9,307 additions and 69 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: bibashjaprel
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

name: Feature request
description: Request an enhancement for Brute-forcer.
labels: [enhancement]
body:

- type: markdown
attributes:
value: |
Before requesting: search [existing feature requests].
- type: textarea
attributes:
label: "Problem"
description: "Describe the problem to be solved."
placeholder: "No smurf icons available. Smurfs are useful because ..."
validations:
required: true

- type: textarea
attributes:
label: "Expected behavior"
description: "Describe what the new feature or behavior would look like. How does it solve the problem? Is it worth the cost?"
validations:
required: true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Compiled files and executables

virtual_environment/

88 changes: 42 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,64 @@
# Directory Brute Forcer
# [`Brute-Forcer`](https://github.com/bibashjaprel/brute-forcer)🐉
*`SIMPLE YET MINIMAL`* || [`Brute-Forcer`](https://github.com/bibashjaprel/brute-forcer/),  ``A tool for brute forcing web directoies the fast way.``

Directory Brute Forcer is a Python script for brute forcing directories on a target website using a wordlist of common directory names. It provides a simple yet effective way to discover potential directories on a web server.
## Table of contents 📔

## Features
* [`Features`](#features)
* [`Installation`](#installation)
* [`Contribution`](#contribution)
* [`License`](#license)

- Brute forces directories on a target website using a wordlist of common directory names.
- Prints found directories with their HTTP response status codes.
- Supports multi-threading for faster directory discovery.
- Customizable wordlist for directory brute forcing.

## Getting Started

### Installation

1. Clone this repository:
<a name="features"></a>
## Features 🍙
- **Fast**: [`Brute-forcer`](https://github.com/bibashjaprel/brute-forcer) is designed to be fast, by implementing multi-threading for faster directory discovery.
- **Ease**: This tool is designed to be very user friendly and anyone can use it.
- **Simple**: [`Brute-forcer`](https://github.com/bibashjaprel/brute-forcer)is made upon less ``slokes``.
- **Customizable**: It has customizable wordlists for directory brute forcing, anyone can use any wordlists as they prefer to use.

```bash
git clone --depth=1 https://github.com/bibashjaprel/Brute-Forcer #To clone the latest commmit
```
2.Navigate to the directory_brute_forcer directory:
```bash
cd Brute-Forcer
<a name="installation"></a>
## Installation 📩

<details> <summary><code>🪄 Binary </code></summary>
&nbsp;

- **Manual**: You can directly download the binary from [**releases**](https://github.com/bibashjaprel/brute-forcer/releases) and use it.

</details>
<details> <summary><code>🌼 Source </code></summary>
&nbsp;

```bash
git clone --depth=1 https://github.com/bibashjaprel/brute-forcer --branch=main
cd brute-forcer
```
3.Use Virtual enivronment for python
```bash
**``virtual environment``**
```bash
python -m venv virtual_environment
source virtual_environment/bin/activate
```
4.Install dependencies:
**``dependencies``**
```bash
pip install -r requirements.txt
```
### Usage
Run the `brute_forcer.py` script with the target URL as an argument:
```bash
python brute_forcer/brute_forcer.py -u https://example.com/
```
or
**``brute-forcer help menu``**
```bash
python brute_forcer/brute_forcer.py -u https://example.com -w /path/to/wordlist
python3 brute-forcer -h
```
You will be prompted to enter the target URL and wordlist file path. The script will then attempt to brute force directories on the target website and print the results.

### Contributing
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:

1. Fork the repository.

2. Create a new branch (git checkout -b feature/your-feature-name).

3. Make your changes.

4. Commit your changes (git commit -am 'Add new feature').
<strong>Now you are good to go.</strong>
</details>

5. Push to the branch (git push origin feature/your-feature-name).

6. Create a new pull request.

### Wordlist
The wordlist/ directory contains common directory names. You can customize the `common_directories.txt` file or add your own wordlist files for directory brute forcing.
<a name="contribution"></a>
## Contribution 🤝

## Disclaimer
This tool is intended for ethical hacking and security testing purposes only. Use it responsibly and only on websites you have permission to test.
Contributions are welcome! You can suggest features, report bugs, fix issues via [issues](https://github.com/bibashjaprel/brute-forcer/issues) or [pull requests](https://github.com/bibashjaprel/bute-forcer/pulls). Help with ``code`` or any other are appreciated.

### License

This project is licensed under the [MIT License](LICENSE).
<a name="license"></a>
## License 🔐
Licensed under the [**`MIT LICENSE`**](/LICENSE)
<hr>
76 changes: 53 additions & 23 deletions brute_forcer/brute_forcer.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,84 @@
#
# Author: Bibash Japrel (github.com/bibashjaprel)

# A simple yet fast tool for finding web directories.

import requests
import re,sys,argparse
import re, sys, argparse, os
import concurrent.futures
from urllib.parse import urljoin
#Check and parse the Argument

''' Colors '''
BLUE = '\033[0;38;5;12m'
RED = '\033[1;31m'
END = '\033[0m'
BOLD = '\033[1m'

# -------------- Arguments & Usage -------------- #
parser = argparse.ArgumentParser()

parser.add_argument("-u", "--url", help="Use -u or --url followed by a url")
parser.add_argument("-w", "--wordlist", help="Use -w or --wordlist followed by wordlist")
args = parser.parse_args()
parser.add_argument("-i", "--include_404", action="store_true", help="Include 404 not found in the output")
parser.add_argument("-t", "--threads", type=int, default=20, help="Number of threads to use (default is 20)")
args = parser.parse_args() # arguments to be parsed

if not args.url:
print(f"\033[0;31mPlease Provide a url use -h or --help to get the help message\033[0m")
print('''%s┓ ┏
┣┓┏┓┓┏╋┏┓━━╋┏┓┏┓┏┏┓┏┓
┗┛┛ ┗┻┗┗ ┛┗┛┛ ┗┗ ┛
by @bibashjaprel <3 %s''' % (RED, END))
print()
print('''%s * 💻 web app directory brute forcer.%s''' % (BLUE, END))
sys.exit(1)
else:
url = args.url
url = args.url

# Function to Check the Url is Valid or Invalid
def url_checker(url):
url_regex = r'^https?:\/\/'
if url and not re.match(url_regex, url):
print("Invalid URL. Please provide a URL with http or https scheme.")
sys.exit(1)
return url

# Function to check if a directory exists on the target website
def check_directory(url, directory):
def check_directory(session, url, directory, include_404):
try:
response = requests.get(urljoin(url, directory))
response = session.get(urljoin(url, directory), timeout=10)
if response.status_code == 200:
print(f"\033[92m[+] [200] Found directory: {urljoin(url, directory)}\033[0m")
else:
elif include_404:
print(f"[+] [404] NOT Found : {urljoin(url, directory)}")
except Exception as e:
except requests.RequestException as e:
pass

# Function to brute force directories using multiple threads
def brute_force_directories(url, wordlist, num_threads=10):
def brute_force_directories(url, wordlist, include_404, num_threads):
with open(wordlist, 'r') as f:
directories = f.read().splitlines()

with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
futures = [executor.submit(check_directory, url, directory) for directory in directories]
try:
for future in concurrent.futures.as_completed(futures):
future.result()
except KeyboardInterrupt:
print("\nKeyboardInterrupt received. Terminating...")
for future in futures:
future.cancel()
executor.shutdown(wait=False)
with requests.Session() as session:
with concurrent.futures.ThreadPoolExecutor(max_workers=num_threads) as executor:
futures = [executor.submit(check_directory, session, url, directory, include_404) for directory in directories]
try:
for future in concurrent.futures.as_completed(futures):
future.result()
except KeyboardInterrupt:
print("\nKeyboardInterrupt received. Terminating...")
for future in futures:
future.cancel()
executor.shutdown(wait=False)

if __name__ == "__main__":
url=args.url
url = args.url
target_url = url_checker(url)
wordlist_path = args.wordlist if args.wordlist else '../wordlist/common_directories.txt'
brute_force_directories(target_url, wordlist_path)

# Get the script's directory
script_dir = os.path.dirname(os.path.realpath(__file__))
default_wordlist_path = os.path.join(script_dir, '..', 'wordlists', 'common_directories.txt')

wordlist_path = args.wordlist if args.wordlist else default_wordlist_path
include_404 = args.include_404
num_threads = args.threads
brute_force_directories(target_url, wordlist_path, include_404, num_threads)
Loading

0 comments on commit b7fcc44

Please sign in to comment.