Update README and Dockerfiles to reflect optimized build process and image sizes. Added detailed explanations for compilation flags and enhanced binary stripping techniques. Introduced separate Dockerfile for optimized image with LZMA compression.
This commit is contained in:
61
README.md
61
README.md
@@ -15,7 +15,8 @@ A minimal, ultra-compressed Docker image containing a password bruteforce tool t
|
||||
|
||||
| Image | Size | Compression |
|
||||
|-------|------|-------------|
|
||||
| This tool | ~46KB | UPX ultra-brute |
|
||||
| This tool (optimized) | 42.5KB | UPX LZMA ultra-brute |
|
||||
| This tool (original) | 45.7KB | UPX ultra-brute |
|
||||
| Standard Alpine | ~5MB | None |
|
||||
| Standard Ubuntu | ~70MB | None |
|
||||
|
||||
@@ -29,19 +30,22 @@ A minimal, ultra-compressed Docker image containing a password bruteforce tool t
|
||||
|
||||
### 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
|
||||
2. **Static compilation** with musl-gcc and aggressive optimization flags
|
||||
3. **Enhanced binary stripping** to remove debug symbols and unused sections
|
||||
4. **UPX LZMA compression** with ultra-brute mode for maximum compression
|
||||
5. **Scratch base image** for minimal size
|
||||
|
||||
## 🏗️ Building
|
||||
|
||||
```bash
|
||||
# Build the image
|
||||
# Build the optimized image (recommended)
|
||||
docker build -t bruteforce-optimized -f brute/source/Dockerfile.optimized brute/source
|
||||
|
||||
# Build the original image
|
||||
docker build -t bruteforce-test -f brute/source/Dockerfile brute/source
|
||||
|
||||
# Check image size
|
||||
docker images bruteforce-test
|
||||
# Check image sizes
|
||||
docker images bruteforce-optimized bruteforce-test
|
||||
```
|
||||
|
||||
## 🚀 Usage
|
||||
@@ -60,10 +64,17 @@ docker run --rm \
|
||||
|
||||
#### Crack root password
|
||||
```bash
|
||||
# Using optimized image (recommended)
|
||||
docker run --rm \
|
||||
--volume "/etc:/etc" \
|
||||
--volume "$(pwd)/brute/source/wordlist2.txt:/wordlist2.txt" \
|
||||
bruteforce-optimized:latest \
|
||||
root /wordlist2.txt
|
||||
|
||||
# Using original image
|
||||
docker run --rm \
|
||||
--volume "/etc:/etc" \
|
||||
--volume "$(pwd)/brute/source/wordlist2.txt:/wordlist2.txt" \
|
||||
--user root \
|
||||
bruteforce-test:latest \
|
||||
root /wordlist2.txt
|
||||
```
|
||||
@@ -117,6 +128,32 @@ Password successfully cracked!
|
||||
- Root privileges (for accessing shadow file)
|
||||
|
||||
### Compilation Flags
|
||||
|
||||
#### Optimized Version (Recommended)
|
||||
```bash
|
||||
gcc -static -Os -s \
|
||||
-fomit-frame-pointer \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-fno-unwind-tables \
|
||||
-fno-asynchronous-unwind-tables \
|
||||
-Wl,--gc-sections \
|
||||
-Wl,--strip-all \
|
||||
-o bruteforce \
|
||||
bruteforce.c \
|
||||
yescrypt-ref.c \
|
||||
yescrypt-common.c \
|
||||
sha256.c \
|
||||
insecure_memzero.c \
|
||||
&& strip --strip-all \
|
||||
--remove-section=.comment \
|
||||
--remove-section=.note.* \
|
||||
--remove-section=.eh_frame \
|
||||
bruteforce \
|
||||
&& upx --lzma --ultra-brute bruteforce
|
||||
```
|
||||
|
||||
#### Original Version
|
||||
```bash
|
||||
gcc -static -Os -s -o bruteforce \
|
||||
bruteforce.c \
|
||||
@@ -130,9 +167,11 @@ gcc -static -Os -s -o 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
|
||||
- **Aggressive size optimization**: `-Os` flag with additional optimizations
|
||||
- **Enhanced symbol stripping**: Remove debug symbols and unused sections
|
||||
- **UPX LZMA compression**: Ultra-brute mode with LZMA algorithm for maximum compression
|
||||
- **Dead code elimination**: `--gc-sections` to remove unused functions
|
||||
- **Frame pointer omission**: `-fomit-frame-pointer` for smaller binaries
|
||||
- **Scratch base**: No OS layer in final image
|
||||
|
||||
## 🛡️ Security Considerations
|
||||
|
||||
Reference in New Issue
Block a user