Skip to content

Instantly share code, notes, and snippets.

@wesinator
Last active June 1, 2021 18:47
Show Gist options
  • Save wesinator/c18b53ad32b2eb353dfc52139c55d869 to your computer and use it in GitHub Desktop.
Save wesinator/c18b53ad32b2eb353dfc52139c55d869 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
from IPy import IP
def getIPtype(ip):
try:
return IP(ip).iptype()
except ValueError:
return None
def ipPublic(ip):
if getIPtype(ip) == "PUBLIC":
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment