#! /usr/bin/env python
#
-# Copyright(C) 2013-2022 Open Information Security Foundation
+# Copyright(C) 2013-2023 Open Information Security Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
sys.exit(1)
if args.command:
- (command, arguments) = sc.parse_command(args.command)
- res = sc.send_command(command, arguments)
+ try:
+ (command, arguments) = sc.parse_command(args.command)
+ except SuricataCommandException as err:
+ print(err.value)
+ sys.exit(1)
+ try:
+ res = sc.send_command(command, arguments)
+ except (SuricataCommandException, SuricataReturnException) as err:
+ print(err.value)
+ sys.exit(1)
print(json.dumps(res))
sc.close()
if res['return'] == 'OK':