From e280f50e0f5368e78f4a471f20dd78923466048a Mon Sep 17 00:00:00 2001 From: Swissky Date: Sun, 12 Nov 2017 13:42:25 +0100 Subject: [PATCH] Bugfix - Opening inexistent file --- functions.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/functions.py b/functions.py index 37e7f77..236aa77 100644 --- a/functions.py +++ b/functions.py @@ -103,9 +103,13 @@ def check_declaration(content, vuln, path): # Path is the path of the current scanned file, we can use it to compute the relative include for include in includes: relative_include = os.path.dirname(path)+"/" - path_include = relative_include + include[1] - with open(path_include, 'r') as f: - content = f.read() + content + try: + path_include = relative_include + include[1] + with open(path_include, 'r') as f: + content = f.read() + content + except Exception as e: + return (False, "","") + # Extract declaration - for ($something as $somethingelse) regex_declaration2 = re.compile("\$(.*?)([\t ]*)as(?!=)([\t ]*)\$"+vuln[1:])