Skip to content

Commit

Permalink
Fix compilation bug with nodejs deprecated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
federicodotta committed Aug 12, 2021
1 parent d859b60 commit c6d792c
Showing 1 changed file with 40 additions and 9 deletions.
49 changes: 40 additions & 9 deletions src/main/java/burp/BurpExtender.java
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ private boolean compileFridaCode(String fridaCompilePath, String fridaJsFolder)
processCompilation.destroyForcibly();
return false;
}

BufferedReader stdInput = new BufferedReader(new InputStreamReader(processCompilation.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(processCompilation.getErrorStream()));

Expand All @@ -2376,14 +2376,11 @@ private boolean compileFridaCode(String fridaCompilePath, String fridaJsFolder)
}

// Read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
boolean hasExceptions = false;
while ((s = stdError.readLine()) != null) {
printException(null,s);
hasExceptions = true;
}

if(!hasExceptions) {
if(processCompilation.exitValue() == 0) {
printSuccessMessage("frida-compile completed successfully");
return true;
} else {
Expand Down Expand Up @@ -2993,7 +2990,14 @@ public void run() {

// Brida compiled file does not exist. Compiling it...
if(!compileFridaCode(fridaCompilePath.getText().trim(), fridaPath.getText().trim())) {
printException(null, "Error during frida-compile. Aborting.");
printException(null, "Error during frida-compile, potentially caused by compilation errors. Aborting. If exception details are not returned, try to run frida-compile manually. frida-compile command:");

if(fridaCompileOldCheckBox.isSelected()) {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -x -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
} else {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
}

return;
}

Expand All @@ -3004,7 +3008,13 @@ public void run() {
} else if(command.equals("compileSpawnApplication") && serverStarted) {

if(!compileFridaCode(fridaCompilePath.getText().trim(), fridaPath.getText().trim())) {
printException(null, "Error during frida-compile. Aborting.");
printException(null, "Error during frida-compile, potentially caused by compilation errors. Aborting. If exception details are not returned, try to run frida-compile manually. frida-compile command:");

if(fridaCompileOldCheckBox.isSelected()) {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -x -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
} else {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
}
return;
}

Expand All @@ -3016,7 +3026,13 @@ public void run() {

// Brida compiled file does not exist. Compiling it...
if(!compileFridaCode(fridaCompilePath.getText().trim(), fridaPath.getText().trim())) {
printException(null, "Error during frida-compile. Aborting.");
printException(null, "Error during frida-compile, potentially caused by compilation errors. Aborting. If exception details are not returned, try to run frida-compile manually. frida-compile command:");

if(fridaCompileOldCheckBox.isSelected()) {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -x -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
} else {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
}
return;
}

Expand All @@ -3027,7 +3043,13 @@ public void run() {
} else if(command.equals("compileAttachApplication") && serverStarted) {

if(!compileFridaCode(fridaCompilePath.getText().trim(), fridaPath.getText().trim())) {
printException(null, "Error during frida-compile. Aborting.");
printException(null, "Error during frida-compile, potentially caused by compilation errors. Aborting. If exception details are not returned, try to run frida-compile manually. frida-compile command:");

if(fridaCompileOldCheckBox.isSelected()) {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -x -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
} else {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
}
return;
}

Expand All @@ -3051,6 +3073,15 @@ public void run() {
} else if(command.equals("compileReloadScript") && serverStarted && applicationSpawned) {

if(!compileFridaCode(fridaCompilePath.getText().trim(), fridaPath.getText().trim())) {

printException(null, "Error during frida-compile, potentially caused by compilation errors. Aborting. If exception details are not returned, try to run frida-compile manually. frida-compile command:");

if(fridaCompileOldCheckBox.isSelected()) {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -x -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
} else {
printException(null, "\"" + fridaCompilePath.getText().trim() + "\" -o \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "bridaGeneratedCompiledOutput.js\" \"" + fridaPath.getText().trim() + System.getProperty("file.separator") + "brida.js\"");
}

return;
}

Expand Down

0 comments on commit c6d792c

Please sign in to comment.