Skip to content

Commit ef27d61

Browse files
committed
fix benchmark
1 parent ecb46a8 commit ef27d61

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/main/java/com/iast/astbenchmark/cases/AstPerfCase001.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.iast.astbenchmark.cases.bean.big.BigSizeBean;
66
import com.iast.astbenchmark.common.CommonConsts;
77
import com.iast.astbenchmark.common.longd.LongChainUtil;
8-
import com.iast.astbenchmark.common.utils.MyCommonTestUtil;
98
import com.iast.astbenchmark.common.utils.MyCommonTestUtil2;
109
import org.springframework.web.bind.annotation.PostMapping;
1110
import org.springframework.web.bind.annotation.RequestBody;

src/main/java/com/iast/astbenchmark/cases/AstTaintCase002.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.iast.astbenchmark.common.utils.TaintMethodUtil;
1111
import lombok.Data;
1212
import org.apache.commons.lang.StringEscapeUtils;
13+
import org.apache.commons.lang.StringUtils;
1314
import org.springframework.http.MediaType;
1415
import org.springframework.web.bind.annotation.*;
1516
import org.springframework.web.multipart.MultipartFile;
@@ -43,8 +44,8 @@ public class AstTaintCase002 {
4344
* @param cmd
4445
* @return
4546
*/
46-
@PostMapping("case0022/{cmd}")
47-
public Map<String, Object> aTaintCase0022(@PathVariable String cmd) {
47+
@PostMapping("case0022")
48+
public Map<String, Object> aTaintCase0022(@RequestParam String cmd) {
4849
Map<String, Object> modelMap = new HashMap<>();
4950
try {
5051
Runtime.getRuntime().exec(StrUtil.cleanBlank(cmd));
@@ -109,8 +110,8 @@ public Map<String, Object> aTaintCase00931(@RequestBody String cmd) {
109110
* @param cmd
110111
* @return
111112
*/
112-
@PostMapping("case0024/{cmd}")
113-
public Map<String, Object> aTaintCase0024(@PathVariable String cmd)
113+
@PostMapping("case0024")
114+
public Map<String, Object> aTaintCase0024(@RequestParam String cmd)
114115
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
115116
Map<String, Object> modelMap = new HashMap<>();
116117
if (cmd == null) {

src/main/java/com/iast/astbenchmark/cases/AstTaintCase004.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ public Map<String, Object> aTaintCase00952(@RequestParam String cmd) {
981981
String aa = hardcode+cmd;
982982
char[] chars = aa.toCharArray();
983983
char[] data = Arrays.copyOfRange(chars,hardcode.length(),chars.length);;
984-
Runtime.getRuntime().exec(new String(chars));
984+
Runtime.getRuntime().exec(new String(data));
985985
modelMap.put("status", CommonConsts.SUCCESS_STR);
986986
} catch (IOException e) {
987987
modelMap.put("status", CommonConsts.ERROR_STR);
@@ -1007,7 +1007,7 @@ public Map<String, Object> aTaintCase00952_3(@RequestParam String cmd) {
10071007
String aa = hardcode+cmd;
10081008
char[] chars = aa.toCharArray();
10091009
char[] data = Arrays.copyOfRange(chars,0,hardcode.length());;
1010-
Runtime.getRuntime().exec(new String(chars));
1010+
Runtime.getRuntime().exec(new String(data));
10111011
modelMap.put("status", CommonConsts.SUCCESS_STR);
10121012
} catch (IOException e) {
10131013
modelMap.put("status", CommonConsts.ERROR_STR);
@@ -1056,7 +1056,7 @@ public Map<String, Object> aTaintCase00954(@RequestParam String cmd) {
10561056
String hardcode = "a,b";
10571057
String cmdfull = hardcode + cmd;
10581058
String data1=cmdfull.substring(0,hardcode.length());
1059-
String dara2=String.join(cmd,data1);
1059+
String dara2=String.join(cmd,data1,hardcode);
10601060
Runtime.getRuntime().exec(dara2);
10611061
modelMap.put("status", CommonConsts.SUCCESS_STR);
10621062
} catch (IOException e) {

src/main/java/com/iast/astbenchmark/cli/test/CopyTestCaseForRun.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ void aTaintCase00931() {
264264
}
265265

266266
void aTaintCase0024() {
267-
HttpResponse response = doPost(url_root + "ataint/case0024/as");
267+
HttpResponse response = doPost(url_root + "ataint/case0024?cmd=ls");
268268
System.out.println(response.body());
269269
}
270270

src/test/java/com/iast/astbenchmark/AstbenchmarkApplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ void aTaintCase00925_2() {
393393
}
394394
@Test
395395
void aTaintCase0022() {
396-
HttpResponse response = doPost(url_root + "ataint/case0022/l%20s%20");
396+
HttpResponse response = doPost(url_root + "ataint/case0022?cmd=l%20s%20");
397397
System.out.println(response.body());
398398
}
399399

@@ -410,7 +410,7 @@ void aTaintCase00931() {
410410

411411
@Test
412412
void aTaintCase0024() {
413-
HttpResponse response = doPost(url_root + "ataint/case0024/as");
413+
HttpResponse response = doPost(url_root + "ataint/case0024?cmd=ls");
414414
System.out.println(response.body());
415415
}
416416

0 commit comments

Comments
 (0)