From 16ddba61d6d69c2b948e516a9024e66f9bbc61e2 Mon Sep 17 00:00:00 2001 From: Giuseppe Longo Date: Mon, 20 Nov 2017 15:22:54 +0100 Subject: [PATCH] suricatasc: add commands for memcap handling --- scripts/suricatasc/src/suricatasc.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/suricatasc/src/suricatasc.py b/scripts/suricatasc/src/suricatasc.py index 71a942dd33..0ca6701e02 100644 --- a/scripts/suricatasc/src/suricatasc.py +++ b/scripts/suricatasc/src/suricatasc.py @@ -80,7 +80,7 @@ class SuricataCompleter: class SuricataSC: def __init__(self, sck_path, verbose=False): - self.cmd_list=['shutdown','quit','pcap-file','pcap-file-continuous','pcap-file-number','pcap-file-list','pcap-last-processed','pcap-interrupt','iface-list','iface-stat','register-tenant','unregister-tenant','register-tenant-handler','unregister-tenant-handler', 'add-hostbit', 'remove-hostbit', 'list-hostbit'] + self.cmd_list=['shutdown','quit','pcap-file','pcap-file-continuous','pcap-file-number','pcap-file-list','pcap-last-processed','pcap-interrupt','iface-list','iface-stat','register-tenant','unregister-tenant','register-tenant-handler','unregister-tenant-handler', 'add-hostbit', 'remove-hostbit', 'list-hostbit', 'memcap-set', 'memcap-show'] self.sck_path = sck_path self.verbose = verbose @@ -329,6 +329,27 @@ class SuricataSC: else: arguments = {} arguments["ipaddress"] = ipaddress + elif "memcap-set" in command: + try: + [cmd, config, memcap] = command.split(' ', 2) + except: + raise SuricataCommandException("Arguments to command '%s' is missing" % (command)) + if cmd != "memcap-set": + raise SuricataCommandException("Invalid command '%s'" % (command)) + else: + arguments = {} + arguments["config"] = config + arguments["memcap"] = memcap + elif "memcap-show" in command: + try: + [cmd, config] = command.split(' ') + except: + raise SuricataCommandException("Arguments to command '%s' is missing" % (command)) + if cmd != "memcap-show": + raise SuricataCommandException("Invalid command '%s'" % (command)) + else: + arguments = {} + arguments["config"] = config else: cmd = command else: -- 2.47.3