diff options
Diffstat (limited to 'cli/utils.py')
-rw-r--r-- | cli/utils.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/cli/utils.py b/cli/utils.py index b267207..88c15a4 100644 --- a/cli/utils.py +++ b/cli/utils.py @@ -6,7 +6,7 @@ # (at your option) any later version. import json - +import ipaddress def scope_lookup(scope_id, scope_type, d): if scope_id == d.get('id') and scope_type == d.get('type'): @@ -32,3 +32,10 @@ def ips_in_scope(scope): def print_json(text): payload = json.loads(text) print(json.dumps(payload, sort_keys=True, indent=2)) + +def check_address(addr): + try: + ip = ipaddress.ip_address(addr) + return True + except: + return False |