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