From: Giuseppe Longo Date: Mon, 20 Nov 2017 14:22:54 +0000 (+0100) Subject: suricatasc: add commands for memcap handling X-Git-Tag: suricata-4.1.0-beta1~435 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16ddba61d6d69c2b948e516a9024e66f9bbc61e2;p=thirdparty%2Fsuricata.git suricatasc: add commands for memcap handling --- 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: