summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-12 11:30:02 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-12 11:30:02 +0200
commit7f09d148b4ec2b6bca500a7bb33f97072930bc9e (patch)
tree01666207aba1b3551cc7b7788dd27e4b8b3584a9
parent7478b9ce159af5535be0d4f67dc362d65acf363b (diff)
server: validate IP address
Add IP validation after input parsing.
-rw-r--r--cli/objects/server.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/objects/server.py b/cli/objects/server.py
index a2f299d..c3f83a8 100644
--- a/cli/objects/server.py
+++ b/cli/objects/server.py
@@ -24,6 +24,11 @@ class OgServer():
required=True,
help='valid ogserver ip address')
parsed_args = parser.parse_args(args)
+
+ if not check_address(parsed_args.address):
+ print(f'Invalid IP address: {parsed_args.address}')
+ return
+
payload = {'address': parsed_args.address}
rest.post('/server', payload=payload)