From: Eric Leblond Date: Tue, 4 Dec 2012 16:50:22 +0000 (+0100) Subject: suricatasc: treat old server case X-Git-Tag: suricata-1.4.1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc996e4df86304eaac944700e8024ec359a6f47;p=thirdparty%2Fsuricata.git suricatasc: treat old server case If the server don't have the 'command-list' function, suricatasc was failling. This patch fixes this issue by adding a static list instead. --- diff --git a/scripts/suricatasc/suricatasc.in b/scripts/suricatasc/suricatasc.in index e784186917..25083e94d6 100755 --- a/scripts/suricatasc/suricatasc.in +++ b/scripts/suricatasc/suricatasc.in @@ -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: