Merge pull request #1 from tanaydin/patch-1

Update functions.py
pull/8/head^2
tanaydin sirin 2019-04-05 14:26:46 +02:00 committed by GitHub
commit 07dd6eddf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -110,18 +110,19 @@ def check_declaration(content, vuln, path):
# Extract declaration - for ($something as $somethingelse)
regex_declaration2 = re.compile("\$(.*?)([\t ]*)as(?!=)([\t ]*)\$"+vuln[1:])
vulnerability = vuln[1:].replace(')', '\)').replace('(', '\(')
regex_declaration2 = re.compile("\$(.*?)([\t ]*)as(?!=)([\t ]*)\$"+vulnerability)
declaration2 = regex_declaration2.findall(content)
if len(declaration2) > 0:
return check_declaration(content, "$"+declaration2[0][0], path)
# Extract declaration - $something = $_GET['something']
regex_declaration = re.compile("\$"+vuln[1:]+"([\t ]*)=(?!=)(.*)")
regex_declaration = re.compile("\$"+vulnerability+"([\t ]*)=(?!=)(.*)")
declaration = regex_declaration.findall(content)
if len(declaration)>0:
# Check constant then return True if constant because it's false positive
declaration_text = "$"+vuln[1:] +declaration[0][0]+"="+declaration[0][1]
declaration_text = "$"+vulnerability +declaration[0][0]+"="+declaration[0][1]
line_declaration = find_line_declaration(declaration_text, content)
regex_constant = re.compile("\$"+vuln[1:]+"([\t ]*)=[\t ]*?([\"\'(]*?[a-zA-Z0-9{}_\(\)@\.,!: ]*?[\"\')]*?);")
false_positive = regex_constant.match(declaration_text)