mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-06 00:37:52 +00:00
Merge pull request #166 from Parabot/bugfix/issue-161
[BUGFIX] Added redirect for issue #161
This commit is contained in:
@@ -5,35 +5,40 @@ import org.parabot.core.asm.RedirectClassAdapter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class RuntimeRedirect {
|
public class RuntimeRedirect {
|
||||||
|
|
||||||
public static Runtime getRuntime(){
|
|
||||||
return Runtime.getRuntime();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int availableProcessors(Runtime r){
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long totalMemory(Runtime runtime){
|
public static Runtime getRuntime() {
|
||||||
return (long) 1024;
|
return Runtime.getRuntime();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long freeMemory(Runtime runtime){
|
public static int availableProcessors(Runtime r) {
|
||||||
return (long) 1024;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Process exec(Runtime r,String s){
|
public static long totalMemory(Runtime runtime) {
|
||||||
if (s.contains("ping")){
|
return (long) 1024;
|
||||||
System.out.println("Faked attempted command: " + s);
|
}
|
||||||
try {
|
|
||||||
return r.exec("ping 127.0.0.1");
|
public static long freeMemory(Runtime runtime) {
|
||||||
} catch (IOException e) {
|
return (long) 1024;
|
||||||
throw RedirectClassAdapter.createSecurityException();
|
}
|
||||||
}
|
|
||||||
}else{
|
public static Process exec(Runtime r, String[] s) {
|
||||||
System.out.println("Blocked attempted command: " + s);
|
System.out.println("Blocked attempted command: " + s);
|
||||||
throw RedirectClassAdapter.createSecurityException();
|
throw RedirectClassAdapter.createSecurityException();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static Process exec(Runtime r, String s) {
|
||||||
|
if (s.contains("ping")) {
|
||||||
|
System.out.println("Faked attempted command: " + s);
|
||||||
|
try {
|
||||||
|
return r.exec("ping 127.0.0.1");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw RedirectClassAdapter.createSecurityException();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.out.println("Blocked attempted command: " + s);
|
||||||
|
throw RedirectClassAdapter.createSecurityException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user