Skip to content

Commit 83770df

Browse files
committed
解决sqlmap路径存在空格情况下命令执行失败问题
1 parent a816dbb commit 83770df

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/main/java/burp/SqlmapStarter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class SqlmapStarter implements Runnable {
1313
@Override
1414
public void run() {
1515
try {
16-
String command = String.format("%s %s -r %s %s",Config.getPythonName(),Config.getSqlmapPath(),Config.getRequstFilePath(),Config.getSqlmapOptionsCommand());
16+
String command = String.format("%s \"%s\" -r \"%s\" %s",Config.getPythonName(),Config.getSqlmapPath(),Config.getRequstFilePath(),Config.getSqlmapOptionsCommand());
1717
List<String> cmds = new ArrayList();
1818
int osType = Util.getOSType();
1919
if(osType == Util.OS_WIN){
@@ -29,6 +29,10 @@ public void run() {
2929
return;
3030
}
3131
}else if(osType == Util.OS_MAC){
32+
String optionCommand = Config.getSqlmapOptionsCommand();
33+
//将参数数中的"转译为\"
34+
optionCommand = optionCommand.replace("\"","\\\"");
35+
command = String.format("%s \\\"%s\\\" -r \\\"%s\\\" %s",Config.getPythonName(),Config.getSqlmapPath(),Config.getRequstFilePath(),optionCommand);
3236
cmds.add("osascript");
3337
cmds.add("-e");
3438
String cmd = "tell application \"Terminal\" \n" +

0 commit comments

Comments
 (0)