Created
March 3, 2015 09:22
-
-
Save mwulftange/d11bd5711e85d0f0b097 to your computer and use it in GitHub Desktop.
$@|sh – Or: Getting a shell environment from Runtime.exec (http://codewhitesec.blogspot.com/2015/03/sh-or-getting-shell-environment-from.html)
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
import java.io.*; | |
public class Exec { | |
public static void main(String[] args) throws IOException { | |
Process p = Runtime.getRuntime().exec(args[0]); | |
byte[] b = new byte[1]; | |
while (p.getErrorStream().read(b) > 0) | |
System.out.write(b); | |
while (p.getInputStream().read(b) > 0) | |
System.out.write(b); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment