# RadixTarget
[](https://www.python.org) [](https://github.com/blacklanternsecurity/radixtarget/blob/master/LICENSE) [](https://github.com/psf/black) [](https://github.com/blacklanternsecurity/radixtarget/actions/workflows/tests.yml) [](https://codecov.io/gh/blacklanternsecurity/radixtarget)
RadixTarget is a performant radix implementation designed for quick lookups of IP addresses/networks and DNS hostnames.
RadixTarget is:
- Written in pure python
- Capable of ~100,000 lookups per second regardless of database size
- 100% test coverage
- Used by:
- [BBOT](https://github.com/blacklanternsecurity/bbot)
- [cloudcheck](https://github.com/blacklanternsecurity/cloudcheck)
### Installation ([PyPi](https://pypi.org/project/radixtarget/))
```bash
pip install radixtarget
```
### Example Usage
```python
from radixtarget import RadixTarget
rt = RadixTarget()
# IPv4
rt.add("192.168.1.0/24")
rt.get("192.168.1.10") # IPv4Network("192.168.1.0/24")
rt.get("192.168.2.10") # None
# IPv6
rt.add("dead::/64")
rt.get("dead::beef") # IPv6Network("dead::/64")
rt.get("dead:cafe::beef") # None
# DNS
rt.add("net")
rt.add("www.example.com")
rt.add("test.www.example.com")
rt.get("net") # "net"
rt.get("evilcorp.net") # "net"
rt.get("www.example.com") # "www.example.com"
rt.get("asdf.test.www.example.com") # "test.www.example.com"
rt.get("example.com") # None
# Custom data nodes
rt.add("evilcorp.co.uk", "custom_data")
rt.get("www.evilcorp.co.uk") # "custom_data"
```
Raw data
{
"_id": null,
"home_page": "https://github.com/blacklanternsecurity/radixtarget",
"name": "radixtarget",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "TheTechromancer",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/26/89/1c19b98c48f703fe654f3e7d8986556573fe412945f13842240b7cf87e9a/radixtarget-3.0.15.tar.gz",
"platform": null,
"description": "# RadixTarget\n\n[](https://www.python.org) [](https://github.com/blacklanternsecurity/radixtarget/blob/master/LICENSE) [](https://github.com/psf/black) [](https://github.com/blacklanternsecurity/radixtarget/actions/workflows/tests.yml) [](https://codecov.io/gh/blacklanternsecurity/radixtarget)\n\nRadixTarget is a performant radix implementation designed for quick lookups of IP addresses/networks and DNS hostnames. \n\nRadixTarget is:\n- Written in pure python\n- Capable of ~100,000 lookups per second regardless of database size\n- 100% test coverage\n- Used by:\n - [BBOT](https://github.com/blacklanternsecurity/bbot)\n - [cloudcheck](https://github.com/blacklanternsecurity/cloudcheck)\n\n### Installation ([PyPi](https://pypi.org/project/radixtarget/))\n\n```bash\npip install radixtarget\n```\n\n### Example Usage\n\n```python\nfrom radixtarget import RadixTarget\n\nrt = RadixTarget()\n\n# IPv4\nrt.add(\"192.168.1.0/24\")\nrt.get(\"192.168.1.10\") # IPv4Network(\"192.168.1.0/24\")\nrt.get(\"192.168.2.10\") # None\n\n# IPv6\nrt.add(\"dead::/64\")\nrt.get(\"dead::beef\") # IPv6Network(\"dead::/64\")\nrt.get(\"dead:cafe::beef\") # None\n\n# DNS\nrt.add(\"net\")\nrt.add(\"www.example.com\")\nrt.add(\"test.www.example.com\")\nrt.get(\"net\") # \"net\"\nrt.get(\"evilcorp.net\") # \"net\"\nrt.get(\"www.example.com\") # \"www.example.com\"\nrt.get(\"asdf.test.www.example.com\") # \"test.www.example.com\"\nrt.get(\"example.com\") # None\n\n# Custom data nodes\nrt.add(\"evilcorp.co.uk\", \"custom_data\")\nrt.get(\"www.evilcorp.co.uk\") # \"custom_data\"\n```\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "Check whether an IP address belongs to a cloud provider",
"version": "3.0.15",
"project_urls": {
"Homepage": "https://github.com/blacklanternsecurity/radixtarget",
"PyPi": "https://pypi.org/project/radixtarget/",
"Repository": "https://github.com/blacklanternsecurity/radixtarget"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3ab4b461d1c1d200a76216fd4c277492c706ec2a8552fd015158ae063dcc6940",
"md5": "9fae13d73b53a15d9310ab808858115f",
"sha256": "1e1d0dd3e8742ffcfc42084eb238f31f6785626b876ab63a9f28a29e97bd3bb0"
},
"downloads": -1,
"filename": "radixtarget-3.0.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9fae13d73b53a15d9310ab808858115f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 108810,
"upload_time": "2024-12-16T16:35:41",
"upload_time_iso_8601": "2024-12-16T16:35:41.208224Z",
"url": "https://files.pythonhosted.org/packages/3a/b4/b461d1c1d200a76216fd4c277492c706ec2a8552fd015158ae063dcc6940/radixtarget-3.0.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "26891c19b98c48f703fe654f3e7d8986556573fe412945f13842240b7cf87e9a",
"md5": "5171ac0b282ef76298df3cce64b37eab",
"sha256": "dedfad3aea1e973f261b7bc0d8936423f59ae4d082648fd496c6cdfdfa069fea"
},
"downloads": -1,
"filename": "radixtarget-3.0.15.tar.gz",
"has_sig": false,
"md5_digest": "5171ac0b282ef76298df3cce64b37eab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 108237,
"upload_time": "2024-12-16T16:35:44",
"upload_time_iso_8601": "2024-12-16T16:35:44.268215Z",
"url": "https://files.pythonhosted.org/packages/26/89/1c19b98c48f703fe654f3e7d8986556573fe412945f13842240b7cf87e9a/radixtarget-3.0.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-16 16:35:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "blacklanternsecurity",
"github_project": "radixtarget",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "radixtarget"
}