BUG: Fixed contains_any_of check

This commit is contained in:
frikky
2021-01-01 17:36:35 +01:00
parent 121629fdfa
commit 5c9cd54577
+8 -7
View File
@@ -952,20 +952,20 @@ class AppBase:
except KeyError as error: except KeyError as error:
print(f"KeyError in JSON: {error}") print(f"KeyError in JSON: {error}")
print(f"After first trycatch. Baseresult: ", baseresult) print(f"[INFO] After first trycatch. Baseresult: ", baseresult)
# 2. Find the JSON data # 2. Find the JSON data
if len(baseresult) == 0: if len(baseresult) == 0:
return ""+appendresult, False return ""+appendresult, False
print("After second return") print("[INFO] After second return")
if len(parsersplit) == 1: if len(parsersplit) == 1:
return str(baseresult)+str(appendresult), False return str(baseresult)+str(appendresult), False
baseresult = baseresult.replace(" True,", " true,") baseresult = baseresult.replace(" True,", " true,")
baseresult = baseresult.replace(" False", " false,") baseresult = baseresult.replace(" False", " false,")
print("After third parser return - Formatted: ", baseresult) print("[INFP] After third parser return - Formatted: ", baseresult)
basejson = {} basejson = {}
try: try:
basejson = json.loads(baseresult) basejson = json.loads(baseresult)
@@ -977,7 +977,7 @@ class AppBase:
print("Parser issue with JSON: %s" % e) print("Parser issue with JSON: %s" % e)
return str(baseresult)+str(appendresult), False return str(baseresult)+str(appendresult), False
print("After fourth parser return as JSON") print("[INFO] After fourth parser return as JSON")
data, is_loop = recurse_json(basejson, parsersplit[1:]) data, is_loop = recurse_json(basejson, parsersplit[1:])
parseditem = data parseditem = data
@@ -1138,11 +1138,11 @@ class AppBase:
elif ", " in destinationvalue: elif ", " in destinationvalue:
newvalue = destinationvalue.split(", ") newvalue = destinationvalue.split(", ")
for item in new_value: for item in newvalue:
if not item: if not item:
continue continue
if item.trim() in sourcevalue: if item.strip() in sourcevalue:
print("[INFO] Found %s in %s" % (item, sourcevalue)) print("[INFO] Found %s in %s" % (item, sourcevalue))
return True return True
@@ -1231,13 +1231,14 @@ class AppBase:
"startswith", "startswith",
"endswith", "endswith",
"contains", "contains",
"contains_any_of",
"re", "re",
"matches regex", "matches regex",
] ]
# FIXME - what should I do here? # FIXME - what should I do here?
if not condition["condition"]["value"] in available_checks: if not condition["condition"]["value"] in available_checks:
self.logger.info("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"])) self.logger.warning("Skipping %s %s %s because %s is invalid." % (sourcevalue, condition["condition"]["value"], destinationvalue, condition["condition"]["value"]))
continue continue
#print(destinationvalue) #print(destinationvalue)