Skip to content

a tool for pentesters to help find delicious candy, by @l0ss and @Sh3r4 ( Twitter: @/mikeloss and @/sh3r4_hax )

License

Notifications You must be signed in to change notification settings

swinowz/FrenchSnaffler

ย 
ย 

Repository files navigation

Snaffler

A dictionary definition of "snaffle".

What is it for?

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.


๐Ÿš€ What's New in This Version?

This version includes several critical improvements over the original Snaffler:

๐Ÿ”ง Enhanced Task Completion Detection

  • 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)

๐Ÿ“ˆ Excel Report Generation

  • New -t auto flag: 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

๐Ÿ“‚ External Rules Loading

  • 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

๐Ÿ‡ซ๐Ÿ‡ท French Language Support

  • Multi-language detection: Now includes French keyword patterns for credential detection
  • Extended coverage: Detects "mot de passe", "identifiant", "utilisateur", and other French terms

๐Ÿ› Stability Improvements

  • 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

๐ŸŽจ Improved User Experience

  • 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

๐Ÿ’ก Quick Start

TL;DR - Don't want to read? Just run this:

snaffler.exe -s -o snaffler.log

But seriously, read the options below for better results! ๐Ÿ™ƒ


๐Ÿ“– What Does It Do?

Broadly speaking - Snaffler:

  1. ๐Ÿ–ฅ๏ธ Gets a list of Windows computers from Active Directory
  2. ๐ŸŒ Spreads out to discover accessible file shares on those computers
  3. ๐Ÿ“ Enumerates ALL files in readable shares
  4. ๐Ÿค– Uses intelligent pattern matching (regex rules + heuristics) to identify interesting files
  5. ๐Ÿ“Š 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 if statements and regexen. But it works remarkably well! ๐Ÿ˜„


๐ŸŽจ What Does It Look Like?


๐Ÿ”‘ How Do I Use It?

โš ๏ธ Important Note

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.


๐ŸŽ›๏ธ Key Command-Line Options

Essential Flags โญ

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!)

Verbosity Control ๐Ÿ”Š

Flag Description
-v <level> Set verbosity: Trace (most verbose), Debug, Info (default), Data (results only)

File Collection ๐Ÿ“ฅ

Flag Description
-m <dir> ๐Ÿ“‚ Auto-copy found files to specified directory
-l <bytes> ๐Ÿ“ Max file size to copy (default: ~10MB)

Scope Control ๐ŸŽฏ

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

Advanced Options โš™๏ธ

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

๐Ÿ“Š Understanding the Output

Here's an annotated example of a log entry:

Log Key

Reading left to right:

  1. โฐ Timestamp - When the file was found
  2. ๐Ÿšจ Triage Level - Color-coded importance (Red = very interesting, Yellow = somewhat interesting, etc.)
  3. ๐Ÿ“‹ Rule Name - Which detection rule matched
  4. ๐Ÿ”’ Access Level - Your permissions (R=Read, W=Write, etc.)
  5. ๐ŸŽฏ Matched Pattern - The exact regex that triggered
  6. ๐Ÿ“ฆ File Size - Size in bytes/KB/MB
  7. ๐Ÿ“… Last Modified - When the file was last changed
  8. ๐Ÿ“ File Path - Full UNC path to the file

๐ŸŽจ Triage Levels

  • ๐Ÿ”ด Red - Highly sensitive (credentials, private keys, etc.)
  • ๐ŸŸก Yellow - Interesting (configs, database files)
  • ๐ŸŸข Green - Potentially useful (scripts, documentation)
  • โšช Black - Low priority but logged

๐Ÿ†• New Features Usage Examples

Excel Report Generation

# 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!

Custom Rules Loading

# 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!

Targeted Auditing with Better Completion

# 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! ๐ŸŽ‰

๐Ÿ”ง Building from Source

Prerequisites

  • .NET Framework (for Snaffler.sln) or .NET Core (for UltraSnaffler.sln)
  • Visual Studio 2019 or later

Build Steps

# 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 build

๐Ÿ“ Configuration Files

Generate a sample config with all options:

snaffler.exe -z generate

This creates default.toml showing all configurable options including:

  • Custom classification rules
  • File extension filters
  • Content regex patterns
  • Output formatting
  • Thread pool settings

๐ŸŽฏ Common Use Cases

๐Ÿ” Quick Domain-Wide Scan

snaffler.exe -s -d contoso.local -o scan_results.log -v Info

๐ŸŽฏ Targeted File Server Audit

snaffler.exe -s -n "FILESERVER01" -o fileserver_audit.log -m C:\findings -l 50000000

๐Ÿ“Š Generate Excel Report for Management

snaffler.exe -s -t auto -d contoso.local -o executive_report.log -b 2

๐Ÿฅท Stealthy DFS-Only Enumeration

snaffler.exe -s -f -d contoso.local -o stealthy_scan.log

๐Ÿ”Ž Deep Dive on Specific Share

snaffler.exe -s -i "\\FILESERVER01\Finance" -o finance_deep_dive.log -r 5000000

โš ๏ธ Legal Disclaimer

Snaffler 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.


๐Ÿ“œ License

This project is licensed under the Apache License 2.0 - see the Licence for details.


๐Ÿ”ด๐ŸŸก๐ŸŸข Happy Hunting! ๐Ÿ”

About

a tool for pentesters to help find delicious candy, by @l0ss and @Sh3r4 ( Twitter: @/mikeloss and @/sh3r4_hax )

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%