Java, cracked
#Java, cracked It'sIt's more of a guess..
public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException, NoSuchMethodException {
try {
System.class.getField("in").set(null, null);
System.class.getField("out").set(null, null);
System.class.getField("err").set(null, null);
System.class.getMethod("getSecurityManager", new Class[0]).setAccessible(false);
File.class.getField("fs").set(null, null);
for (Method m : Class.class.getMethods()) {
m.setAccessible(false);
}
SecurityManager mngr = new SecurityManager() {
@Override
public void checkPermission(Permission p) {
throw new Error("Muahaha!");
}
@Override
public void checkLink(String s) {
throw new Error("Not this way, my friend!");
}
};
System.setSecurityManager(mngr);
} catch (Throwable t) {
}
}
This blocks all ways of I/O that I know of, and also blocks undoing my work by construction a custom security manager that does not permit anything (not even linking native libraries). I don't see a way to remove Javas arithmetic stuff,but if someone does, feel free to leave a comment. Hope you enjoy the challenge.