Skip to main content

ipextract

High-performance IP address extraction for Python, powered by standard-compliant Rust DFAs.

ipextract is a Python binding for the ip-extract Rust crate. It provides O(n) scanning of unstructured text to find IPv4 and IPv6 addresses without the overhead and backtracking of regex engines.

Installation

pip install ipextract

Quick Start

import ipextract

# Extract all IPs from a string
ips = ipextract.extract("Connection from 192.168.1.1 and 8.8.8.8")
# ["192.168.1.1", "8.8.8.8"]

# Deduplicate, preserving first-seen order
ips = ipextract.extract_unique("8.8.8.8 1.1.1.1 8.8.8.8")
# ["8.8.8.8", "1.1.1.1"]

# bytes input works too (faster for large log files)
ips = ipextract.extract(b"host 10.0.0.1 connected")
# ["10.0.0.1"]

Performance

ipextract is significantly faster than native Python regex for scanning logs and large files because it uses a compiled DFA (Deterministic Finite Automaton).

Compared against Python re + ipaddress.ip_address() validation (a fair apples-to-apples comparison where both sides extract and validate):

Scenario re + ipaddress (ms) ipextract (ms) Speedup
Sparse Logs (1000 IPs in noise) 17.1ms 4.2ms 4x
Pure Text (100KB with zero IPs) 20.0ms 2.7ms 7x
Dense IPs (1000 back-to-back) 1.3ms 1.8ms 0.7x

Features

  • Blazing Fast: Up to 7x faster than regex for negative scanning (text with no IPs).
  • Configurable: Filter for public-only, ignore loopback, or skip IPv6 entirely.
  • Zero Dependencies: Ships as a self-contained wheel.
  • Strict: Eliminates false positives like 1.2.3.4.5 or 123.456.78.9.
  • Defang Support: Automatically handles and normalizes defanged IPs like 192[.]168[.]1[.]1.

Advanced Usage

For processing many lines, create a reusable Extractor:

# Configure once
extractor = ipextract.Extractor(private=False, ipv6=False)

# Reuse many times to avoid initialization overhead
for line in log_lines:
    ips = extractor.extract(line)

Configuration Options

Method Description
.only_public() Exclude private, loopback, and broadcast
.ignore_private() Exclude RFC 1918 (IPv4) and ULA/link-local (IPv6)
.ignore_loopback() Exclude 127.0.0.0/8 and ::1
.ignore_broadcast() Exclude 255.255.255.255 and link-local ranges
.ipv4(False) Skip IPv4 entirely
.ipv6(False) Skip IPv6 entirely

License

MIT OR Unlicense

Metadata

Release files for ipextract 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipextract 0.2.0
File Size Uploaded Provenance Actions
ipextract-0.2.0.tar.gz 47.7 kB With provenance Details for ipextract-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ipextract 0.2.0
File Actions
ipextract-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for ipextract-0.2.0-cp310-abi3-win_amd64.whl
ipextract-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for ipextract-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
ipextract-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for ipextract-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
ipextract-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for ipextract-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
ipextract-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for ipextract-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Total release size: 1.2 MB

Release files / ipextract-0.2.0.tar.gz

Download URL ipextract-0.2.0.tar.gz
Size 47.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f159d4d2972204db9bae8efe55d2fb8d1d7893b5ea7e44dd3ce8af4d1675a38b
BLAKE2b-256 checksum
How to use checksums
aafd95f01ffdb92ef9101ebf6a3e5ed2508d1fcfa6c96faf2503a11a29eb7662
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / ipextract-0.2.0-cp310-abi3-win_amd64.whl

Download URL ipextract-0.2.0-cp310-abi3-win_amd64.whl
Size 150.9 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
059f52867818dae0822d30e2ca0f3e0613c00988591a47e02b3f886c8912eef7
BLAKE2b-256 checksum
How to use checksums
73ab77b411c1c976390062b01ff98c0fbf4abfd5d92e5d0d3185b1af51c177c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / ipextract-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL ipextract-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 243.1 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9946f70f33feb27c4f7ceb7625aac309b07db3c92c057c89e96017466d1f35d8
BLAKE2b-256 checksum
How to use checksums
32c2aa62938ec381ce2bdb61f29321a9441f9f7e4828a7f040d7aa640909d188
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / ipextract-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL ipextract-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 227.4 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f9b62ce91ec54cb5109ce28c20e20193065bd5c4cc7c4238d8c68399a217ab2f
BLAKE2b-256 checksum
How to use checksums
6ccd7db9977a7d442bf369ea7339bfba7b8330f0c97abeef175bff2569dd0cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / ipextract-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ipextract-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 236.9 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b9f85238d86a8616366d1130d47354e1e92c21c59eb1db7fab8fbde308f3cf22
BLAKE2b-256 checksum
How to use checksums
d16b60ac61674e1c218c64f6339af0fecdb40c6d9da90ff04e4209ce2d9c29e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Release files / ipextract-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ipextract-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 250.8 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1ab7497a4e03cb8ec1f231a1c0d6158e5ce5156fa6460c6b71055af57d03948d
BLAKE2b-256 checksum
How to use checksums
773b11ead14d6e8be872382054677e72bf0a424c7cc106adf0af8b12565fd0b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

Security for ipextract 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for ipextract-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page