From d95f2c04738f02b56bdb2b83d6c2126e9456c4d8 Mon Sep 17 00:00:00 2001 From: Arseni Zemskow Date: Mon, 13 Nov 2017 08:12:32 +0300 Subject: [PATCH] Add NOT logical statement to tha match method of the ETHContract class --- mythril/ether/ethcontract.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mythril/ether/ethcontract.py b/mythril/ether/ethcontract.py index 02e4ab64..7ee95d6b 100644 --- a/mythril/ether/ethcontract.py +++ b/mythril/ether/ethcontract.py @@ -66,29 +66,29 @@ class ETHContract(persistent.Persistent): expression = expression.replace(m, sign_hash) - tokens = re.split("( and | or )", expression, re.IGNORECASE) + tokens = filter(None, re.split("(and|or|not)", expression.replace(" ", ""), re.IGNORECASE)) for token in tokens: if token == " and " or token == " or ": - str_eval += token + str_eval += token + " " continue m = re.match(r'^code#([a-zA-Z0-9\s,\[\]]+)#', token) if (m): code = m.group(1).replace(",", "\\n") - str_eval += "\"" + code + "\" in easm_code" + str_eval += "\"" + code + "\" in easm_code" + " " continue m = re.match(r'^func#([a-fA-F0-9]+)#$', token) if (m): - str_eval += "\"" + m.group(1) + "\" in easm_code" + str_eval += "\"" + m.group(1) + "\" in easm_code" + " " continue - return eval(str_eval) + return eval(str_eval.strip()) class InstanceList(persistent.Persistent):