1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.
I have written my own python ip/subnet tool. It's for python2/3. Use theese methods to conver ip mask formats and to check if ip/subnet belong to other subnet. I made it partly for fun and to learn, so perhaps these are not the best, but they get the job done. Checking if ip belongs to subnet is actually about 20-30% faster, than with tools from netaddr module.
Instalation:
pip install iptoolsjj
Methods:
- is_in_subnet : check if ip belongs to subnet
- verify : check if ip or ip/netmask are valid
- get_subnet_ip : get subnet ip for some ip/mask
- mask255_to_dec : convert ip mask format
- dec_to_mask255 : convert ip mask format
Import: (I use *, not worrying about namespace because its small script ):
from iptoolsjj import *
Example:
Check if 192.168.10.10 is inside 192.168.10.0/22:
if iptoolsjj.is_in_subnet('192.168.10.10', '192.168.10.0/22'):
print ('yes')
Verify if ip or ip with mask is in good format:
print(iptoolsjj.verify('192.168.1.22'))
print(iptoolsjj.verify('192.168.1.22/25','ip/mask'))
print(iptoolsjj.verify('192.168.1.22/255.255.255.128','ip/mask255'))
Get subnet ip for given ip address:
print(iptoolsjj.get_subnet_ip('191.123.1.36/27'))
Convert mask '255.255.255.240' to '28':
print(iptoolsjj.mask255_to_dec('255.255.255.240'))
Convert mask '28' to '['255', '255', '255', '240']' (normally it's list format):
print(iptoolsjj.dec_to_mask255(28))
or
print('.'.join(iptoolsjj.dec_to_mask255(28)))
Metadata
Release files for iptoolsjj 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
File added late
1 file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iptoolsjj-1.2.2.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iptoolsjj-1.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / iptoolsjj-1.2.2.tar.gz
| Download URL | iptoolsjj-1.2.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
984df2d3e778076a4e77f74200251b1a6040a0821af8007500e81bbc36a69878
|
|
BLAKE2b-256 checksum How to use checksums |
bf38c619724e2500309c1782683d7edc6bf35e19fe23a47b6794dacc454fad7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.12.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.3
|
Release files / iptoolsjj-1.2.2-py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | iptoolsjj-1.2.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c05ab81b3165ec9baf51bfd0f3a128270aa89a5ea0e4d84de6c81112989b3c62
|
|
BLAKE2b-256 checksum How to use checksums |
4def37e55931cb3a7da490cf2b65a18c5ea4c1ae5cf32f6c78fed46d18c5c4bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.12.4 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.5.3
|