Metadata-Version: 2.5
Name: lupaxa-mx-inspector
Version: 0.2.2
Summary: Look up a domain's MX hosts, SPF, and DMARC policy from public DNS, with an optional SMTP banner probe.
Project-URL: Homepage, https://mx-inspector.thelupaxaproject.org/
Project-URL: Documentation, https://mx-inspector.thelupaxaproject.org/
Project-URL: Repository, https://github.com/lupaxa-security-toolbox/mx-inspector
Project-URL: Issues, https://github.com/lupaxa-security-toolbox/mx-inspector/issues
Author: The Lupaxa Project
License: MIT License
        
        Copyright (c) The Lupaxa Project
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENCE
Keywords: cli,dmarc,dns,email-security,mx,smtp,spf
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Security
Classifier: Topic :: System :: Networking
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Requires-Dist: colored>=2.2
Requires-Dist: dnspython>=2.6
Requires-Dist: prettytable>=3.10
Provides-Extra: dev
Requires-Dist: bump-my-version>=1.2.0; extra == 'dev'
Requires-Dist: hatch>=1.12.0; extra == 'dev'
Requires-Dist: mkdocs-material==9.7.7; extra == 'dev'
Requires-Dist: mkdocs==1.6.1; extra == 'dev'
Requires-Dist: mypy>=1.12.0; extra == 'dev'
Requires-Dist: pip-audit>=2.7.0; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://github.com/lupaxa-security-toolbox">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/organisations/security-toolbox/readme-logo.png" alt="Security Toolbox" />
  </a>
</p>

<h1 align="center">MX Inspector</h1>

Look up a domain's MX hosts, SPF, and DMARC policy from public DNS,
with an optional SMTP banner probe.

> **Warning:** **Authorised use only.** `--probe` opens an SMTP session to the target
> MX hosts. Use it only on systems you are allowed to test.

## Install

```bash
pip install lupaxa-mx-inspector
mx-inspector --help
```

## CLI

```bash
mx-inspector example.com
mx-inspector example.com example.org
mx-inspector example.com --format json
mx-inspector example.com --no-color
mx-inspector example.com --probe
mx-inspector example.com --probe --port 587
mx-inspector example.com --probe --timeout 10
python -m lupaxa.mx_inspector --version
```

The tool queries MX hosts, SPF, and `_dmarc.<domain>`, then prints a
table of decoded tags and a spoofing-posture score. On a colour
terminal, names are cyan, values are green, `missing` is grey, and the
score is coloured by grade. `--no-color` or `NO_COLOR` disables that.
`--probe` greets each MX (banner + EHLO only) to fingerprint mail
software. `--port` sets the SMTP probe port (default 25; use `587` for
submission). `--timeout` sets the SMTP probe timeout (default 5
seconds). `--format json` writes `{domain, policy, mx, spf, score,
error, mx_error, spf_error}` objects, plus `probe` when `--probe` is
set.

## Library

```python
from lupaxa.mx_inspector import lookup_dmarc, lookup_mx, lookup_spf, score_posture

policy = lookup_dmarc("example.com")
hosts = lookup_mx("example.com")
spf = lookup_spf("example.com")
score = score_posture(policy, mx_hosts=hosts, spf_records=spf)
print(policy["p"], score.value, score.grade)
```

## Development

```bash
make init
make python-install-dev
make python-check
```

## Documentation

The published guide is at
<https://mx-inspector.thelupaxaproject.org/>.

Site Markdown lives in `mkdocs/`.

```bash
python -m pip install -r requirements.txt
make mkdocs-serve
```

<a href="https://github.com/the-lupaxa-project">
    <img src="https://raw.githubusercontent.com/the-lupaxa-project/brand-assets/master/logos/components/footer-for-child-orgs.svg" alt="The Lupaxa Project Footer" width="100%" />
</a>
