Skip to content

Instantly share code, notes, and snippets.

@dusekdan
Last active November 26, 2019 14:21
Embed
What would you like to do?
def ips_in_net(ip='192.168.1.8', subnet='255.255.255.0'):
from ipaddress import ip_address, ip_network
hosts = list(ip_network(f"{ip}/{subnet}", strict=False).hosts())
return [f"{host}" for host in hosts]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment