]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
suricatasc: treat old server case
authorEric Leblond <eric@regit.org>
Tue, 4 Dec 2012 16:50:22 +0000 (17:50 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 26 Feb 2013 11:32:48 +0000 (12:32 +0100)
If the server don't have the 'command-list' function, suricatasc
was failling. This patch fixes this issue by adding a static list
instead.

scripts/suricatasc/suricatasc.in

index e784186917bfef08377a844e902b01150cb70223..25083e94d613440a96fc7f78cd3ee96afd38d43d 100755 (executable)
@@ -105,15 +105,14 @@ if cmdret == None:
 if args.verbose:
     print "RCV: "+ json.dumps(cmdret)
 
-# if ok loop
-if cmdret["return"] == "NOK":
-    sys.stderr.write("Error: %s" % (cmdret["message"]))
-    sys.exit(1)
-
-cmd_list = cmdret["message"]["commands"]
-cmd_list.append("quit")
 
-print "Command list: " + ", ".join(cmd_list)
+if cmdret["return"] == "OK":
+    cmd_list = cmdret["message"]["commands"]
+    cmd_list.append("quit")
+    print "Command list: " + ", ".join(cmd_list)
+else:
+    # This is the list of commands before command-list was added to the code.
+    cmd_list=['shutdown','quit','pcap-file','pcap-file-number','pcap-file-list','iface-list','iface-stat']
 
 # if ok loop
 try: