[MASOCH-L] agrupar em CIDRs

Leonardo Rodrigues leolistas at solutti.com.br
Mon Apr 9 20:33:24 -03 2018


     Show, vou dar uma conferida nos links Anderson, obrigado !

Em 09/04/18 16:46, Anderson C. Santos escreveu:
> Prezado Leonardo,
>
>    Talvez ajude:
>
> =========================
> #!/usr/bin/env python
>
> from netaddr import iprange_to_cidrs
>
> def get_cidr(first_ip, last_ip):
>      return [str(cidr)
>              for cidr in iprange_to_cidrs(first_ip, last_ip)]
>
> print get_cidr('192.168.0.1', '192.168.1.15');
> ==========================
>
>    Adaptado de:
>
>    https://stackoverflow.com/questions/24214441/ip-range-to-cidr-conversion-in-python
>    https://www.ip2location.com/tutorials/how-to-convert-ip-address-range-into-cidr
>    https://ip2cidr.com/bulk-ip-to-cidr-converter.php
>    http://tech.marksblogg.com/bulk-ip-address-whois-python-hadoop.html
>    https://softwareengineering.stackexchange.com/questions/246460/reduce-a-list-of-ipv4-to-lowest-common-cidr
>
>    

-- 


	Atenciosamente / Sincerily,
	Leonardo Rodrigues
	Solutti Tecnologia
	http://www.solutti.com.br

	Minha armadilha de SPAM, NÃO mandem email
	gertrudes at solutti.com.br
	My SPAMTRAP, do not email it






More information about the masoch-l mailing list