mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-06 16:50:39 +00:00
Moved to Maven
This commit is contained in:
@@ -42,12 +42,11 @@ public final class Landing {
|
||||
}
|
||||
|
||||
if (!Core.inDebugMode() && !Core.isValid()) {
|
||||
UILog.log(
|
||||
"Updates",
|
||||
"Please download the newest version of Parabot at " + Configuration.DOWNLOAD_BOT,
|
||||
UILog.log("Updates",
|
||||
"Please download the newest version of Parabot at "
|
||||
+ Configuration.DOWNLOAD_BOT,
|
||||
JOptionPane.INFORMATION_MESSAGE);
|
||||
URI uri = URI
|
||||
.create(Configuration.DOWNLOAD_BOT);
|
||||
URI uri = URI.create(Configuration.DOWNLOAD_BOT);
|
||||
try {
|
||||
Desktop.getDesktop().browse(uri);
|
||||
} catch (IOException e1) {
|
||||
@@ -87,14 +86,14 @@ public final class Landing {
|
||||
* @return String array with username and password
|
||||
*/
|
||||
private static String[] getCredentials() {
|
||||
// try {
|
||||
// BufferedReader bufferedReader = WebUtil.getReader(new URL(
|
||||
// Configuration.GET_PASSWORD));
|
||||
// if (bufferedReader.readLine() != null) {
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// try {
|
||||
// BufferedReader bufferedReader = WebUtil.getReader(new URL(
|
||||
// Configuration.GET_PASSWORD));
|
||||
// if (bufferedReader.readLine() != null) {
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -151,25 +150,30 @@ public final class Landing {
|
||||
new java.util.Random().nextBytes(mac);
|
||||
} else {
|
||||
i--;
|
||||
for(int j = 0; j < 6;j++){
|
||||
mac[j] = Byte.parseByte(args[++i], 16); // parses a hex number
|
||||
for (int j = 0; j < 6; j++) {
|
||||
mac[j] = Byte.parseByte(args[++i], 16); // parses a hex
|
||||
// number
|
||||
}
|
||||
}
|
||||
NetworkInterface.setMac(mac);
|
||||
break;
|
||||
case "-proxy":
|
||||
ProxyType type = ProxyType.valueOf(args[++i].toUpperCase());
|
||||
if(type == null){
|
||||
if (type == null) {
|
||||
System.err.println("Invalid proxy type:" + args[i]);
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
ProxySocket.setProxy(type, args[++i], Integer.parseInt(args[++i]));
|
||||
ProxySocket.setProxy(type, args[++i],
|
||||
Integer.parseInt(args[++i]));
|
||||
break;
|
||||
case "-auth":
|
||||
ProxySocket.auth = true;
|
||||
ProxySocket.setLogin(args[++i], args[++i]);
|
||||
break;
|
||||
case "-no_sec":
|
||||
Core.disableSec();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ public class Configuration {
|
||||
public static final String DATA_API = "http://bdn.parabot.org/api/v2/data/";
|
||||
public static final String ITEM_API = DATA_API + "items/";
|
||||
|
||||
public static final String BOT_VERSION = "2.1.3";
|
||||
public static final String BOT_VERSION = "2.2";
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@ package org.parabot.core;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.parabot.Landing;
|
||||
import org.parabot.core.ui.utils.UILog;
|
||||
import org.parabot.environment.api.utils.WebUtil;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
@@ -24,6 +28,8 @@ public class Core {
|
||||
private static boolean dump;
|
||||
private static boolean loadLocal; //Loads both local and public scripts/servers
|
||||
|
||||
private static boolean secure = true;
|
||||
|
||||
/**
|
||||
* Enabled loadLocal mode
|
||||
*
|
||||
@@ -57,6 +63,20 @@ public class Core {
|
||||
public static void setDump(final boolean dump) {
|
||||
Core.dump = dump;
|
||||
}
|
||||
|
||||
public static void disableSec(){
|
||||
UILog.log(
|
||||
"Security Warning",
|
||||
"Disabling the securty manager is ill advised.\n"
|
||||
+ " Only do so if the client fails to load, or functions incorrectly (freezes,crashes, etc.)\n"
|
||||
+ "The security manager protects you from malicous code within the client, without it you are exposed!\n"
|
||||
+ "\nPlease contact Parabot staff to resolve whatever problem you are having!");
|
||||
Core.secure = false;
|
||||
}
|
||||
|
||||
public static boolean isSecure(){
|
||||
return secure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if the client is in debug mode.
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.parabot.core;
|
||||
import org.parabot.environment.OperatingSystem;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
@@ -34,6 +35,7 @@ public class Directories {
|
||||
cached.put("Settings", new File(cached.get("Root"), "/Parabot/settings/"));
|
||||
cached.put("Servers", new File(cached.get("Root"), "/Parabot/servers/"));
|
||||
cached.put("Cache", new File(cached.get("Root"), "/Parabot/cache/"));
|
||||
cached.put("Home", new File(cached.get("Root"), "/temp/"));
|
||||
Core.verbose("Directories cached.");
|
||||
|
||||
clearCache(259200);
|
||||
@@ -135,6 +137,14 @@ public class Directories {
|
||||
public static File getCachePath() {
|
||||
return cached.get("Cache");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the redirected Home Directory
|
||||
* @return
|
||||
*/
|
||||
public static File getHomeDir() {
|
||||
return cached.get("Home");
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates all directories and makes them if necessary
|
||||
@@ -145,13 +155,7 @@ public class Directories {
|
||||
throw new RuntimeException("Default path not found");
|
||||
}
|
||||
final Queue<File> files = new LinkedList<File>();
|
||||
files.add(getWorkspace());
|
||||
files.add(getServerPath());
|
||||
files.add(getSettingsPath());
|
||||
files.add(getScriptSourcesPath());
|
||||
files.add(getScriptCompiledPath());
|
||||
files.add(getResourcesPath());
|
||||
files.add(getCachePath());
|
||||
files.addAll(cached.values());
|
||||
while (files.size() > 0) {
|
||||
final File file = files.poll();
|
||||
if (!file.exists()) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package org.parabot.core.asm;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.parabot.core.Context;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/**
|
||||
*
|
||||
* A collection of various asm util methods
|
||||
|
||||
@@ -9,7 +9,6 @@ public class ClassRemapper extends Remapper {
|
||||
static {
|
||||
remapNames.put("java/net/Socket", "org/parabot/core/network/proxy/ProxySocket");
|
||||
remapNames.put("java/net/NetworkInterface", "org/parabot/core/network/NetworkInterface");
|
||||
remapNames.put("java/lang/Runtime", "org/parabot/core/network/Runtime");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.parabot.core.asm.redirect;
|
||||
|
||||
/**
|
||||
* @author JKetelaar
|
||||
*/
|
||||
public class PreferencesRedirect {
|
||||
}
|
||||
@@ -37,7 +37,6 @@ public class Getter implements Injectable {
|
||||
public Getter(final String into, final String fieldLocation, final String fieldNode,
|
||||
final String methodName, final String returnDesc, final boolean staticMethod, final long multiplier,
|
||||
final String fieldDesc) {
|
||||
Core.verbose(methodName + "[" + fieldLocation + "." + fieldNode + "]");
|
||||
this.into = ASMUtils.getClass(into);
|
||||
this.fieldLocation = ASMUtils.getClass(fieldLocation);
|
||||
this.fieldNode = ASMUtils.getField(ASMUtils.getClass(fieldLocation), fieldNode, fieldDesc);
|
||||
@@ -45,6 +44,7 @@ public class Getter implements Injectable {
|
||||
this.returnDesc = returnDesc == null ? this.fieldNode.desc : returnDesc;
|
||||
this.staticMethod = staticMethod;
|
||||
this.multiplier = multiplier;
|
||||
Core.verbose(methodName + "[" + fieldLocation + "." + fieldNode + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.objectweb.asm.commons.RemappingClassAdapter;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.parabot.core.Directories;
|
||||
import org.parabot.core.asm.ClassRemapper;
|
||||
import org.parabot.core.asm.RedirectClassAdapter;
|
||||
import org.parabot.core.build.BuildPath;
|
||||
import org.parabot.core.io.SizeInputStream;
|
||||
import org.parabot.core.ui.components.VerboseLoader;
|
||||
@@ -198,7 +199,8 @@ public class ClassPath {
|
||||
ClassReader cr = new ClassReader(in);
|
||||
ClassNode cn = new ClassNode();
|
||||
RemappingClassAdapter rca = new RemappingClassAdapter(cn,classRemapper);
|
||||
cr.accept(rca, ClassReader.EXPAND_FRAMES);
|
||||
RedirectClassAdapter redir = new RedirectClassAdapter(rca);
|
||||
cr.accept(redir, ClassReader.EXPAND_FRAMES);
|
||||
classNames.add(cn.name.replace('/', '.'));
|
||||
classes.put(cn.name, cn);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user