Merge branch 'development' into feature/PushBulletNotifications

This commit is contained in:
Emma Stone
2017-02-03 15:46:39 +00:00
committed by GitHub
11 changed files with 168 additions and 84 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ env:
- secure: UG+b1tEgc8xv9x4r//2OAIK1RrYv6n209KTTFMMwcnAa7DI8HaP8nljRa5/VhDhuKHdlVrYH/tI90v7UVBs0GDVNwK5V17Io0fMm3FUGZekSthTCqqno5wAGa9r6a6mMLtSaSmIFeIKi0+0d2ZwplRuhj/dtEYjjBBj+kK8g4nE= - secure: UG+b1tEgc8xv9x4r//2OAIK1RrYv6n209KTTFMMwcnAa7DI8HaP8nljRa5/VhDhuKHdlVrYH/tI90v7UVBs0GDVNwK5V17Io0fMm3FUGZekSthTCqqno5wAGa9r6a6mMLtSaSmIFeIKi0+0d2ZwplRuhj/dtEYjjBBj+kK8g4nE=
- secure: St/fecUDInFBCRriYqgp2F8PU9/SooorgxD9Mrs+b0EsC7AbtSsQXvdIv2Lp6xzdQ0VSXPcLIhULPOYrmBKnGQ/NjXTIZXxnroyQxxnI6xyEWIZwiHRY/bKRJDRbQTxD9NL32szKiDSwnw7pu6llF4D64UqQvziq4Gm6VohU75M= - secure: St/fecUDInFBCRriYqgp2F8PU9/SooorgxD9Mrs+b0EsC7AbtSsQXvdIv2Lp6xzdQ0VSXPcLIhULPOYrmBKnGQ/NjXTIZXxnroyQxxnI6xyEWIZwiHRY/bKRJDRbQTxD9NL32szKiDSwnw7pu6llF4D64UqQvziq4Gm6VohU75M=
- secure: bD15GVZWowiknbfLavh8CxSh0GsnF5kT4kZ6ggCuUDGyj0mzqf7dNRnchQIKkCG0WRYyTrFN4pEiygeywWsipEeAVv9Xhx3cuUZmzeQaR5KCWabSwJ8gK6jZd1YhcWmM9vrdPHobZr65MP0y/8mu/Fovgky9dY7KDf4G3SebNrM= - secure: bD15GVZWowiknbfLavh8CxSh0GsnF5kT4kZ6ggCuUDGyj0mzqf7dNRnchQIKkCG0WRYyTrFN4pEiygeywWsipEeAVv9Xhx3cuUZmzeQaR5KCWabSwJ8gK6jZd1YhcWmM9vrdPHobZr65MP0y/8mu/Fovgky9dY7KDf4G3SebNrM=
- PARABOT_VERSION=2.6.2 - PARABOT_VERSION=2.6.4
cache: cache:
directories: directories:
+18 -16
View File
@@ -3,23 +3,28 @@
# Parabot # 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 #### Compilation
You'll need the [libraries](https://github.com/Parabot/Parabot/tree/master/libs) in order to compile parabot successfully. Build the project with the Maven POM file to have all required libraries installed.
The POM file contains the redirection to the libraries, so simply install them with Maven.
#### 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 #### Issues
If you've an issues regarding the bot itself, please report them [here](https://github.com/Parabot/Parabot/issues). If you've an issues regarding the bot itself, please report them [here](https://github.com/Parabot/Parabot/issues).
#### Maven #### Maven
Parabot supports Maven as of September 2015. All information is included in the POM.xml. To add the client as a library, you'll first have to add our repository to your `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:
``` ```
<repositories> <repositories>
<repository> <repository>
@@ -28,22 +33,19 @@ If you'd like to have either or both the client and the API in your project, use
<url>https://maven.parabot.org/</url> <url>https://maven.parabot.org/</url>
</repository> </repository>
</repositories> </repositories>
```
Then you'll need to add the dependency:
```
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>client</artifactId> <artifactId>client</artifactId>
<version>2.6</version> <version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.parabot</groupId>
<artifactId>317provider</artifactId>
<version>1.14</version>
</dependency> </dependency>
</dependencies> </dependencies>
``` ```
**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
Labels are created with [GHLabel](https://github.com/jimmycuadra/ghlabel), whereas the yml is located in the .github directory Labels are created with [GHLabel](https://github.com/jimmycuadra/ghlabel), whereas the yml is located in the .github directory
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>client</artifactId> <artifactId>client</artifactId>
<version>2.6.3</version> <version>2.6.4</version>
<packaging>jar</packaging> <packaging>jar</packaging>
@@ -20,19 +20,18 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
private String className; private String className;
private static PrintStream str_out, class_out, dec_out; private static PrintStream str_out, class_out;
static { static {
redirects.put("java/awt/Toolkit", ToolkitRedirect.class); redirects.put("java/awt/Toolkit", ToolkitRedirect.class);
redirects.put("java/lang/Class", ClassRedirect.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/Runtime", RuntimeRedirect.class);
redirects.put("java/lang/Thread", ThreadRedirect.class); redirects.put("java/lang/Thread", ThreadRedirect.class);
redirects.put("java/lang/StackTraceElement", redirects.put("java/lang/StackTraceElement",
StackTraceElementRedirect.class); StackTraceElementRedirect.class);
redirects.put("java/lang/ProcessBuilder", ProcessBuilderRedirect.class); redirects.put("java/lang/ProcessBuilder", ProcessBuilderRedirect.class);
redirects.put("java/lang/System", SystemRedirect.class); redirects.put("java/lang/System", SystemRedirect.class);
redirects.put("java/io/File", FileRedirect.class);
} }
public RedirectClassAdapter(ClassVisitor cv) { public RedirectClassAdapter(ClassVisitor cv) {
@@ -40,17 +39,13 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
if (str_out == null && Core.shouldDump()) if (str_out == null && Core.shouldDump())
try { try {
str_out = new PrintStream(new FileOutputStream(new File(Directories.getWorkspace(),"strings.txt"))); 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) { } catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
if(class_out == null && Core.shouldDump()) if(class_out == null && Core.shouldDump())
try { try {
class_out = new PrintStream(new FileOutputStream(new File(Directories.getWorkspace(),"classes.txt"))); class_out = new PrintStream(new FileOutputStream(new File(Directories.getWorkspace(),"classes.txt")));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }
@@ -92,32 +87,30 @@ public class RedirectClassAdapter extends ClassVisitor implements Opcodes {
public void visitLdcInsn(Object o) { public void visitLdcInsn(Object o) {
if (o instanceof String && str_out != null) { if (o instanceof String && str_out != null) {
str_out.println(className + " " + o); str_out.println(className + " " + o);
if (!className.toLowerCase().contains("parabot")) {
dec_out.println(o + ":");
dec_out.println();
}
} }
super.visitLdcInsn(o); super.visitLdcInsn(o);
} }
@Override @Override
public void visitMethodInsn(int opcode, String owner, String name, public void visitMethodInsn(int opcode, String owner, String name,
String desc) { String desc, boolean itf) {
if (Core.isSecure()) { if (Core.isSecure()) {
if (redirects.containsKey(owner) && !name.equals("<init>") if (redirects.containsKey(owner) && !name.equals("<init>")
&& !name.equals("<clinit>")) { && !name.equals("<clinit>")) {
if (opcode != INVOKESTATIC) if (opcode != INVOKESTATIC) {
desc = "(L" + owner + ";" + desc.substring(1); desc = "(L" + owner + ";" + desc.substring(1);
}
opcode = INVOKESTATIC; opcode = INVOKESTATIC;
owner = redirects.get(owner).getName() owner = redirects.get(owner).getName()
.replaceAll("\\.", "/"); .replaceAll("\\.", "/");
} }
} }
if(class_out != null) if(class_out != null) {
class_out.println(owner); class_out.println(owner);
}
super.visitMethodInsn(opcode, owner, name, desc); super.visitMethodInsn(opcode, owner, name, desc, itf);
} }
@Override @Override
@@ -1,15 +1,53 @@
package org.parabot.core.asm.redirect; package org.parabot.core.asm.redirect;
import org.parabot.core.Core;
import org.parabot.core.asm.RedirectClassAdapter; 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){ public static Class<?>loadClass(ClassLoader c,String name){
throw RedirectClassAdapter.createSecurityException(); throw RedirectClassAdapter.createSecurityException();
} }
static int count = 0;
public static ClassLoader getParent(ClassLoader c){ public static ClassLoader getParent(ClassLoader c){
throw RedirectClassAdapter.createSecurityException(); 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<URL> 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) {
}
} }
@@ -21,6 +21,7 @@ public class ClassRedirect {
if (validStack()) { if (validStack()) {
return c.getDeclaredField(s); return c.getDeclaredField(s);
} }
System.out.println(c.getName() + "." + c.getDeclaredField(s) + " Blocked."); System.out.println(c.getName() + "." + c.getDeclaredField(s) + " Blocked.");
throw RedirectClassAdapter.createSecurityException(); throw RedirectClassAdapter.createSecurityException();
} }
@@ -29,6 +30,7 @@ public class ClassRedirect {
if (validStack()) { if (validStack()) {
return c.getDeclaredMethod(name, params); return c.getDeclaredMethod(name, params);
} }
System.out.println(c.getName() + "#" + c.getDeclaredMethod(name, params) + " Blocked."); System.out.println(c.getName() + "#" + c.getDeclaredMethod(name, params) + " Blocked.");
throw RedirectClassAdapter.createSecurityException(); throw RedirectClassAdapter.createSecurityException();
} }
@@ -6,24 +6,36 @@ import java.io.IOException;
public class RuntimeRedirect { public class RuntimeRedirect {
public static Runtime getRuntime(){ public static Runtime getRuntime() {
return Runtime.getRuntime(); return Runtime.getRuntime();
} }
public static int availableProcessors(Runtime r){ public static int availableProcessors(Runtime r) {
//lol faking it, fuck ikov
return 2; return 2;
} }
public static Process exec(Runtime r,String s){ public static long totalMemory(Runtime runtime) {
if (s.contains("ping")){ 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); System.out.println("Faked attempted command: " + s);
try { try {
return r.exec("ping 127.0.0.1"); return r.exec("ping 127.0.0.1");
} catch (IOException e) { } catch (IOException e) {
throw RedirectClassAdapter.createSecurityException(); throw RedirectClassAdapter.createSecurityException();
} }
}else{ } else {
System.out.println("Blocked attempted command: " + s); System.out.println("Blocked attempted command: " + s);
throw RedirectClassAdapter.createSecurityException(); throw RedirectClassAdapter.createSecurityException();
} }
@@ -27,7 +27,10 @@ public class SystemRedirect {
String value; String value;
switch (s) { switch (s) {
case "user.home": case "user.home":
value = Directories.getHomeDir().getAbsolutePath(); value = Directories.getCachePath().getAbsolutePath();
break;
case "java.class.path":
value = ".";
break; break;
default: default:
value = System.getProperty(s); value = System.getProperty(s);
@@ -40,14 +43,20 @@ public class SystemRedirect {
String value = null; String value = null;
switch (s2) { switch (s2) {
case "user.home": case "user.home":
value = Directories.getHomeDir().getAbsolutePath(); value = Directories.getCachePath().getAbsolutePath();
break;
case "java.class.path":
value = ".";
break; break;
} }
if (value == null) { if (value == null) {
switch (s) { switch (s) {
case "user.home": case "user.home":
value = Directories.getHomeDir().getAbsolutePath(); value = Directories.getCachePath().getAbsolutePath();
break;
case "java.class.path":
value = ".";
break; break;
default: default:
value = System.getProperty(s); value = System.getProperty(s);
@@ -62,11 +71,12 @@ public class SystemRedirect {
} }
public static String setProperty(String s1, String s2) { 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); return System.setProperty(s1, s2);
} }
public static String getenv(String string) { public static String getenv(String string) {
System.out.printf("getEnv %s = %s\n", string, System.getenv(string));
return System.getenv(string); return System.getenv(string);
} }
@@ -74,7 +84,6 @@ public class SystemRedirect {
} }
public static void setErr(PrintStream printStream) { public static void setErr(PrintStream printStream) {
} }
@@ -5,6 +5,7 @@ import org.parabot.core.asm.ASMClassLoader;
import org.parabot.core.classpath.ClassPath; import org.parabot.core.classpath.ClassPath;
import org.parabot.core.reflect.RefClass; import org.parabot.core.reflect.RefClass;
import org.parabot.core.reflect.RefField; import org.parabot.core.reflect.RefField;
import org.parabot.environment.api.utils.StringUtils;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionEvent;
@@ -91,6 +92,8 @@ public class ReflectUI extends JFrame {
result = f; result = f;
} else if (value.toLowerCase().endsWith(search.toLowerCase())) { } else if (value.toLowerCase().endsWith(search.toLowerCase())) {
result = f; result = f;
} else if (value.toLowerCase().contains(search.toLowerCase())) {
result = f;
} }
} }
} }
@@ -238,6 +241,13 @@ public class ReflectUI extends JFrame {
builder.append("<b>Type: </b>").append(refField.getASMType().getClassName()).append("<br/>"); builder.append("<b>Type: </b>").append(refField.getASMType().getClassName()).append("<br/>");
builder.append("<b>Static: </b>").append(refField.isStatic() ? "yes" : "no").append("<br/>"); builder.append("<b>Static: </b>").append(refField.isStatic() ? "yes" : "no").append("<br/>");
builder.append("<b>Array: </b>").append(refField.isArray() ? refField.getArrayDimensions() + " dimension(s)" : "no").append("<br/>"); builder.append("<b>Array: </b>").append(refField.isArray() ? refField.getArrayDimensions() + " dimension(s)" : "no").append("<br/>");
if (refField.isArray() && refField.getASMType().getClassName().contains("String") && refField.getArrayDimensions() == 1) {
String[] strings = (String[]) refField.asObject();
String values = StringUtils.implode(", ", strings);
builder.append("<b>Values: </b>").append(values).append("<br/>");
}
selectionInfoPane.setText(builder.toString()); selectionInfoPane.setText(builder.toString());
fillBasicInfoPane(); fillBasicInfoPane();
@@ -28,6 +28,19 @@ public class StringUtils {
return sb.toString(); 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) { public static String randomString(final int length) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
@@ -109,7 +109,12 @@ public class RandomHandler {
for (Random r : this.activeRandoms) { for (Random r : this.activeRandoms) {
if (r.getRandomType().getId() == type.getId() && r.activate()) { if (r.getRandomType().getId() == type.getId() && r.activate()) {
Logger.addMessage("Running random '" + r.getName() + "'", true); Logger.addMessage("Running random '" + r.getName() + "'", true);
try {
r.execute(); r.execute();
}catch (Exception e){
Logger.addMessage("Random failed: '" + r.getName() + "'", false);
e.printStackTrace();
}
return true; return true;
} }
} }