# SMB Exploitation Tool

![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)
![Python](https://img.shields.io/badge/python-3.6+-blue.svg)
![License](https://img.shields.io/badge/license-MIT-green.svg)

Advanced SMB Exploitation Framework with Interactive Colorful Terminal Interface - For Authorized Security Testing and Penetration Testing Only.

## ⚠️ Legal Disclaimer

**FOR AUTHORIZED SECURITY TESTING ONLY**

This tool is designed for authorized security professionals conducting legitimate penetration tests and security assessments. Unauthorized access to computer systems is illegal under laws including (but not limited to):
- Computer Fraud and Abuse Act (CFAA) in the United States
- Computer Misuse Act in the United Kingdom
- Similar legislation in other jurisdictions worldwide

**BY USING THIS TOOL, YOU AGREE:**
- You have explicit written authorization to test the target systems
- You understand and accept all legal responsibilities
- You will use this tool only for lawful purposes
- The authors are not responsible for any misuse or damage

## 🎯 Features

### Interactive Colorful Shell
- Beautiful terminal UI powered by Rich library
- Easy-to-use menu-driven interface
- Real-time configuration display
- Progress tracking and status updates

### Advanced SMB Exploitation
- Multiple evasion techniques (4 levels: 0-3)
- Protocol switching and tunneling
- HTTP/HTTPS tunneling capabilities
- SSL/TLS obfuscation
- Traffic morphing and protocol impersonation
- Reverse shell functionality

### Comprehensive Testing
- Target scanning and enumeration
- Vulnerability detection (EternalBlue, SMBGhost, Zerologon, etc.)
- Exploitation with configurable parameters
- Detailed logging and reporting

## 📦 Installation

### From PyPI

```bash
pip install smb-exploitation-tool
```

### From Source

```bash
git clone https://github.com/yourusername/smb_exploitation_tool.git
cd smb_exploitation_tool
pip install -r requirements.txt
pip install -e .
```

## 🚀 Usage

### Interactive Mode (Recommended)

Launch the colorful interactive shell:

```bash
smb-tool
```

This provides an easy-to-use menu interface where you can:
1. Configure targets
2. Set ports and duration
3. Adjust evasion levels
4. Configure reverse shell settings
5. Start assessments

### Command-Line Mode

For advanced users and automation:

```bash
smb-exploit --target <TARGET_IP> -e 3 --http-tunnel -d 1200
```

#### Command-Line Options

```
--target TARGET         Target host(s) or file containing targets (required)
-p, --ports PORTS       SMB ports (default: 139,445)
-d, --duration SECONDS  Assessment duration (default: 1200)
-e, --evasion LEVEL     Evasion level 0-3 (default: 3)
-o, --output FILE       Output results file (default: exploitation_results.json)
--no-exploit            Disable exploitation attempts (scan only)
--http-tunnel           Force HTTP tunneling
--reverse-shell-port    Port for reverse shell (default: 4444)
--reverse-shell-ip      IP for reverse shell (default: auto-detect)
```

## 🎨 Interactive Shell Screenshots

The interactive shell provides:
- Colorful ASCII art banner
- Organized menu system
- Configuration tables
- Progress indicators
- Real-time status updates

## 📋 Examples

### Example 1: Quick Security Assessment

```bash
# Launch interactive shell
smb-tool

# Then select:
# 1. Configure Target(s) → Enter: 192.168.1.100
# 10. Run Quick Scan
```

### Example 2: Full Penetration Test

```bash
smb-exploit --target targets.txt -e 3 --http-tunnel -d 3600 --reverse-shell-port 4444
```

### Example 3: Stealth Assessment

```bash
smb-exploit --target 10.0.0.0/24 -e 3 --no-exploit -d 600 -o stealth_scan.json
```

## 🔧 Configuration

### Evasion Levels

- **Level 0**: No evasion (direct connection)
- **Level 1**: Basic evasion (fragmentation, random delays)
- **Level 2**: Moderate evasion (+ junk data, protocol switching, traffic morphing)
- **Level 3**: Advanced evasion (+ SSL/HTTP tunneling, protocol impersonation)

### Target Specification

Targets can be specified as:
- Single IP: `192.168.1.100`
- Multiple IPs: `192.168.1.100,192.168.1.101`
- IP with port: `192.168.1.100:8445`
- File containing targets: `/path/to/targets.txt`

## 📊 Output

Results are saved in JSON format containing:
- Detected vulnerabilities
- Exploitation attempts and results
- Crash reports
- Evasion techniques used
- Timestamp and metadata

## 🛡️ Defensive Recommendations

Organizations can use this tool to:
- Test their defenses against SMB exploits
- Validate security controls
- Improve detection capabilities
- Train security teams

### Defense Strategies

- Keep systems patched and updated
- Disable SMBv1 protocol
- Enable SMB signing
- Implement network segmentation
- Deploy EDR/XDR solutions
- Monitor for anomalous SMB traffic
- Use application allowlisting

## 🔒 Security Features

- Requires explicit authorization confirmation
- Comprehensive logging
- Configurable exploit disable mode
- Detailed reporting for compliance

## 🤝 Contributing

This is a security research tool. Contributions should focus on:
- Improving detection capabilities
- Adding defensive features
- Enhancing logging and reporting
- Bug fixes and stability

## 📝 License

MIT License - See LICENSE file for details

## 👥 Authors

Security Research Team

## 🙏 Acknowledgments

This tool is for educational and authorized testing purposes. It demonstrates various SMB vulnerabilities and exploitation techniques to help security professionals understand and defend against these attacks.

## 📚 Resources

- [OWASP Testing Guide](https://owasp.org/www-project-web-security-testing-guide/)
- [NIST Cybersecurity Framework](https://www.nist.gov/cyberframework)
- [MITRE ATT&CK Framework](https://attack.mitre.org/)

## ⚖️ Responsible Disclosure

If you discover vulnerabilities in systems during authorized testing, follow responsible disclosure practices:
1. Document findings thoroughly
2. Report to appropriate parties
3. Allow time for remediation
4. Follow disclosure guidelines

---

**Remember: With great power comes great responsibility. Use this tool ethically and legally.**
