Initial import: ultra-small bruteforce tool, docs, and .gitignore

This commit is contained in:
2025-07-04 23:43:25 +00:00
parent 15a5f50365
commit 3b51303ab6
21 changed files with 6334 additions and 59 deletions

241
README.md
View File

@@ -1,79 +1,206 @@
# Worlds smallest Docker Image - aka WSDI | 92 bytes
# World's Smallest Docker Image - Password Bruteforce Tool
https://hub.docker.com/repository/docker/dooqod/wsdi/general
A minimal, ultra-compressed Docker image containing a password bruteforce tool that can crack various hash types including yescrypt, MD5, SHA256, and SHA512.
Hi everyone,
## 🚀 Features
If you ever wondered what is the minimal Docker image in the world, then you are in right place.
Is it debian, is it alpine or busybox ?
- **Ultra-small Docker image** (~46KB compressed)
- **Multiple hash support**: yescrypt, MD5, SHA256, SHA512
- **Static binary**: No external dependencies
- **UPX compressed**: Maximum size optimization
- **Real-time progress**: Shows attempts and statistics
- **Comprehensive logging**: Detailed output for debugging
Our team at Dooqod did extensive research on to figure out this.
## 📊 Image Size Comparison
We come up with 2 approaches to figure this out.
| Image | Size | Compression |
|-------|------|-------------|
| This tool | ~46KB | UPX ultra-brute |
| Standard Alpine | ~5MB | None |
| Standard Ubuntu | ~70MB | None |
## Approach 1:
At least there is finate amount of Docker images under DockerHub.
So this task should not be impossible. To run all of them and compare.
## 🛠️ Technical Details
But it'll take lots of time and resources.
### Hash Algorithms Supported
- **yescrypt** (`$y$`) - Modern Linux default
- **MD5** (`$1$`) - Legacy support
- **SHA256** (`$5$`) - SHA-256 based
- **SHA512** (`$6$`) - SHA-512 based
## Approach 2:
We decided to create the smallest one and publish under DockerHub. Sounds promising.
### Build Process
1. **Multi-stage build** using Alpine Linux
2. **Static compilation** with musl-gcc
3. **Binary stripping** to remove debug symbols
4. **UPX compression** with ultra-brute mode
5. **Scratch base image** for minimal size
## Wow moment
## 🏗️ Building
Wow, we can create the smallest Docker image in the world.
It can be the MVP and we can try to sell it :)
So we started this project right away.
## Dockerfile of the 'worlds-smallest-docker-image'
d - is just an emptyfile we add into 'scratch'
```shell
FROM scratch
ADD d /d
```bash
# Build the image
docker build -t bruteforce-test -f brute/source/Dockerfile brute/source
# Check image size
docker images bruteforce-test
```
## What is scratch ?
The scratch image is the most minimal image in DockerHub. This is the base ancestor for all other images.
The scratch image is actually empty. It doesn't contain any folders/files.
You can use Dockers reserved, minimal image, scratch, as a starting point for building containers. Using the scratch “image” signals to the build process that you want the next command in the Dockerfile to be the first filesystem layer in your image.
While scratch appears in Dockers repository on the hub, you cant pull it, run it, or tag any image with the name scratch. Instead, you can refer to it in your Dockerfile. For example, to create a minimal container using scratch:
https://hub.docker.com/_/scratch
## How to build
```shell
# just clone the repo
# cd into repository and run
docker build -t wsdi .
# or pull from DockerHub
docker pull docker.io/dooqod/wsdi:latest
# check
## 🚀 Usage
### Basic Usage
```bash
# Crack password for a specific user
docker run --rm \
--volume "/etc:/etc" \
--user root \
bruteforce-test:latest \
<username> <wordlist_path>
```
## Support the project to not grow :)
### Example Commands
Our goal is to make this image minimal.
We'll put all our efforts to keep it simple and small also in the feature.
#### Crack root password
```bash
docker run --rm \
--volume "/etc:/etc" \
--volume "$(pwd)/brute/source/wordlist2.txt:/wordlist2.txt" \
--user root \
bruteforce-test:latest \
root /wordlist2.txt
```
- Give a Github Star
- Buy lambo -
#### Crack specific user password
```bash
docker run --rm \
--volume "/etc:/etc" \
--volume "$(pwd)/custom_wordlist.txt:/wordlist.txt" \
--user root \
bruteforce-test:latest \
alice /wordlist.txt
```
### Output Example
```
Target user: root
Hash type: yescrypt
Full hash: $y$j9T$dummy.salt.hash.example$dummy.hash.value.here
Starting bruteforce...
Tried 1000 passwords...
Found password: [password_found]
Total passwords tried: 102
Password successfully cracked!
```
## 📁 Project Structure
```
.
├── brute/
│ └── source/
│ ├── Dockerfile # Multi-stage build configuration
│ ├── bruteforce.c # Main bruteforce implementation
│ ├── wordlist.txt # Large wordlist (133MB)
│ ├── wordlist2.txt # Small wordlist (801B)
│ └── yescrypt/ # yescrypt reference implementation
│ ├── yescrypt-ref.c
│ ├── yescrypt-common.c
│ ├── sha256.c
│ ├── insecure_memzero.c
│ └── *.h files
└── README.md
```
## 🔧 Development
### Prerequisites
- Docker
- Linux system with /etc/shadow access
- Root privileges (for accessing shadow file)
### Compilation Flags
```bash
gcc -static -Os -s -o bruteforce \
bruteforce.c \
yescrypt-ref.c \
yescrypt-common.c \
sha256.c \
insecure_memzero.c \
&& strip --strip-all --remove-section=.comment bruteforce \
&& upx --ultra-brute bruteforce
```
### Optimization Techniques
- **Static linking**: No external dependencies
- **Size optimization**: `-Os` flag for minimal size
- **Symbol stripping**: Remove debug symbols
- **UPX compression**: Ultra-brute mode for maximum compression
- **Scratch base**: No OS layer in final image
## 🛡️ Security Considerations
⚠️ **WARNING**: This tool is for educational and authorized testing purposes only.
- Only use on systems you own or have explicit permission to test
- Respect local laws and regulations regarding password cracking
- Use responsibly and ethically
- Consider legal implications before use
## 📈 Performance
- **Speed**: Optimized for size over speed
- **Memory**: Minimal memory footprint
- **CPU**: Single-threaded, CPU intensive
- **I/O**: Efficient file reading with minimal syscalls
## 🐛 Troubleshooting
### Common Issues
1. **Permission denied accessing /etc/shadow**
```bash
# Run with root user
--user root
```
2. **Wordlist not found**
```bash
# Ensure correct path mapping
--volume "$(pwd)/wordlist.txt:/wordlist.txt"
```
3. **User not found in shadow file**
- Verify username exists
- Check shadow file permissions
### Debug Mode
The tool provides detailed output including:
- Target user information
- Hash type and format
- Progress updates every 1000 attempts
- Final statistics
## 🤝 Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Test thoroughly
5. Submit a pull request
## 📄 License
This project is for educational purposes. Use responsibly and in accordance with applicable laws.
## 👨‍💻 Author
**@tuankiet2s**
## 🙏 Acknowledgments
- yescrypt reference implementation
- UPX compression tool
- Alpine Linux for minimal base image
- Docker multi-stage builds
---
**Remember**: With great power comes great responsibility. Use this tool ethically and legally.