MCPcopy Create free account
hub / github.com/c0ny1/sqlmap4burp-plus-plus / run

Method run

src/main/java/burp/SqlmapStarter.java:13–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11public class SqlmapStarter implements Runnable {
12
13 @Override
14 public void run() {
15 try {
16 String command = String.format("%s \"%s\" -r \"%s\" %s",Config.getPythonName(),Config.getSqlmapPath(),Config.getRequstFilePath(),Config.getSqlmapOptionsCommand());
17 List<String> cmds = new ArrayList();
18 int osType = Util.getOSType();
19 if(osType == Util.OS_WIN){
20 cmds.add("cmd.exe");
21 cmds.add("/c");
22 cmds.add("start");
23 String batFilePath = Util.makeBatFile("sqlmap4burp.bat",command);
24 if(!batFilePath.equals("Fail")){
25 cmds.add(batFilePath);
26 }else{
27 String eMsg = "make sqlmap4burp.bat fail!";
28 JOptionPane.showMessageDialog(null,eMsg,"sqlmap4burp++ alert",JOptionPane.ERROR_MESSAGE);
29 return;
30 }
31 }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);
36 cmds.add("osascript");
37 cmds.add("-e");
38 String cmd = "tell application \"Terminal\" \n" +
39 " activate\n" +
40 " do script \"%s\"\n" +
41 "end tell";
42 cmds.add(String.format(cmd,command));
43 //BurpExtender.stdout.println(String.format(cmd,command));
44 }else if(osType == Util.OS_LINUX){
45 cmds.add("/bin/sh");
46 cmds.add("-c");
47 cmds.add("gnome-terminal");
48 Util.setSysClipboardText(command);
49 JOptionPane.showMessageDialog(null,"The command has been copied to the clipboard. Please paste it into Terminal for execution","sqlmap4burp++ alert",JOptionPane.OK_OPTION);
50 }else{
51 cmds.add("/bin/bash");
52 cmds.add("-c");
53 cmds.add(command);
54 }
55
56 ProcessBuilder processBuilder = new ProcessBuilder(cmds);
57 Process process = processBuilder.start();
58 InputStreamReader ir = new InputStreamReader(process.getInputStream());
59 BufferedReader input = new BufferedReader (ir);
60 String line;
61 while ((line = input.readLine()) != null) {
62 BurpExtender.stdout.println(line);
63 }
64 } catch (IOException e) {
65 e.printStackTrace();
66 BurpExtender.stderr.println("[*]" + e.getMessage());
67 } catch (Exception e) {
68 e.printStackTrace();
69 }
70

Callers

nothing calls this directly

Calls 7

getPythonNameMethod · 0.95
getSqlmapPathMethod · 0.95
getRequstFilePathMethod · 0.95
getOSTypeMethod · 0.95
makeBatFileMethod · 0.95
setSysClipboardTextMethod · 0.95

Tested by

no test coverage detected