GitHub - karmahacker/mailinspect: Comprehensive Email Server Security Scanner - Check SPF, DMARC, DKIM, TLS, blacklists and more · GitHub
Skip to content

About

Comprehensive Email Server Security Scanner - Check SPF, DMARC, DKIM, TLS, blacklists and more

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

MailInspect 🔍📧

A comprehensive email server security scanner that checks domains for mail configuration issues and vulnerabilities. Similar to MXToolbox but as a command-line tool with detailed security analysis.

Features

Email Authentication

  • SPF (Sender Policy Framework) - Validates SPF records and identifies configuration issues
  • DMARC (Domain-based Message Authentication) - Analyzes DMARC policies and alignment settings
  • DKIM (DomainKeys Identified Mail) - Discovers and validates DKIM selectors
  • BIMI (Brand Indicators for Message Identification) - Checks for BIMI configuration

Mail Server Security

  • MX Record Analysis - Validates mail exchanger records and priorities
  • SMTP Connectivity Tests - Tests mail server availability and response times
  • TLS/SSL Verification - Validates encryption protocols and certificate validity
  • Open Relay Detection - Checks if servers are configured as open relays
  • Authentication Method Analysis - Identifies supported SMTP authentication methods

Reputation & Compliance

  • Blacklist Checking - Checks IPs against 40+ major email blacklists (Spamhaus, Barracuda, etc.)
  • PTR Record Validation - Verifies reverse DNS configuration
  • FCrDNS Verification - Validates Forward-Confirmed reverse DNS
  • MTA-STS & TLSRPT - Checks for advanced security features

Reporting

  • Security Scoring - Provides an overall security score (0-100)
  • Color-coded Console Output - Easy-to-read terminal reports
  • JSON Export - Machine-readable output for automation
  • Detailed Recommendations - Actionable steps to improve security

Installation

From Source

git clone https://github.com/karmahacker/mailinspect.git
cd mailinspect
pip install -r requirements.txt
python mailinspect.py yourdomain.com

Using pip

pip install -e .
mailinspect yourdomain.com

Usage

Basic Scan

python mailinspect.py yourdomain.com

Verbose Mode

python mailinspect.py yourdomain.com -v

Save Report to File

python mailinspect.py yourdomain.com -o report.txt

JSON Output

python mailinspect.py yourdomain.com --json > report.json

Combined Options

python mailinspect.py yourdomain.com -v --json -o detailed_report.json

Example Output

╔══════════════════════════════════════════════════════════════╗
║                      MailInspect v1.0                       ║
║         Comprehensive Email Server Security Scanner         ║
╚══════════════════════════════════════════════════════════════╝

[*] Starting comprehensive scan for example.com...
[*] Checking DNS records...
[*] Analyzing SPF configuration...
[*] Analyzing DMARC configuration...
[*] Searching for DKIM selectors...
[*] Testing 2 mail server(s)...
[*] Checking blacklist status...
[*] Checking additional security features...
[✓] Scan complete!

================================================================================
MAIL SERVER SECURITY REPORT
Domain: yourdomain.com
Scan Date: 2024-12-09 15:30:45
================================================================================

Overall Security Score: 75/100

EXECUTIVE SUMMARY
----------------------------------------
  • SPF record is properly configured
  • DMARC policy provides moderate protection (quarantine)
  • DKIM signing is configured
  • IP addresses are clean

DNS RECORDS
----------------------------------------
MX Records:
Priority  Host
--------  ----
10        mail.yourdomain.com
20        mail2.yourdomain.com

SPF CONFIGURATION
----------------------------------------
Record: v=spf1 include:_spf.mailprovider.com ~all
Warnings:
  ⚠ ~all (softfail) is less secure than -all (hardfail)
Recommendations:
  → Add '-all' at the end to reject unauthorized senders

...

Security Checks Performed

  1. DNS Records

    • MX record validation
    • SPF record lookup and parsing
    • DMARC record analysis
    • DKIM selector discovery
    • BIMI, MTA-STS, TLSRPT checks
  2. SPF Validation

    • Syntax validation
    • Mechanism analysis
    • DNS lookup count check
    • Security policy evaluation
  3. DMARC Analysis

    • Policy enforcement level
    • Alignment settings
    • Reporting configuration
    • Subdomain policies
  4. Mail Server Tests

    • SMTP connectivity
    • STARTTLS support
    • TLS version and cipher suites
    • Certificate validation
    • Open relay testing
    • Authentication methods
  5. Blacklist Checks

    • 40+ major blacklists
    • Reputation scoring
    • Whitelist detection

Requirements

  • Python 3.7+
  • Internet connectivity
  • DNS resolution capability

Security Considerations

This tool performs read-only operations and does not:

  • Send any emails
  • Modify any DNS records
  • Store any sensitive data
  • Perform authentication attempts

All tests are non-intrusive and similar to standard email server interactions.

Troubleshooting

DNS Resolution Issues

If you encounter DNS resolution errors, ensure your system's DNS resolver is properly configured.

Timeout Errors

Some mail servers may be slow to respond. Use the -v flag for verbose output to see which tests are taking time.

Permission Errors

No special permissions are required. The tool uses standard DNS queries and SMTP connections on default ports.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.

License

MIT License - See LICENSE file for details

Disclaimer

This tool is for educational and security assessment purposes only. Always obtain proper authorization before scanning domains you do not own.

Acknowledgments

  • Inspired by MXToolbox and similar online tools
  • Built with Python and various security libraries
  • Community contributions and feedback

About

Comprehensive Email Server Security Scanner - Check SPF, DMARC, DKIM, TLS, blacklists and more

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages