Skip to main content

Python module to get IP addresses from an SPF record

Project description

This is a Python module which iterates through a domain’s SPF record data, and lists all of the IP addresses found within the SPF record itself, all “included” SPF records, and IP addresses resolved from the “A/AAAA” records found in the SPF records and any “MX” records.

This module supports returning both IPv4 and IPv6 addresses.

The output of this module can be used to configure a firewall dynamically when SMTP traffic should only be received from trusted sources such as in the event that you want to get email from your cloud provider to your on-premises mail servers without exposing the SMTP ports to the world.


Install from pip:

pip install SPF2IP


Command line:

SPF2IP [-h] --domain DOMAIN [--ip-version {4,6}]


from SPF2IP import SPF2IP
lookup = SPF2IP('')

lookup.IPArray('4')   # Specify the IP version which you would like listed

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
SPF2IP-1.0.5.tar.gz (3.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page