# command is provided.
pcap: false
+ # Run the script and only continue with the test if the script exists
+ # successfully.
+ script:
+ - command1
+ - command2
+ - ...
+
# Add additional arguments to Suricata.
args:
- --set stream.reassembly.depth=0
# done after each iteration.
count: 10
+pre-check: |
+ # Some script to run before running checks.
+ cp eve.json eve.json.bak
+
checks:
# A verification filter that is run over the eve.json. Multiple
self.outdir = outdir
def run(self):
- eve_json_path = "eve.json"
- if not os.path.exists(eve_json_path):
- raise TestError("%s does not exist" % (eve_json_path))
+ if "filename" in self.config:
+ json_filename = self.config["filename"]
+ else:
+ json_filename = "eve.json"
+ if not os.path.exists(json_filename):
+ raise TestError("%s does not exist" % (json_filename))
count = 0
- with open(eve_json_path, "r") as fileobj:
+ with open(json_filename, "r") as fileobj:
for line in fileobj:
event = json.loads(line)
if self.match(event):
print("OK%s" % (" (%dx)" % count if count > 1 else ""))
return True
+ def pre_check(self):
+ if "pre-check" in self.config:
+ subprocess.call(self.config["pre-check"], shell=True)
+
def check(self):
pdir = os.getcwd()
os.chdir(self.output)
try:
+ self.pre_check()
if "checks" in self.config:
for check in self.config["checks"]:
for key in check: