ExRay is a Python-based tool for discovering and enumerating Microsoft Exchange endpoints (on-premise, hybrid, or partially migrated). It uses subdomain brute forcing, parallel DNS resolution, parallel HTTP requests, port preflight checks, NTLM handshake attempts, and wildcard detection to provide thorough coverage of Exchange services.
It was created out of the need that I noticed that for me many old legacy exchange testing tools missed too much stuff... especially in scenarios where an exchange environment was partially decomissioned or "hardened". So I wanted something that can properly map and identify remnants of the exchange stuff that I have been checking and abusing for decades. Quite crazy that something like this added value for me in the year 2025...
It got some quality of life features but is far from super user friendly... it mostly gives me what I need for pentesting/red teaming activities... any way: feel free to raise issues or pull requests
-
Automated Subdomain Discovery
- Generates typical Exchange-related hostnames (
owa,mail,autodiscover, etc.) with numeric/environment suffixes. - Resolves DNS in parallel (default
--dns-threads 100) for fast scanning of large domains. - Automatically skips subdomains that redirect to Office 365 (e.g.,
*.outlook.com,*.office365.com).
- Generates typical Exchange-related hostnames (
-
Port Preflight (Optional)
- Quickly checks if HTTP/HTTPS ports are open before doing in-depth enumeration.
- Can be disabled via
--no-preflight, in which case the script tries all hosts/ports directly.
-
Parallel HTTP Requests
- Use
--http-threads(default 5) to control how many HTTP requests run in parallel per target. This speeds up the path enumeration on each host.
- Use
-
Exchange Path Enumeration
- Scans a wide range of known Exchange endpoints (OWA, ECP, EWS, MAPI, Autodiscover, etc.).
- Captures interesting headers like
Server,X-OWA-Version,X-FEServer, etc. - Decodes OWA build numbers to map probable Exchange version (e.g., Exchange 2013/2016/2019 or older).
-
NTLM Authentication Check
- If
WWW-Authenticate: NTLMis present, ExRay sends a dummy Type 1 NTLM message to retrieve the Type 2 challenge. - Attempts to parse out the NTLM domain name from that challenge.
- Can be skipped using
--no-authif you don’t want to attempt NTLM handshakes.
- If
-
Detection of Basic Auth over HTTP
- If the server offers
WWW-Authenticate: Basicon plain HTTP, ExRay warns in the final summary.
- If the server offers
-
Wildcard Response Detection
- If 80%+ of enumerated paths return the same status code, ExRay flags it as possible catch-all.
- Outlier paths with “interesting” status codes (
200, 301, 302, 401, 403) are still shown, even if the majority are a single code (e.g.,503).
-
Comprehensive Output
- Console Summaries:
- Subdomain resolution results
- O365 detection/skip
- Wildcard detection warnings
- “Interesting” endpoints (HTTP 200/301/302/401/403)
- File-Based Output (when using
-o output):output.txt: A plain-text line-by-line dump (<host> | <path> | <status>) for each request.output.json: A structured JSON containing:- valid_endpoints (list of discovered interesting endpoints)
- headers (unique header values + which hosts sent them)
- ntlm_domains (NTLM Type2 domain info + which hosts exposed it)
- basic_http_exposure (hosts offering Basic auth over HTTP)
- Console Summaries:
-
Clone the Repository
git clone https://github.com/0xB455/ExRay.git cd ExRay -
Install Dependencies
- Python 3 is required.
- Install needed Python libraries (e.g.,
requests):pip install -r requirements.txt
-
Run the Script
python3 ExRay.py --help
Below are some typical ways to run ExRay:
-
Subdomain Discovery
python3 ExRay.py --domain example.com
- Enumerates typical Exchange subdomains (
owa,mail01,autodiscover, etc.). - Checks DNS in parallel (
--dns-threads 100by default). - Automatically enumerates discovered hosts on HTTP/HTTPS.
- Enumerates typical Exchange subdomains (
-
Customize DNS and HTTP Threads
python3 ExRay.py --domain example.com --dns-threads 50 --http-threads 8
- Uses 50 threads for DNS resolution and 8 threads per target for HTTP path scanning.
-
Single Target
python3 ExRay.py --target mail.example.com
- Probes
http://mail.example.comandhttps://mail.example.comwith all known Exchange paths.
- Probes
-
Multiple Targets from File
python3 ExRay.py --list targets.txt
- Each line in
targets.txtcan be an IP, a hostname, or a full URL (e.g.,https://mail.example.com).
- Each line in
-
Port Preflight & Skipping
python3 ExRay.py --domain example.com --no-preflight --https-only
- Ignores port-check logic, enumerates everything as
https://....
- Ignores port-check logic, enumerates everything as
-
NTLM Handshake Skipping
python3 ExRay.py --target mail.example.com --no-auth
- Does not send a dummy NTLM request if
WWW-Authenticate: NTLMis encountered.
- Does not send a dummy NTLM request if
-
Generating Output Files
python3 ExRay.py --domain example.com -o results
- Writes line-based results to
results.txtand JSON summary toresults.json.
- Writes line-based results to
-
Subdomain Enumeration
- Shows how many subdomains resolved.
- Skips or flags O365-based hosts.
-
Port Preflight (optional)
- Reports how many hosts are open on HTTP/HTTPS.
- Ignores closed ports if
--no-preflightis not specified.
-
Path Enumeration
- Sends parallel HTTP requests against known Exchange endpoints.
- Prints status codes for each path.
- Attempts a dummy NTLM handshake to discover internal domain (unless
--no-auth).
-
Wildcard Detection
- If ≥80% share the same code, warns of possible catch-all.
- Still shows any outliers if they return an “interesting” code (200, 301, 302, 401, 403).
-
Final Summaries
- Per-Target summary of interesting endpoints.
- Consolidated summary of:
- Headers (e.g.,
X-OWA-Version,X-FEServer) - NTLM domains discovered
- Hosts offering Basic Auth over HTTP (insecure)
- Headers (e.g.,
-
File Exports
<output>.txt: Plain text lines of<host> | <path> | <code>.<output>.json: Structured JSON with full details on discovered endpoints, headers, NTLM domains, and insecure Basic.
This project is licensed under the MIT License. Feel free to modify and extend it for your own engagements.