All Projects → bd808 → python-iptools

bd808 / python-iptools

Licence: BSD-2-Clause license
A few useful functions and objects for manipulating ip addresses in python.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-iptools

ip
Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
Stars: ✭ 212 (+211.76%)
Mutual labels:  ipv6, ipv4, cidr
Aggregator
A stand-alone class implementation of the IPv4+IPv6 IP+CIDR aggregator from CIDRAM.
Stars: ✭ 19 (-72.06%)
Mutual labels:  ipv6, ipv4, cidr
cidr
golang to calculate CIDR network
Stars: ✭ 51 (-25%)
Mutual labels:  ipv6, ipv4, cidr
private-ip
Check if IP address is private.
Stars: ✭ 26 (-61.76%)
Mutual labels:  ipv6, ipv4
ENet-CSharp
A improved fork of ENet, a tried and true networking library. C, C++, C# compatible.
Stars: ✭ 65 (-4.41%)
Mutual labels:  ipv6, ipv4
vertx-ddns
基于 Vert.x 的 DDNS 解决方案。自动更新域名解析到本机IP, 支持的DNS服务商: Alidns(阿里云) 、 Dnspod(腾讯云) 、Cloudflare、华为云
Stars: ✭ 126 (+85.29%)
Mutual labels:  ipv6, ipv4
IPpy
🚀 Ping IP addresses and domains in parallel to find the accessible and inaccessible ones.
Stars: ✭ 54 (-20.59%)
Mutual labels:  ipv6, ipv4
ip-finder-cli
The official command line client for IPFinder
Stars: ✭ 11 (-83.82%)
Mutual labels:  ipv6, ipv4
netcalc
Advanced network calculator and address planning helper
Stars: ✭ 20 (-70.59%)
Mutual labels:  ipv6, ipv4
ipv6
IPv6-adresse.dk source & data
Stars: ✭ 27 (-60.29%)
Mutual labels:  ipv6, ipv4
SixIndicator
SixIndicator is a WebExtension Plugin which indicates via an icon, if you are viewing the website with IPv6 or IPv4.
Stars: ✭ 17 (-75%)
Mutual labels:  ipv6, ipv4
zx-ip-address
Deprecated
Stars: ✭ 96 (+41.18%)
Mutual labels:  ipv6, ipv4
accomplist
ACCOMPLIST - List Compiler
Stars: ✭ 51 (-25%)
Mutual labels:  ipv6, ipv4
captcp
A open source program for TCP analysis of PCAP files
Stars: ✭ 110 (+61.76%)
Mutual labels:  ipv6, ipv4
fakeroute
IPv4 and IPv6 traceroute fake hop generator through IP spoofing
Stars: ✭ 75 (+10.29%)
Mutual labels:  ipv6, ipv4
go-external-ip
a Golang library to get your external ip from multiple services
Stars: ✭ 55 (-19.12%)
Mutual labels:  ipv6, ipv4
sync hosts
解除Resilio Sync/BTSync限制china地区 镜像:https://coding.net/u/renerli/p/sync_hosts/git
Stars: ✭ 15 (-77.94%)
Mutual labels:  ipv6, ipv4
TFTPServer
Managed TFTP server implementation, written in C#. Features: IPv4 and IPv6, blocksize, single port mode, windowed mode, unlimited transfers, MIT licensed
Stars: ✭ 28 (-58.82%)
Mutual labels:  ipv6, ipv4
php-ip-anonymizer
IP address anonymizer library for PHP
Stars: ✭ 55 (-19.12%)
Mutual labels:  ipv6, ipv4
Netlink
Socket and Networking Library using msgpack.org[C++11]
Stars: ✭ 197 (+189.71%)
Mutual labels:  ipv6, ipv4

python-iptools

The iptools package is a collection of utilities for dealing with IP addresses.

Build Status

A few useful functions and objects for manipulating IPv4 and IPv6 addresses in python. The project was inspired by a desire to be able to use CIDR address notation to designate INTERNAL_IPS in a Django project's settings file.

Using with Django

The IpRangeList object can be used in a Django settings file to allow CIDR notation and/or (start, end) ranges to be used in the INTERNAL_IPS list.

There are many internal and add-on components for Django that use the INTERNAL_IPS configuration setting to alter application behavior or make debugging easier. When you are developing and testing an application by yourself it's easy to add the ip address that your web browser will be coming from to this list. When you are developing in a group or testing from many ips it can become cumbersome to add more and more ip addresses to the setting individually.

The iptools.IpRangeList object can help by replacing the standard tuple of addresses recommended by the Django docs with an intelligent object that responds to the membership test operator in. This object can be configured with dotted quad IP addresses like the default INTERNAL_IPS tuple (eg. '127.0.0.1'), CIDR block notation (eg. '127/8', '192.168/16') for entire network blocks, and/or (start, end) tuples describing an arbitrary range of IP addresses.

Django's internal checks against the INTERNAL_IPS tuple take the form if addr in INTERNAL_IPS or if addr not in INTERNAL_IPS. This works transparently with the IpRangeList object because it implements the magic method __contains__ which python calls when the in or not in operators are used.

Example:

#!/usr/bin/env python
import iptools

INTERNAL_IPS = iptools.IpRangeList(
    '127.0.0.1',                # single ip
    '192.168/16',               # CIDR network block
    ('10.0.0.1', '10.0.0.19'),  # arbitrary inclusive range
    '::1',                      # single IPv6 address
    'fe80::/10',                # IPv6 CIDR block
    '::ffff:172.16.0.2'         # IPv4-mapped IPv6 address
)

Documentation

Full pydoc documentation is available at Read the Docs.

Local documentation can be built using Sphinx:

cd docs
make html

Python Version Compatibility

Travis CI automatically runs tests against Python 2.7, 3.5, 3.6, 3.7, 3.8, pypy, and pypy3.

Installation

Install the latest stable version using pip:

pip install iptools

or easy_install:

easy_install iptools

Install the latest development version:

git clone https://github.com/bd808/python-iptools.git
cd python-iptools
python setup.py install

Contributions

Bug reports, feature requests and pull requests are accepted. Preference is given to issues with well-defined acceptance criteria and/or unit tests.

This project was originally hosted on Google Code.


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].