IPParser
The IPParser Python library was created to simplify accepting IP addresses, DNS names, and target / host information in security or network based tooling.
User inputs are parsed to provide an iterable list for further action. If called with resolve=True, ipparser will attempt to perform an "A" record lookup and return the first resolved address associated with the host.
Inputs:
IPParser currently accepts the following user inputs:
- Single IP (192.168.1.10)
- IP ranges (192.168.1.1-55)
- Multiple IP's (192.168.1.3,192.168.1.7,m8sec.dev)
- CIDR Ranges /8-/32 (192.168.1.0/24)
- URL's (https://m8sec.dev)
- IP:Port (192.168.1.1:8080)
- DNS Names (m8sec.dev)
- TXT files (Containing any of the items listed)
- Nmap XML Reports
- Read from STDIN
Install
pip3 install ipparser
OR
git clone https://github.com/m8sec/ipparser
cd ipparser
python3 setup.py install
(Primary) Usage:
The IPParser function can be called with the following arguments (shown with their default values):
open_ports=False- Return IP:Port notation for all open ports found (Nmap XML only)exit_on_error=True- Exit on error while parsing user input.resolve=False- Resolve any DNS names identified, to IPv4 addresses, and append to output.ns=[]- Define name servers for DNS lookups.
Examples
Standard Usage
>>> from ipparser import ipparser
>>> ipparser('192.168.1.3-5')
['192.168.1.3', '192.168.1.4', '192.168.1.5']
>>> ipparser('yahoo.com',resolve=True)
['74.6.143.26']
>>> ipparser('192.168.1.1,yahoo.com')
['192.168.1.1', 'yahoo.com']
Argparse Integration - Required Positional Argument:
from ipparser import ipparser
from argparse import ArgumentParser
args = ArgumentParser(description='ipparser integration with argparse')
args.add_argument(dest='positional_host', nargs='+', type=lambda x: ipparser(x, resolve=False), help='Host Input')
args = args.parse_args()
Namespace(positional_host=[['192.168.1.1']])
Metadata
Release files for ipparser 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ipparser-1.0.2.tar.gz | 5.4 kB | Without provenance | Details for ipparser-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipparser-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for ipparser-1.0.2-py3-none-any.whl |
Total release size: 12.0 kB
Release files / ipparser-1.0.2.tar.gz
| Download URL | ipparser-1.0.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff95fc506479848f93045a964dc200daace9c180b5fca827e4e8be474453675c
|
|
BLAKE2b-256 checksum How to use checksums |
0f202a533471c467f78183e0a9a31dba8311ecdd41bf6d251bd5d79be4e93a4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / ipparser-1.0.2-py3-none-any.whl
| Download URL | ipparser-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e0a3bc05f23bfcafdc3fda69efa8fc0c4cf236c2e6283c908cc6407268aac14
|
|
BLAKE2b-256 checksum How to use checksums |
e4b843bc792f2511ebb424fcd64452d5f0543ade2e843eac9c63fc35ada7d0cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for ipparser 1.0.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.