diff --git a/.travis.yml b/.travis.yml
index 5b5dea8..780a3d9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -32,7 +32,7 @@ env:
- secure: UG+b1tEgc8xv9x4r//2OAIK1RrYv6n209KTTFMMwcnAa7DI8HaP8nljRa5/VhDhuKHdlVrYH/tI90v7UVBs0GDVNwK5V17Io0fMm3FUGZekSthTCqqno5wAGa9r6a6mMLtSaSmIFeIKi0+0d2ZwplRuhj/dtEYjjBBj+kK8g4nE=
- secure: St/fecUDInFBCRriYqgp2F8PU9/SooorgxD9Mrs+b0EsC7AbtSsQXvdIv2Lp6xzdQ0VSXPcLIhULPOYrmBKnGQ/NjXTIZXxnroyQxxnI6xyEWIZwiHRY/bKRJDRbQTxD9NL32szKiDSwnw7pu6llF4D64UqQvziq4Gm6VohU75M=
- secure: bD15GVZWowiknbfLavh8CxSh0GsnF5kT4kZ6ggCuUDGyj0mzqf7dNRnchQIKkCG0WRYyTrFN4pEiygeywWsipEeAVv9Xhx3cuUZmzeQaR5KCWabSwJ8gK6jZd1YhcWmM9vrdPHobZr65MP0y/8mu/Fovgky9dY7KDf4G3SebNrM=
- - PARABOT_VERSION=2.6.2
+ - PARABOT_VERSION=2.6.4
cache:
directories:
diff --git a/README.md b/README.md
index b263025..41f5398 100644
--- a/README.md
+++ b/README.md
@@ -3,23 +3,28 @@
# Parabot
-Parabot V2.6.2.
+Parabot V2.6.3.
-#### Website
+#### Links
-[Community, scripts & more](http://www.parabot.org/)
+[Website](http://www.parabot.org/)
+
+[Download latest version](http://v3.bdn.parabot.org/api/bot/download/client)
#### Compilation
-You'll need the [libraries](https://github.com/Parabot/Parabot/tree/master/libs) in order to compile parabot successfully.
-The POM file contains the redirection to the libraries, so simply install them with Maven.
+Build the project with the Maven POM file to have all required libraries installed.
+
+#### Automation
+Every stable build is automatically generated from the last commits of the master branch. This will take the version from both the `pom.xml` and the version in `.travis.yml`.
+
+The nightly builds are automatically created from the last commits of the development branch. This will take the version from both the `pom.xml` and the version in `.travis.yml`, together with the build ID from travis.
#### Issues
If you've an issues regarding the bot itself, please report them [here](https://github.com/Parabot/Parabot/issues).
#### Maven
-Parabot supports Maven as of September 2015. All information is included in the POM.xml.
-The API that is supported by Parabot is also published on a Maven repository.
-If you'd like to have either or both the client and the API in your project, use the following repository and dependecy tags:
+To add the client as a library, you'll first have to add our repository to your `pom.xml`:
+
```
@@ -28,22 +33,19 @@ If you'd like to have either or both the client and the API in your project, use
https://maven.parabot.org/
+```
+Then you'll need to add the dependency:
+
+```
org.parabot
client
- 2.6
-
-
- org.parabot
- 317provider
- 1.14
+ 2.6.3
```
-**For the latest versions of our dependencies, please check our examples on [the Maven Repository](https://github.com/Parabot/Maven-Repository/tree/master/examples)**
-
#### Labels
Labels are created with [GHLabel](https://github.com/jimmycuadra/ghlabel), whereas the yml is located in the .github directory
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 4944707..217884b 100755
--- a/pom.xml
+++ b/pom.xml
@@ -6,8 +6,8 @@
org.parabot
client
- 2.6.3
-
+ 2.6.4
+
jar
diff --git a/src/main/java/org/parabot/core/asm/RedirectClassAdapter.java b/src/main/java/org/parabot/core/asm/RedirectClassAdapter.java
index 3421a50..03cbb66 100644
--- a/src/main/java/org/parabot/core/asm/RedirectClassAdapter.java
+++ b/src/main/java/org/parabot/core/asm/RedirectClassAdapter.java
@@ -20,19 +20,18 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
private String className;
- private static PrintStream str_out, class_out, dec_out;
+ private static PrintStream str_out, class_out;
static {
redirects.put("java/awt/Toolkit", ToolkitRedirect.class);
redirects.put("java/lang/Class", ClassRedirect.class);
- redirects.put("java/lang/ClassLoader", ClassLoaderRedirect.class);
+// redirects.put("java/lang/ClassLoader", ClassLoaderRedirect.class);
redirects.put("java/lang/Runtime", RuntimeRedirect.class);
redirects.put("java/lang/Thread", ThreadRedirect.class);
redirects.put("java/lang/StackTraceElement",
StackTraceElementRedirect.class);
redirects.put("java/lang/ProcessBuilder", ProcessBuilderRedirect.class);
redirects.put("java/lang/System", SystemRedirect.class);
- redirects.put("java/io/File", FileRedirect.class);
}
public RedirectClassAdapter(ClassVisitor cv) {
@@ -40,31 +39,27 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
if (str_out == null && Core.shouldDump())
try {
str_out = new PrintStream(new FileOutputStream(new File(Directories.getWorkspace(),"strings.txt")));
- dec_out = new PrintStream(new FileOutputStream(new File(Directories.getWorkspace(),"decrypted_strings.txt")));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
if(class_out == null && Core.shouldDump())
try {
class_out = new PrintStream(new FileOutputStream(new File(Directories.getWorkspace(),"classes.txt")));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
}
@Override
public void visit(int version, int access, String name, String signature,
- String superName, String[] interfaces) {
+ String superName, String[] interfaces) {
this.className = name;
super.visit(version, access, name, signature, superName, interfaces);
if(class_out != null) {
class_out.println(className + " References:");
}
}
-
+
@Override
public void visitEnd(){
super.visitEnd();
@@ -76,7 +71,7 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
@Override
public MethodVisitor visitMethod(int access, String name, String desc,
- String signature, String[] exceptions) {
+ String signature, String[] exceptions) {
return new ReflectionMethodVisitor(name, desc, super.visitMethod(
access, name, desc, signature, exceptions));
}
@@ -84,45 +79,43 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
private class ReflectionMethodVisitor extends MethodVisitor {
public ReflectionMethodVisitor(String name, String desc,
- MethodVisitor mv) {
+ MethodVisitor mv) {
super(ASM5, mv);
}
@Override
public void visitLdcInsn(Object o) {
- if (o instanceof String && str_out != null) {
- str_out.println(className + " " + o);
- if (!className.toLowerCase().contains("parabot")) {
- dec_out.println(o + ":");
- dec_out.println();
- }
- }
+ if (o instanceof String && str_out != null) {
+ str_out.println(className + " " + o);
+ }
super.visitLdcInsn(o);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name,
- String desc) {
+ String desc, boolean itf) {
if (Core.isSecure()) {
if (redirects.containsKey(owner) && !name.equals("")
&& !name.equals("")) {
- if (opcode != INVOKESTATIC)
+ if (opcode != INVOKESTATIC) {
desc = "(L" + owner + ";" + desc.substring(1);
+ }
opcode = INVOKESTATIC;
owner = redirects.get(owner).getName()
.replaceAll("\\.", "/");
}
}
-
- if(class_out != null)
- class_out.println(owner);
- super.visitMethodInsn(opcode, owner, name, desc);
+ if(class_out != null) {
+ class_out.println(owner);
+ }
+
+ super.visitMethodInsn(opcode, owner, name, desc, itf);
}
-
+
@Override
public void visitFieldInsn(int opcode, String owner, String name,
- String desc){
+ String desc){
if (Core.isSecure() && (opcode == GETSTATIC || opcode == PUTSTATIC)) {
if (redirects.containsKey(owner)) {
owner = redirects.get(owner).getName()
@@ -133,7 +126,7 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
class_out.println(owner);
super.visitFieldInsn(opcode, owner, name, desc);
}
-
+
}
public static SecurityException createSecurityException() {
diff --git a/src/main/java/org/parabot/core/asm/redirect/ClassLoaderRedirect.java b/src/main/java/org/parabot/core/asm/redirect/ClassLoaderRedirect.java
index 5a771a4..54bc5d5 100644
--- a/src/main/java/org/parabot/core/asm/redirect/ClassLoaderRedirect.java
+++ b/src/main/java/org/parabot/core/asm/redirect/ClassLoaderRedirect.java
@@ -1,15 +1,53 @@
package org.parabot.core.asm.redirect;
+import org.parabot.core.Core;
import org.parabot.core.asm.RedirectClassAdapter;
-public class ClassLoaderRedirect {
-
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+public class ClassLoaderRedirect extends ClassLoader {
+
+ static int count = 0;
+
public static Class>loadClass(ClassLoader c,String name){
throw RedirectClassAdapter.createSecurityException();
}
- static int count = 0;
+
public static ClassLoader getParent(ClassLoader c){
throw RedirectClassAdapter.createSecurityException();
}
+ public static URL getResource(ClassLoader classLoader, String name) {
+ Core.verbose("#getResource requested for ClassLoaderRedirect (" + name + ")");
+ return classLoader.getResource(name);
+ }
+
+ public static Enumeration getResources(ClassLoader classLoader, String name) throws IOException {
+ Core.verbose("#getResource requested for ClassLoaderRedirect (" + name + ")");
+ return classLoader.getResources(name);
+ }
+
+ public static InputStream getResourceAsStream(ClassLoader classLoader, String name) {
+ Core.verbose("#getResourceAsStream requested for ClassLoaderRedirect (" + name + ")");
+ return classLoader.getResourceAsStream(name);
+ }
+
+ public static void setDefaultAssertionStatus(ClassLoader classLoader, boolean enabled) {
+
+ }
+
+ public static void setPackageAssertionStatus(ClassLoader classLoader, String packageName, boolean enabled) {
+
+ }
+
+ public static void setClassAssertionStatus(ClassLoader classLoader, String className, boolean enabled) {
+
+ }
+
+ public static void clearAssertionStatus(ClassLoader classLoader) {
+
+ }
}
diff --git a/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java b/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java
index dd8c647..40fc7a4 100644
--- a/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java
+++ b/src/main/java/org/parabot/core/asm/redirect/ClassRedirect.java
@@ -21,6 +21,7 @@ public class ClassRedirect {
if (validStack()) {
return c.getDeclaredField(s);
}
+
System.out.println(c.getName() + "." + c.getDeclaredField(s) + " Blocked.");
throw RedirectClassAdapter.createSecurityException();
}
@@ -29,6 +30,7 @@ public class ClassRedirect {
if (validStack()) {
return c.getDeclaredMethod(name, params);
}
+
System.out.println(c.getName() + "#" + c.getDeclaredMethod(name, params) + " Blocked.");
throw RedirectClassAdapter.createSecurityException();
}
diff --git a/src/main/java/org/parabot/core/asm/redirect/RuntimeRedirect.java b/src/main/java/org/parabot/core/asm/redirect/RuntimeRedirect.java
index 092b920..f5074c2 100644
--- a/src/main/java/org/parabot/core/asm/redirect/RuntimeRedirect.java
+++ b/src/main/java/org/parabot/core/asm/redirect/RuntimeRedirect.java
@@ -5,28 +5,40 @@ import org.parabot.core.asm.RedirectClassAdapter;
import java.io.IOException;
public class RuntimeRedirect {
-
- public static Runtime getRuntime(){
- return Runtime.getRuntime();
- }
-
- public static int availableProcessors(Runtime r){
- //lol faking it, fuck ikov
- return 2;
- }
-
- 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();
- }
- }
+
+ public static Runtime getRuntime() {
+ return Runtime.getRuntime();
+ }
+
+ public static int availableProcessors(Runtime r) {
+ return 2;
+ }
+
+ public static long totalMemory(Runtime runtime) {
+ return (long) 1024;
+ }
+
+ public static long freeMemory(Runtime runtime) {
+ return (long) 1024;
+ }
+
+ public static Process exec(Runtime r, String[] s) {
+ System.out.println("Blocked attempted command: " + s);
+ 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();
+ }
+ }
}
diff --git a/src/main/java/org/parabot/core/asm/redirect/SystemRedirect.java b/src/main/java/org/parabot/core/asm/redirect/SystemRedirect.java
index 4842f77..f18fe1f 100644
--- a/src/main/java/org/parabot/core/asm/redirect/SystemRedirect.java
+++ b/src/main/java/org/parabot/core/asm/redirect/SystemRedirect.java
@@ -27,7 +27,10 @@ public class SystemRedirect {
String value;
switch (s) {
case "user.home":
- value = Directories.getHomeDir().getAbsolutePath();
+ value = Directories.getCachePath().getAbsolutePath();
+ break;
+ case "java.class.path":
+ value = ".";
break;
default:
value = System.getProperty(s);
@@ -40,14 +43,20 @@ public class SystemRedirect {
String value = null;
switch (s2) {
case "user.home":
- value = Directories.getHomeDir().getAbsolutePath();
+ value = Directories.getCachePath().getAbsolutePath();
+ break;
+ case "java.class.path":
+ value = ".";
break;
}
if (value == null) {
switch (s) {
case "user.home":
- value = Directories.getHomeDir().getAbsolutePath();
+ value = Directories.getCachePath().getAbsolutePath();
+ break;
+ case "java.class.path":
+ value = ".";
break;
default:
value = System.getProperty(s);
@@ -62,11 +71,12 @@ public class SystemRedirect {
}
public static String setProperty(String s1, String s2) {
- System.out.printf("SetSystemProp %s = %s", s1, s2);
+ System.out.printf("SetSystemProp %s = %s\n", s1, s2);
return System.setProperty(s1, s2);
}
public static String getenv(String string) {
+ System.out.printf("getEnv %s = %s\n", string, System.getenv(string));
return System.getenv(string);
}
@@ -74,7 +84,6 @@ public class SystemRedirect {
}
-
public static void setErr(PrintStream printStream) {
}
diff --git a/src/main/java/org/parabot/core/ui/ReflectUI.java b/src/main/java/org/parabot/core/ui/ReflectUI.java
index 351ca66..32d7f59 100644
--- a/src/main/java/org/parabot/core/ui/ReflectUI.java
+++ b/src/main/java/org/parabot/core/ui/ReflectUI.java
@@ -5,6 +5,7 @@ import org.parabot.core.asm.ASMClassLoader;
import org.parabot.core.classpath.ClassPath;
import org.parabot.core.reflect.RefClass;
import org.parabot.core.reflect.RefField;
+import org.parabot.environment.api.utils.StringUtils;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
@@ -91,6 +92,8 @@ public class ReflectUI extends JFrame {
result = f;
} else if (value.toLowerCase().endsWith(search.toLowerCase())) {
result = f;
+ } else if (value.toLowerCase().contains(search.toLowerCase())) {
+ result = f;
}
}
}
@@ -238,6 +241,13 @@ public class ReflectUI extends JFrame {
builder.append("Type: ").append(refField.getASMType().getClassName()).append("
");
builder.append("Static: ").append(refField.isStatic() ? "yes" : "no").append("
");
builder.append("Array: ").append(refField.isArray() ? refField.getArrayDimensions() + " dimension(s)" : "no").append("
");
+
+ if (refField.isArray() && refField.getASMType().getClassName().contains("String") && refField.getArrayDimensions() == 1) {
+ String[] strings = (String[]) refField.asObject();
+ String values = StringUtils.implode(", ", strings);
+
+ builder.append("Values: ").append(values).append("
");
+ }
selectionInfoPane.setText(builder.toString());
fillBasicInfoPane();
diff --git a/src/main/java/org/parabot/environment/api/utils/StringUtils.java b/src/main/java/org/parabot/environment/api/utils/StringUtils.java
index 573d5a1..892c75b 100644
--- a/src/main/java/org/parabot/environment/api/utils/StringUtils.java
+++ b/src/main/java/org/parabot/environment/api/utils/StringUtils.java
@@ -28,6 +28,19 @@ public class StringUtils {
return sb.toString();
}
+ public static String implode(String separator, String... data) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < data.length - 1; i++) {
+ //data.length - 1 => to not add separator at the end
+ if (!data[i].matches(" *")) {//empty string are ""; " "; " "; and so on
+ sb.append(data[i]);
+ sb.append(separator);
+ }
+ }
+ sb.append(data[data.length - 1].trim());
+ return sb.toString();
+ }
+
public static String randomString(final int length) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 20; i++) {
diff --git a/src/main/java/org/parabot/environment/randoms/RandomHandler.java b/src/main/java/org/parabot/environment/randoms/RandomHandler.java
index c1dee3e..a8bda20 100644
--- a/src/main/java/org/parabot/environment/randoms/RandomHandler.java
+++ b/src/main/java/org/parabot/environment/randoms/RandomHandler.java
@@ -109,7 +109,12 @@ public class RandomHandler {
for (Random r : this.activeRandoms) {
if (r.getRandomType().getId() == type.getId() && r.activate()) {
Logger.addMessage("Running random '" + r.getName() + "'", true);
- r.execute();
+ try {
+ r.execute();
+ }catch (Exception e){
+ Logger.addMessage("Random failed: '" + r.getName() + "'", false);
+ e.printStackTrace();
+ }
return true;
}
}