Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #129 from wufeifei/develop
Browse files Browse the repository at this point in the history
fixed exceptions
  • Loading branch information
FeeiCN authored Sep 22, 2016
2 parents 82dd457 + 4f10f14 commit 87e495b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions engine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ def repair(self):
self.status = self.status_fixed
self.process_vulnerabilities()
return True, 1001
# 文件存在,漏洞还在
return False

# 取出触发代码(实际文件)
trigger_code = File(self.file_path).lines("{0}p".format(self.line_number))
Expand Down
13 changes: 12 additions & 1 deletion engine/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def is_controllable_param(self):
param_name = re.findall(self.rule, self.code)
if len(param_name) == 1:
param_name = param_name[0].strip()
param_name = re.escape(param_name)
self.param_name = param_name
logging.debug('参数: `{0}`'.format(param_name))
# 固定字符串判断
Expand All @@ -202,7 +203,17 @@ def is_controllable_param(self):
logging.debug("向上搜索参数区块代码: {0}".format(param_block_code))

# 外部取参赋值
regex_get_param = r'(\{0}\s?=\s?\$\w+(?:\[(?:[^[\]]|\?R)*\])*)'.format(param_name)
"""
# Need match
$url = $_GET['test'];
$url = $_POST['test'];
$url = $_REQUEST['test'];
$url = $_SERVER['user_agent'];
# Don't match
$url = $_SERVER
$url = $testsdf;
"""
regex_get_param = r'(\{0}\s*=\s*\$_[GET|POST|REQUEST|SERVER]+(?:\[))'.format(param_name)
regex_get_param_result = re.findall(regex_get_param, param_block_code)
if len(regex_get_param_result) >= 1:
self.param_value = regex_get_param_result[0]
Expand Down

0 comments on commit 87e495b

Please sign in to comment.