Bee
2013-12-27 14:22:00
Would it work with other games such as Eldevin?
2013-12-27 14:22:00
2013-12-27 14:32:19
2013-12-27 15:14:19
2013-12-27 15:18:06
2013-12-27 18:02:00
From: Ollywhat about this?
No, it wont for the one fact that you have to post your username and such before you can even load the applet.
2013-12-27 18:19:16
From: hoodz
what about this?
http://villavu.com/forum/showthread.php?t=107109&p=1275581#post1275581
2013-12-27 19:10:48
From: Olly
Wasn't saying it's not possible, it's just not possible with the current smart..
Anyway that game didn't impress me and the fact that you want all want to bot it instantly means it's not exactly a fun game to me. :p
2013-12-27 19:14:45
2013-12-30 19:00:30
package eldevintest;
import java.io.*;
import java.net.URISyntaxException;
import java.util.*;
import org.apache.http.*;
import org.apache.http.client.*;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.DefaultRedirectStrategy;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HttpContext;
/**
*
* @author Brandon
*/
public class HttpCom {
private int responseCode = 200;
private HttpResponse response = null;
private DefaultHttpClient client = new DefaultHttpClient();
private String asString(InputStream stream) {
try {
String Line;
StringBuilder Builder = new StringBuilder();
try (BufferedReader Reader = new BufferedReader(new InputStreamReader(stream))) {
while ((Line = Reader.readLine()) != null) {
Builder.append(Line).append("\n");
}
}
return Builder.toString().trim();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private void setRedirect(DefaultHttpClient client) {
client.setRedirectStrategy(new DefaultRedirectStrategy() {
@Override
public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) throws org.apache.http.ProtocolException {
boolean isRedirect = super.isRedirected(request, response, context);
if (!isRedirect) {
int responseCode = response.getStatusLine().getStatusCode();
if (responseCode == 301 || responseCode == 302) {
return true;
}
}
return isRedirect;
}
});
}
private void doGet(HttpClient client, String address, HashMap<String, String> data) {
try {
HttpGet get = new HttpGet(address);
List<NameValuePair> params = new ArrayList<>();
if (data != null) {
Iterator<Map.Entry<String, String>> it = data.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> e = it.next();
params.add(new BasicNameValuePair(e.getKey(), e.getValue()));
}
get.setURI(new URIBuilder(get.getURI()).addParameters(params).build());
}
this.response = client.execute(get);
this.responseCode = response.getStatusLine().getStatusCode();
} catch (URISyntaxException | IOException | IllegalStateException e) {
e.printStackTrace();
}
}
private String get(HttpClient client, String address, HashMap<String, String> data) {
this.doGet(client, address, data);
try {
return this.asString(this.response.getEntity().getContent());
} catch (IOException | IllegalStateException e) {
e.printStackTrace();
}
return null;
}
private void doPost(HttpClient client, String address, HashMap<String, String> data) {
try {
HttpPost post = new HttpPost(address);
List<NameValuePair> params = new ArrayList<>();
if (data != null) {
Iterator<Map.Entry<String, String>> it = data.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> e = it.next();
params.add(new BasicNameValuePair(e.getKey(), e.getValue()));
}
post.setEntity(new UrlEncodedFormEntity(params));
}
this.response = client.execute(post);
this.responseCode = response.getStatusLine().getStatusCode();
} catch (IOException | IllegalStateException e) {
e.printStackTrace();
}
}
private String post(HttpClient client, String address, HashMap<String, String> data) {
this.doPost(client, address, data);
try {
return this.asString(this.response.getEntity().getContent());
} catch (IOException | IllegalStateException e) {
e.printStackTrace();
}
return null;
}
public String get(String address, HashMap<String, String> data, boolean followRedirect) {
if (followRedirect) {
setRedirect(this.client);
}
return get(this.client, address, data);
}
public String get(String address, HashMap<String, String> data) {
setRedirect(this.client);
return get(this.client, address, data);
}
public String post(String address, HashMap<String, String> data, boolean followRedirect) {
if (followRedirect) {
setRedirect(this.client);
}
return post(this.client, address, data);
}
public String post(String address, HashMap<String, String> data) {
setRedirect(this.client);
return post(this.client, address, data);
}
public int getResponseCode() {
return this.responseCode;
}
public HttpResponse getResponse() {
return this.response;
}
public void downloadFile(String address, String filePath, HashMap<String, String> data) {
this.doGet(client, address, data);
HttpEntity entity = this.response.getEntity();
if (entity != null) {
try {
long len = entity.getContentLength();
try (BufferedInputStream bis = new BufferedInputStream(entity.getContent()); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(filePath)))) {
int inByte;
while ((inByte = bis.read()) != -1) {
bos.write(inByte);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
package eldevintest;
import java.applet.*;
import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JApplet;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public final class ClientApplet extends JPanel implements AppletStub {
private static final long serialVersionUID = 5627929030422355843L;
private JApplet applet = null;
private URLClassLoader ClassLoader = null;
private URL codeBase = null, documentBase = null;
private HashMap<String, String> parameters = new HashMap<>();
private static final Pattern codeRegex = Pattern.compile("code=\"(.*?)\"");
private static final Pattern archiveRegex = Pattern.compile("archive=\"(.*?)\"");
private static final Pattern codebaseRegex = Pattern.compile("codebase=\"(.*?)\"");
private static final Pattern parameterRegex = Pattern.compile("<param name=\"([^\\s]+)\"\\s+value=\"([^>]*)\">");
public ClientApplet(HttpCom com, int Width, int Height) {
try {
this.setLayout(new BorderLayout(0, 0));
String pageSource = com.get("https://www.eldevin.com/play/", null, true);
Matcher codeMatcher = codeRegex.matcher(pageSource);
Matcher codebaseMatcher = codebaseRegex.matcher(pageSource);
Matcher archiveMatcher = archiveRegex.matcher(pageSource);
if (codeMatcher.find() && codebaseMatcher.find() && archiveMatcher.find()) {
String archive = archiveMatcher.group(1);
String jarLocation = codebaseMatcher.group(1) + "/" + archive;
String code = codeMatcher.group(1).replaceAll(".class", "");
Matcher parameterMatcher = parameterRegex.matcher(pageSource);
this.codeBase = new URL(codebaseMatcher.group(1));
this.documentBase = new URL(codebaseMatcher.group(1));
while (parameterMatcher.find()) {
this.parameters.put(parameterMatcher.group(1), parameterMatcher.group(2));
}
this.ClassLoader = new URLClassLoader(new URL[]{new URL(jarLocation)});
this.applet = (JApplet) ClassLoader.loadClass(code).newInstance();
this.applet.setStub(this);
this.applet.setPreferredSize(new Dimension(Width, Height));
this.add(this.applet, BorderLayout.CENTER);
}
} catch (Exception Ex) {
Ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Error Loading.. Please Check Your Internet Connection.", "Error Loading..", JOptionPane.ERROR_MESSAGE);
}
}
public ClassLoader getClassLoader() {
return this.ClassLoader;
}
public String postRequest(URL Address, String UserAgent, HashMap<String, String> data) {
StringBuilder parameterBuilder = new StringBuilder();
Iterator<Entry<String, String>> it = data.entrySet().iterator();
int i = 0;
while(it.hasNext() && i < data.entrySet().size() - 1) {
Entry<String, String> e = it.next();
parameterBuilder.append(e.getKey()).append("=").append(e.getValue()).append("&");
++i;
}
Entry<String, String> entry = it.next();
parameterBuilder.append(entry.getKey()).append("=").append(entry.getValue());
String parameterURL = parameterBuilder.toString();
if (parameterURL == null || parameterURL.trim().isEmpty()) {
return null;
}
try {
URLConnection Connection = Address.openConnection();
Connection.addRequestProperty("Protocol", "HTTP/1.1");
Connection.addRequestProperty("Connection", "keep-alive");
Connection.addRequestProperty("Keep-Alive", "300");
if (UserAgent != null) {
Connection.addRequestProperty("User-Agent", UserAgent);
} else {
Connection.addRequestProperty("User-Agent", "Mozilla/5.0 (" + System.getProperty("os.name") + " " + System.getProperty("os.version") + ") Java/" + System.getProperty("java.version"));
}
Connection.setDoOutput(true);
try (OutputStreamWriter writer = new OutputStreamWriter(Connection.getOutputStream())) {
writer.write(parameterURL);
writer.flush();
String Line;
StringBuilder Builder = new StringBuilder();
try (BufferedReader Reader = new BufferedReader(new InputStreamReader(Connection.getInputStream()))) {
while ((Line = Reader.readLine()) != null) {
Builder.append(Line).append("\n");
}
}
return Builder.toString();
}
} catch(Exception e) {
e.printStackTrace();
}
return null;
}
public String downloadPage(URL Address, String UserAgent) {
try {
URLConnection Connection = Address.openConnection();
Connection.addRequestProperty("Protocol", "HTTP/1.1");
Connection.addRequestProperty("Connection", "keep-alive");
Connection.addRequestProperty("Keep-Alive", "300");
if (UserAgent != null) {
Connection.addRequestProperty("User-Agent", UserAgent);
} else {
Connection.addRequestProperty("User-Agent", "Mozilla/5.0 (" + System.getProperty("os.name") + " " + System.getProperty("os.version") + ") Java/" + System.getProperty("java.version"));
}
String Line;
StringBuilder Builder = new StringBuilder();
try (BufferedReader Reader = new BufferedReader(new InputStreamReader(Connection.getInputStream()))) {
while ((Line = Reader.readLine()) != null) {
Builder.append(Line).append("\n");
}
}
return Builder.toString();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public Applet getApplet() {
return this.applet;
}
public void start() {
if (this.applet != null) {
this.applet.init();
}
if (this.applet != null) {
this.applet.start();
}
}
public void destruct() {
if (this.applet != null) {
this.remove(this.applet);
this.applet.stop();
this.applet.destroy();
this.applet = null;
}
}
@Override
public boolean isActive() {
return true;
}
@Override
public URL getDocumentBase() {
return this.documentBase;
}
@Override
public URL getCodeBase() {
return this.codeBase;
}
@Override
public String getParameter(String name) {
return this.parameters.get(name);
}
@Override
public AppletContext getAppletContext() {
return null;
}
@Override
public void appletResize(int width, int height) {
}
}
void loadAndInstantiate() {
URLClassLoader cl = null;
try {
File file = new File("C:/Users/Brandon/Desktop/gbloader.jar");
String classToLoad = "gbloader/GBLoader";
URL jarUrl = new URL("file:" + file.getAbsolutePath());
cl = new URLClassLoader(new URL[]{jarUrl}, getClass().getClassLoader());
Class loadedClass = cl.loadClass(classToLoad);
Object o = loadedClass.getConstructor().newInstance();
} catch(MalformedURLException | ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
e.printStackTrace();
}
}