Snaffler is a tool for pentesters and red teamers to help find delicious candy needles (creds mostly, but it's flexible) in a bunch of horrible boring haystacks (a massive Windows/AD environment).
It might also be useful for other people doing other stuff, but it is explicitly NOT meant to be an "audit" tool.
This version includes several critical improvements over the original Snaffler:
- Better reliability: Fixed issues where Snaffler would exit prematurely before completing all file scans
- Real-time monitoring: Added debug output showing task queue status (queued/running/completed)
- Polling mechanism: Replaced problematic timer-based completion with robust polling loop
- Accurate counters: Task schedulers now properly track completed work across all three phases (share discovery, tree walking, file scanning)
- New
-t autoflag: Automatically generates Excel reports (.xlsx) with findings - Better analysis: Structured output perfect for reporting and sharing results with teams
- LogType.Auto: New log type option specifically for Excel export functionality
- Flexible rules: Load custom TOML rules from external
SnaffRules/DefaultRules/directory - No recompilation: Modify detection rules without rebuilding the entire project
- User-specified paths: Use
-p <path>to load rules from any directory - Better debugging: Detailed console output showing which rules are loaded and from where
- Multi-language detection: Now includes French keyword patterns for credential detection
- Extended coverage: Detects "mot de passe", "identifiant", "utilisateur", and other French terms
- Enhanced error handling in file and tree scanning operations
- Better task scheduler queue management
- More informative debug messages throughout the scanning process
- Fixed completion detection logic preventing premature exits
- More verbose logging options showing scan progress
- Clear indicators when tasks start and complete
- Total file count displayed at completion
- Better feedback during long-running operations
TL;DR - Don't want to read? Just run this:
snaffler.exe -s -o snaffler.logBut seriously, read the options below for better results! ๐
Broadly speaking - Snaffler:
- ๐ฅ๏ธ Gets a list of Windows computers from Active Directory
- ๐ Spreads out to discover accessible file shares on those computers
- ๐ Enumerates ALL files in readable shares
- ๐ค Uses intelligent pattern matching (regex rules + heuristics) to identify interesting files
- ๐ Outputs results in multiple formats including plain text, JSON, or Excel
Note: Despite what we'd love to claim, it doesn't use actual ML - just really good pattern matching with lots of
ifstatements and regexen. But it works remarkably well! ๐
If you "literally just run the EXE on a domain joined machine in the context of a domain user" without any flags, it will basically do nothing. This is intentional (our little prank ๐ญ on people who skip README files).
You MUST add the correct flags to enable scanning and output.
| Flag | Description |
|---|---|
-o <file> |
๐ Output results to a file (e.g., -o C:\results\audit.log) |
-s |
๐ฅ๏ธ Output results to stdout in real-time |
-t <type> |
๐ Log type: plain, json, or auto (Excel export - NEW!) |
| Flag | Description |
|---|---|
-v <level> |
Set verbosity: Trace (most verbose), Debug, Info (default), Data (results only) |
| Flag | Description |
|---|---|
-m <dir> |
๐ Auto-copy found files to specified directory |
-l <bytes> |
๐ Max file size to copy (default: ~10MB) |
| Flag | Description |
|---|---|
-i <path> |
๐ Disable discovery, scan specific directory only |
-n <hosts> |
๐ฅ๏ธ Disable computer discovery, scan specific hosts (comma-separated or file path) |
-d <domain> |
๐ Specify domain to search |
-c <DC> |
๐ฎ Domain controller to query |
-f |
๐ฒ Use DFS only (stealthier!) |
-a |
๐ List shares only, skip file enumeration |
| Flag | Description |
|---|---|
-b <0-3> |
๐๏ธ Boring level - skip less interesting findings (0=find everything, 3=only critical) |
-u |
๐ค Pull interesting usernames from AD and search for them |
-r <bytes> |
๐ Max file size to search inside for strings (default: 500KB) |
-j <bytes> |
๐ Context bytes around found strings (e.g., -j 200) |
-z <path> |
โ๏ธ Path to config file (use -z generate to create template) |
-p <path> |
๐ Load custom rules from directory |
-x <num> |
๐งต Max threads (don't go below 4) |
-y |
๐ TSV-formatted output |
Here's an annotated example of a log entry:
Reading left to right:
- โฐ Timestamp - When the file was found
- ๐จ Triage Level - Color-coded importance (Red = very interesting, Yellow = somewhat interesting, etc.)
- ๐ Rule Name - Which detection rule matched
- ๐ Access Level - Your permissions (R=Read, W=Write, etc.)
- ๐ฏ Matched Pattern - The exact regex that triggered
- ๐ฆ File Size - Size in bytes/KB/MB
- ๐ Last Modified - When the file was last changed
- ๐ File Path - Full UNC path to the file
- ๐ด Red - Highly sensitive (credentials, private keys, etc.)
- ๐ก Yellow - Interesting (configs, database files)
- ๐ข Green - Potentially useful (scripts, documentation)
- โช Black - Low priority but logged
# Generate Excel report with all findings
snaffler.exe -s -t auto -o results.log
# Excel file will be created automatically with structured data
# Perfect for team collaboration and reporting!# Load rules from custom directory
snaffler.exe -s -o audit.log -p "C:\MyCustomRules"
# Or place rules in SnaffRules/DefaultRules/ next to the executable
# Snaffler will auto-detect and load them!# Audit specific hosts with verbose output
snaffler.exe -s -o results.log -n "DC01,FILESERVER01,BACKUP01" -v Debug
# Improved task tracking ensures all files are scanned
# before exiting - no more premature termination! ๐- .NET Framework (for Snaffler.sln) or .NET Core (for UltraSnaffler.sln)
- Visual Studio 2019 or later
# Clone the repository
git clone https://github.com/yourusername/Snaffler.git
cd Snaffler
# Restore NuGet packages
dotnet restore
# Build the project
dotnet build -c Release
# Or use Visual Studio
# Open Snaffler.sln or UltraSnaffler.sln and buildGenerate a sample config with all options:
snaffler.exe -z generateThis creates default.toml showing all configurable options including:
- Custom classification rules
- File extension filters
- Content regex patterns
- Output formatting
- Thread pool settings
snaffler.exe -s -d contoso.local -o scan_results.log -v Infosnaffler.exe -s -n "FILESERVER01" -o fileserver_audit.log -m C:\findings -l 50000000snaffler.exe -s -t auto -d contoso.local -o executive_report.log -b 2snaffler.exe -s -f -d contoso.local -o stealthy_scan.logsnaffler.exe -s -i "\\FILESERVER01\Finance" -o finance_deep_dive.log -r 5000000Snaffler is intended for authorized security testing and research purposes only.
- โ Use on networks you own or have explicit permission to test
- โ Do NOT use on systems without authorization
- ๐ For educational and legitimate security assessment only
The authors assume no liability for misuse of this tool.
This project is licensed under the Apache License 2.0 - see the Licence for details.
๐ด๐ก๐ข Happy Hunting! ๐


