Skip to content

Commit 40ef31b

Browse files
author
exploit
committed
bugfix for isRecordExists
1 parent 9365e0c commit 40ef31b

File tree

8 files changed

+34
-76
lines changed

8 files changed

+34
-76
lines changed

CFGGenerator.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,30 +1088,30 @@ public function sinkTracebackBlock($argName,$block,$flowsNum){
10881088
}
10891089
}
10901090

1091-
//扫描漏洞类型
1092-
$scan_type = 'ALL';
1093-
echo "<pre>" ;
1094-
//从用户那接受项目路径
1095-
// $project_path = 'C:/users/xyw55/Desktop/test/simple-log_v1.3.1/upload';
1096-
// $allFiles = FileUtils::getPHPfile($project_path);
1097-
// //初始化
1098-
// $initModule = new InitModule() ;
1099-
// $initModule->init($project_path) ;
1091+
// //扫描漏洞类型
1092+
// $scan_type = 'ALL';
1093+
// echo "<pre>" ;
1094+
// //从用户那接受项目路径
1095+
// // $project_path = 'C:/users/xyw55/Desktop/test/simple-log_v1.3.1/upload';
1096+
// // $allFiles = FileUtils::getPHPfile($project_path);
1097+
// // //初始化
1098+
// // $initModule = new InitModule() ;
1099+
// // $initModule->init($project_path) ;
11001100

1101-
$cfg = new CFGGenerator() ;
1102-
$visitor = new MyVisitor() ;
1103-
$parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative) ;
1104-
$traverser = new PhpParser\NodeTraverser ;
1105-
$path = CURR_PATH . '/test/test.php';
1106-
$cfg->getFileSummary()->setPath($path);
1107-
$code = file_get_contents($path);
1108-
$stmts = $parser->parse($code) ;
1109-
$traverser->addVisitor($visitor) ;
1110-
$traverser->traverse($stmts) ;
1111-
$nodes = $visitor->getNodes() ;
1112-
$pEntryBlock = new BasicBlock() ;
1113-
$pEntryBlock->is_entry = true ;
1114-
$ret = $cfg->CFGBuilder($nodes, NULL, NULL, NULL) ;
1101+
// $cfg = new CFGGenerator() ;
1102+
// $visitor = new MyVisitor() ;
1103+
// $parser = new PhpParser\Parser(new PhpParser\Lexer\Emulative) ;
1104+
// $traverser = new PhpParser\NodeTraverser ;
1105+
// $path = CURR_PATH . '/test/test.php';
1106+
// $cfg->getFileSummary()->setPath($path);
1107+
// $code = file_get_contents($path);
1108+
// $stmts = $parser->parse($code) ;
1109+
// $traverser->addVisitor($visitor) ;
1110+
// $traverser->traverse($stmts) ;
1111+
// $nodes = $visitor->getNodes() ;
1112+
// $pEntryBlock = new BasicBlock() ;
1113+
// $pEntryBlock->is_entry = true ;
1114+
// $ret = $cfg->CFGBuilder($nodes, NULL, NULL, NULL) ;
11151115

11161116

11171117
?>

analyser/TaintAnalyser.class.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -611,12 +611,12 @@ public function analysis($block, $node, $argName, $fileSummary){
611611
* @param string 漏洞的类型
612612
*/
613613
public function report($node_path, $var_path, $node, $var, $type){
614-
echo "<pre>" ;
615-
echo "有漏洞=====>". $type ."<br/>" ;
616-
echo "漏洞变量:<br/>" ;
617-
print_r($var) ;
618-
echo "漏洞节点:<br/>" ;
619-
print_r($node) ;
614+
// echo "<pre>" ;
615+
// echo "有漏洞=====>". $type ."<br/>" ;
616+
// echo "漏洞变量:<br/>" ;
617+
// print_r($var) ;
618+
// echo "漏洞节点:<br/>" ;
619+
// print_r($node) ;
620620

621621
//获取结果集上下文
622622
$resultContext = ResultContext::getInstance() ;
@@ -630,9 +630,7 @@ public function report($node_path, $var_path, $node, $var, $type){
630630
}else{
631631
$resultContext->addResElement($record) ;
632632
}
633-
634633
}
635-
636-
634+
637635
}
638636
?>

context/ResultContext.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function addResElement($ele){
3030
public function isRecordExists($record){
3131
foreach ($this->resArr as $value){
3232
$value_record = $value->getRecord() ;
33-
if($value_record == $record){
33+
if($value_record == $record->getRecord()){
3434
return true ;
3535
}
3636
}
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a:0:{}

main.php

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ function convertResults($resContext){
103103
fclose($fileHandler);
104104
}
105105

106+
$results = null;
106107
if(($serial_str = file_get_contents($serialPath)) != ''){
107108
$results = unserialize($serial_str) ;
108109
}else{
@@ -138,50 +139,9 @@ function convertResults($resContext){
138139

139140

140141

141-
//2、初始化模块
142-
$allFiles = FileUtils::getPHPfile($project_path);
143-
$mainlFiles = FileUtils::mainFileFinder($project_path);
144-
$initModule = new InitModule() ;
145-
$initModule->init($project_path, $allFiles) ;
146-
147-
148-
//3、循环每个文件 进行分析工作
149-
if(is_file($project_path)){
150-
load_file($project_path) ;
151-
}elseif (is_dir($project_path)){
152-
$path_list = $mainlFiles;
153-
foreach ($path_list as $path){
154-
try{
155-
print_r($path.'<br/>');
156-
load_file($path) ;
157-
}catch(Exception $e){
158-
continue ;
159-
}
160-
}
161-
}else{
162-
//请求不合法
163-
echo "工程不存在!" ;
164-
exit() ;
165-
}
166-
167-
//4、获取ResultContext 序列化
168-
$results = ResultContext::getInstance() ;
169-
170-
171-
file_put_contents($serialPath, serialize($results)) ;
172-
173-
//5、处理results 传给template
174-
$tempRes = array();
175-
foreach ($results->getResArr() as $result){
176-
$record = $result->getRecord();
177-
array_push($tempRes, $record);
178-
}
179-
180-
$results = $tempRes;
181-
182142

183143
//5、处理results 传给template
184-
$template_res = convertResults(ResultContext::getInstance()) ;
144+
$template_res = convertResults($results) ;
185145
$smarty->assign('results',$template_res);
186146
$smarty->display('content.html');
187147

views/static/js/phpvulhunter.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ function sendCodeViewReq( tag_a )
107107
{
108108
var grandparent = tag_a.parentNode.parentNode;
109109
var codeFile = grandparent.getElementsByTagName('span');
110-
if( cutstr($(codeFile[0]).html()) == cutstr($(codeFile[6]).html()) )
111110
$.ajax({
112111
type : "POST",
113112
url : "CodeViewer.php",

0 commit comments

Comments
 (0)