Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dusekdan
Last active November 26, 2019 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dusekdan/ebee9d0368ac5ce7663f2ee2479fa65b to your computer and use it in GitHub Desktop.
Save dusekdan/ebee9d0368ac5ce7663f2ee2479fa65b to your computer and use it in GitHub Desktop.
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