SRL Archive - Java Help and Tutorials

Runescape Loader.


Wyn

2012-01-03 00:39:52

Meh, was sick of using Jagex's crap client to play. Should I release?



weequ

2012-01-03 01:00:06

Cool. Did you make it all by yourself? Does it use a crawler to get the client width, height etc? I would love to learn to make my own loader. If you release it please release the source code too ;)

YoHoJo

2012-01-03 01:05:42

Windows classic theme with plain blue background. I love you.
Also, umm if it doesn't do anything extra or special then why release? Just for a simple standalone barebones client option?
Anyways, GOOD WORK BORH! What kind of stuff is involved in making something like that?

Main

2012-01-03 01:13:03

If its fast and simple and small and smart reable, i'll take a copy:P Also if you could add a option to always ontop that'd be sexy as hell.

aerrow107

2012-01-03 01:39:28

oh i also like a copy!
also adding a run java script option would be too perfect!

ShawnjohnSJ

2012-01-03 02:54:08

From: YoHoJo
Windows classic theme with plain blue background. I love you.
Also, umm if it doesn't do anything extra or special then why release? Just for a simple standalone barebones client option?
Anyways, GOOD WORK BORH! What kind of stuff is involved in making something like that?


A bare bones loader simply requires you to fetch the client from the webpage and display it on a GUI. If you're interested in what he's done, Google "Java class loading" and "Java AppletStub". :redface:

Wyn

2012-01-03 03:45:54

From: weequ
Cool. Did you make it all by yourself? Does it use a crawler to get the client width, height etc? I would love to learn to make my own loader. If you release it please release the source code too ;)



applet.setPreferredSize(new Dimension(763, 504));

:D


I'll clean it up and release soon.

Yago

2012-01-03 16:35:21

If it runs smoother then a browser i will love you… I hate those stupid jagex ads.

Richard

2012-01-03 19:35:06

From: ShawnjohnSJ
A bare bones loader simply requires you to fetch the client from the webpage and display it on a GUI. If you're interested in what he's done, Google "Java class loading" and "Java AppletStub". :redface:


I swear it isn't that simple anymore. Because the jar file no longer easy to access, you have to "load" the page and then load the applet using the information found when you tell the server you don't have Javascript, and are able to load all of the information by using or extending appletstub.

Brilliant job though, loaders aren't as easy as they used to be. If you find a good way of capturing the image without having to have the window visible, I'd love to know about it. I've tried putting a canvas over it and getting the graphics, but nothing seems to work…

weequ

2012-01-03 20:52:44

Would it be difficult to write a listener for received network packets? How about sending packets to the server?

Mark

2012-01-03 20:59:41

From: weequ
Would it be difficult to write a listener for received network packets? How about sending packets to the server?


there's a tool that does that not sure if this is what you meen but its called WPEpro

weequ

2012-01-03 21:21:47

From: CRU1Z1N
there's a tool that does that not sure if this is what you meen but its called WPEpro
Yes that's what I have been using but you can't make it like click mouse/send packet after receiving a certain packet.

Edit: Also I've been wondering if it's possible to fool the client to give the encryption of a certain size of packet.
Here is some packets that all do the same thing

67 0D 00 00 01 F5 00 00 00 00 00 05 21 97 B0
8B 0D 00 00 01 F6 00 00 00 00 08 8D 6E 6D 2C
D8 0D 00 00 01 F7 00 00 00 00 00 48 E9 36 BB
00 0D 00 00 01 F9 00 00 00 00 00 72 E3 57 CB
CD 0D 00 00 01 FA 00 00 00 00 10 E9 C0 35 01
C4 0D 00 00 01 FB 00 00 00 00 00 3F 2B F6 C0
A0 0D 00 00 01 FC 00 00 00 00 50 49 45 97 8C
1E 0D 00 00 01 FD 00 00 00 00 18 FA 1E 8D 8B
D9 0D 00 00 01 FF 00 00 00 00 08 AA 61 3C E4
B4 0D 00 00 02 00 00 00 00 00 08 7F 4D 8D B5
B1 0D 00 00 02 01 00 00 00 00 00 BA CA D6 22
F6 0D 00 00 02 02 00 00 00 00 08 32 85 2C BE
EE 0D 00 00 02 05 00 00 00 00 00 21 5B 94 34
DC 0D 00 00 02 06 00 00 00 00 12 54 76 97 D2
AF 0D 00 00 02 07 00 00 00 00 18 7F FF AD 69
40 0D 00 00 02 09 00 00 00 00 18 45 F5 CC 19
00 0D 00 00 02 0A 00 00 00 00 18 C3 61 BE B7
F8 0D 00 00 02 0B 00 00 00 00 00 1B 51 F5 44
BF 0D 00 00 02 0C 00 00 00 00 08 08 8F 4D CE
E5 0D 00 00 02 0D 00 00 00 00 08 C3 D3 9E 6B
As you can see some parts of the packet do change every time. Those are the encryption. The encryption is always in the same places when the packets are the same size(as long).

So if the client sent the server like 'attack cow' packet and 'attack goblin' packet was the same size we could simply modify the parts of the packet that are not encrypted and the server would accept it and you would attack a goblin instead. I have successfully manged to filter a packet to open notes when i click report abuse button with WPEPro. If you send the server a packet with wrong encryption you will get connection lost.

Mark

2012-01-03 21:44:15

I have only messed around with this on RSPS made a thieving bot with it played around with the filters could get it to accept many packets myself

Method

2012-01-03 21:47:59

From: weequ
As you can see some parts of the packet do change every time. Those are the encryption. The encryption is always in the same places when the packets are the same size(as long).


If the protocol hasn't change extensively in the last few revisions, the only encrypted parts of the game connection are packet opcodes. That should be the first byte in a packet (or possibly the first two if it's a packet the client is receiving from the server).

From: weequ
So if the client sent the server like 'attack cow' packet and 'attack goblin' packet was the same size we could simply modify the parts of the packet that are not encrypted and the server would accept it and you would attack a goblin instead. I have successfully manged to filter a packet to open notes when i click report abuse button with WPEPro. If you send the server a packet with wrong encryption you will get connection lost.


The packets for attacking any npc (or really, interacting with any npc using the first menu option) have the same structure. The differences lie in the values of fields in the packet. I don't remember exactly which values are sent to the server, but I'd imagine that the npc's index is sent, at the very least. It's not feasible to try this man-in-the-middle approach, though, since you won't be able to identify different packet types and send proper data without having access to the client's internals.

weequ

2012-01-03 21:57:49

The packets for attacking any npc (or really, interacting with any npc using the first menu option) have the same structure. The differences lie in the values of fields in the packet. I don't remember exactly which values are sent to the server, but I'd imagine that the npc's index is sent, at the very least. It's not feasible to try this man-in-the-middle approach, though, since you won't be able to identify different packet types and send proper data without having access to the client's internals.
The packets with the same size always have the same structure encryption wise.

If the length is 15 then the first, fifth, 6th, 11th, 12th, 13th, 14th and 15th seem to be encryption.

If the length is 16 then first, fourth,(fifth?), sixth, 8th

I was wondering if it was possible to send proper data according to received packets? Or were you talking about the encryption parts?

Method

2012-01-03 22:02:26

From: weequ
The packets with the same size always have the same structure encryption wise.

If the length is 15 then the first, fifth, 6th, 11th, 12th, 13th, 14th and 15th seem to be encryption.

If the length is 16 then first, fourth,(fifth?), sixth, 8th


Again, only one byte in outgoing (client-to-server) packets is encrypted.

From: weequ
I was wondering if it was possible to send proper data according to received packets? Or were you talking about the encryption parts?


You won't be able to locate the packet opcode, apply the stream cipher to it, or format the packet correctly without having access to the client's internals or running an artificial client yourself. So no, you can't make something like this work well, if at all.

weequ

2012-01-03 22:07:10

From: Method
Again, only one byte in outgoing (client-to-server) packets is encrypted.
Ok but how do you explain the packets that I posted before? They were client-to-server. Btw how you think they made this bot? http://www.youtube.com/watch?v=Ihpw1eF7Ep4

Method

2012-01-03 22:15:50

From: weequ
Ok but how do you explain the packets that I posted before? They were client-to-server.


You probably were looking at multiple packets and treating them as a single packet.

From: weequ
Btw how you think they made this bot? http://www.youtube.com/watch?v=Ihpw1eF7Ep4


I don't think the server informs clients about items until they're able to see them. Perhaps the video was fake or staged. It's also possible that the protocol has changed, but that seems rather unlikely.

ShawnjohnSJ

2012-01-03 22:19:35

From: Richard
I swear it isn't that simple anymore. Because the jar file no longer easy to access, you have to "load" the page and then load the applet using the information found when you tell the server you don't have Javascript, and are able to load all of the information by using or extending appletstub.

Brilliant job though, loaders aren't as easy as they used to be. If you find a good way of capturing the image without having to have the window visible, I'd love to know about it. I've tried putting a canvas over it and getting the graphics, but nothing seems to work…


Well, you've always had to parse the data from the webpage. Only this time you're parsing it from javascript statements instead of HTML.
Congratulations on your loader though, it looks nice and its a fun project.

weequ

2012-01-03 22:20:05

From: Method
You probably were looking at multiple packets and treating them as a single packet.



I don't think the server informs clients about items until they're able to see them. Perhaps the video was fake or staged. It's also possible that the protocol has changed, but that seems rather unlikely.
I made that video and it's 100% real. And you were able to get the info with reflection. (Atleast a little outside of your minimap)

Method

2012-01-03 22:22:03

From: weequ
I made that video and it's 100% real. And you were able to get the info with reflection. (Atleast a little outside of your minimap)


I should probably clarify what I meant by "until they're able to see them". I meant "see them" in the sense that they can be picked up by anyone, not just the player who dropped the item. Does that not happen after a minute or two anymore?

weequ

2012-01-03 22:22:57

From: Method
I should probably clarify what I meant by "until they're able to see them". I meant "see them" in the sense that they can be picked up by anyone, not just the player who dropped the item. Does that not happen after a minute or two anymore?
Ah dropped items spawn instantly in the wilderness.

Method

2012-01-03 22:25:46

From: weequ
Ah dropped items spawn instantly in the wilderness.


In that case, then, it seems like everything is working as it should. The client knows about items throughout its local map area (generally 104x104 tiles, I believe), so it's feasible that the server would inform a client about an item just outside of its viewport. Any bot that has access to the client or is emulating the client would be able to detect that, and that looks like what you experienced.

Helper

2012-01-03 22:26:29

put it on fixed ?

weequ

2012-01-03 22:28:59

From: Method
In that case, then, it seems like everything is working as it should. The client knows about items throughout its local map area (generally 104x104 tiles, I believe), so it's feasible that the server would inform a client about an item just outside of its viewport. Any bot that has access to the client or is emulating the client would be able to detect that, and that looks like what you experienced.
The point of that video was that they 'click' collect before they can even see the item. Watch them instantly stop when I collect the item. My point is that that bot doesn't seem to actually use clicking. Should be super easy for jagex to detect though.

quazzymodem

2012-01-03 23:21:28

From: weequ
The point of that video was that they 'click' collect before they can even see the item. Watch them instantly stop when I collect the item. My point is that that bot doesn't seem to actually use clicking. Should be super easy for jagex to detect though.


all hope of packet based botting ended with rs2.

If you ever used arga, it had the same ability as the bots in the video, and I'm pretty sure that is what you saw there. More or less the bot interfaced with the client to act as if it right clicked and clicked pick up as soon as the item was detected. I remember the actual method used for scripting this was really nice for opening doors around the game ahaha

weequ

2012-01-03 23:26:25

From: quazzymodem
all hope of packet based botting ended with rs2.

If you ever used arga, it had the same ability as the bots in the video, and I'm pretty sure that is what you saw there. More or less the bot interfaced with the client to act as if it right clicked and clicked pick up as soon as the item was detected. I remember the actual method used for scripting this was really nice for opening doors around the game ahaha
Ok thanks for the response :)

Btw when was arga around? I can only hardly remember the name.

quazzymodem

2012-01-03 23:36:00

It was the first working bot after the earlier 'clusterfutter' that killed aryan. I think it was Taois who developed it, I know PplSuqBlz was involved with the client interfacing aspects.

weequ

2012-01-03 23:42:42

From: quazzymodem
It was the first working bot after the earlier 'clusterfutter' that killed aryan. I think it was Taois who developed it, I know PplSuqBlz was involved with the client interfacing aspects.
Cool. I remember using aryan but I have no-idea how it worked. Please tell me if you know ;)

chandlerethan

2012-01-04 09:57:31

To the OP: If you could, I would like a copy of the source so that I can learn how to make a loader. (I learn by reading and doing) Especially since I'm in college to be a programmer and programming is my passion. If you would send me a link to the source I would be forever grateful. Thanks,
Chandlerethan.
BTW If you do send me a link, I swear under oath to not disclose the link or any of the contents to ANYONE AT ALL.

BGXD

2012-01-04 10:44:06

nice work!

Failure

2012-01-04 10:59:59

I'm quite sure whenever you send a packet with WPE Pro into Runescape you get a disconnect, therefore impossible? Correct me when I'm wrong, I tried to send sometimes a packet and disconnected.

quazzymodem

2012-01-04 12:03:35

Aryan was basically the first well working injection bot, the update that killed it required a new way to deob the client (very similar to clusterfutter) but the bot I was talking about was ARGA and if i remember correctly that spawned a few other communities like rs-resources that eventually lead to rsbot (pre powerbot days, different devs) ? They were in direct competition with impsoft (which had a very very shitty bot at the time) with that competition it allowed for lots of nice innovations to be made. Someone even wrote a script that allowed others to write really simple scripts for arga..scripts kinda looked like this if you had this plugin script thingy

Login (details)
Walk to (xx,yy)
Cut tree (type)
Bank (locatin)
Repeat

the best part was it worked almost flawlessly too :P

DaWu

2012-01-04 12:40:21

From: quazzymodem
It was the first working bot after the earlier 'clusterfutter' that killed aryan. I think it was Taois who developed it, I know PplSuqBlz was involved with the client interfacing aspects.


Taios and Zappacky.

But umm, about rs2 ending packet based botting, I believe you are wrong, RSDemon was (to my knowledge) 100% packet based and it pretty much raped the F2P trees for around a year.

And what you referring to above in your last post, would be textscript -engine, textscript was widely supported form of script in RS1 bots.

yakkyigooconroy

2012-01-04 12:53:41

It would be great for a release, or even a customizable release that has other things incorporated into it

kinda like swiftkit but better cuz its SRL :P

also wondering is it possible to code the java for possible a mobile runescape client that we could actually play?!

Swatarianess

2012-01-04 14:11:08

:P barebone client for rs would be faster then Firefox and other browsers and also swiftkit :/ Would be awesome to release ^^ i'd make side part for Text like Notepad thingy :p

LemonHaze

2012-01-04 14:14:46

nice!
Yes you should release it :p

doublex8

2012-01-04 14:20:58

I'd love to use it as well.

Wyn

2012-01-04 16:51:52

Source with runnable jar attached.

Have fun.

Kajutsky

2012-01-04 17:48:38

why is jagexs client bad? i use it all the time and its pretty good

Wyn

2012-01-04 18:56:24

From: dgpro
why is jagexs client bad? i use it all the time and its pretty good



I dislike installers and It isn't portable.

Swatarianess

2012-01-05 08:42:46

From: wyn10
I dislike installers and It isn't portable.


also its made by jagex and kinda bulky and not very trusting :/

/ot

Thanks :D now i can have one more free tab on Firefox! ^^

also about the coding you make the client seem as if it is Firefox to the client if i'm not mistaken becuase of that update RS did about only allowing certain Clients and browsers to run the Java Client right? (client or something .jar?)



edit: 0.0

Wyn

2012-01-05 23:49:15

From: bro433
also its made by jagex and kinda bulky and not very trusting :/

/ot

Thanks :D now i can have one more free tab on Firefox! ^^

also about the coding you make the client seem as if it is Firefox to the client if i'm not mistaken becuase of that update RS did about only allowing certain Clients and browsers to run the Java Client right? (client or something .jar?)



edit: 0.0


You need JDK 7.

http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u2-download-1377129.html

If that still doesn't solve your problem just compile it yourself. :spot:

About the http headers its do to looking legit when grabbing/Loading the Loader. So if Jagex happens to at me up, to them I am using firefox and not a jar.

weequ

2012-01-05 23:51:35

I have same error as Bro433. I think your manifest file is wrong somehow.

From: bro433
also about the coding you make the client seem as if it is Firefox to the client if i'm not mistaken becuase of that update RS did about only allowing certain Clients and browsers to run the Java Client right?
It uses the same user agent that firefox uses. Search for "addRequestProperty" in the source code.

Edit: Also wyn do you think it matters if I don't load the splash2 image at all? Would that be detectable? (Making my own loader)

Wyn

2012-01-06 00:18:44

From: weequ
I have same error as Bro433. I think your manifest file is wrong somehow.

It uses the same user agent that firefox uses. Search for "addRequestProperty" in the source code.

Edit: Also wyn do you think it matters if I don't load the splash2 image at all? Would that be detectable? (Making my own loader)


Hmm. I'll try using a different Ide for making the Jar then..(Used Eclipse)

The splash image was for giggles, if your using mine as a base be nice if you left me credit…:D

Tell me if this works…Used BlueJ instead to make the jar…

weequ

2012-01-06 00:25:21

From: wyn10
Hmm. I'll try using a different Ide for making the Jar then..(Used Eclipse)

The splash image was for giggles, if your using mine as a base be nice if you left me credit…:D

Tell me if this works…Used BlueJ instead to make the jar…
Well I wouldn't say I used yours as a base but it helped me enormously.

Here is my loader. (Got to clean it up and maybe add Exception handling).

import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFrame;


public class Main extends JFrame {

URL codebase = null;
private Map<String, String> parameters = new HashMap<String, String>();
private JButton userInput;


public Main() throws Exception {
setTitle("Weequ's runescape loader");
setLayout(new GridLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
setPreferredSize(new Dimension(840, 680));
pack();
Applet applet = prepareApplet();
add(applet);
System.out.println(applet.toString());
pack();
setVisible(true);
Component[] ca = applet.getComponents();
for (Component c : ca) {
System.out.println(c.toString());
}
}


public String getLink() throws Exception{

URL url = new URL("http://www.runescape.com/game.ws?j=1");
System.out.println("Parsing "+url.toString());
URLConnection spoof = url.openConnection();
//Spoof the connection so we look like a web browser
spoof.addRequestProperty("Host", url.getHost());
spoof.addRequestProperty("Connection", "keep-alive");
spoof.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7");
spoof.addRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
spoof.addRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
spoof.addRequestProperty("Accept-Language", "fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4");
spoof.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
BufferedReader in = new BufferedReader(new InputStreamReader(spoof.getInputStream()));
String strLine = "";
while ((strLine = in.readLine()) != null){
int index = strLine.indexOf("\"game\" src=\"");
if (index == -1) continue;
for (int index2 = index+12; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '"') return strLine.substring(index+12, index2);
}
}
System.out.println("Failed parsin the link from http://www.runescape.com/game.ws?j=1");
return null;
}

public String getArchive(String link) throws Exception {
if (link == null) return null;
System.out.println("Found the link. Parsing "+link);
URL url = new URL(link);
URLConnection spoof = url.openConnection();
spoof.addRequestProperty("Host", url.getHost());
spoof.addRequestProperty("Connection", "keep-alive");
spoof.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7");
spoof.addRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
spoof.addRequestProperty("Referer", "http://www.runescape.com/game.ws?j=1");
spoof.addRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
spoof.addRequestProperty("Accept-Language", "fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4");
spoof.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
BufferedReader in = new BufferedReader(new InputStreamReader(spoof.getInputStream()));
String result = null;
String strLine = "";
while ((strLine = in.readLine()) != null){
if (result == null) {
int index = strLine.indexOf("archive=");
if (index == -1) continue;
for (int index2 = index+8; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '\'') result = strLine.substring(index+8, index2);
}
} else {
int index = strLine.indexOf("<param name=\"");
if (index == -1) continue;
String key = null;
for (int index2 = index+13; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '"') {
key = strLine.substring(index+13, index2);
break;
}
}
if (key == null) continue;
index = strLine.indexOf("value=\"");
if (index == -1) continue;
String value = null;
for (int index2 = index+7; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '"') {
value = strLine.substring(index+7, index2);
break;
}
}
if (value == null) continue;
parameters.put(key, value);
}
}
System.out.println(result);
if (result == null) System.out.println("Failed to find gamepack from "+link);
return result;
}

public final Applet prepareApplet() throws Exception {
String link = getLink();
String archive = getArchive(link);
URL gamepack = new URL("http://"+new URL(link).getHost()+"/"+archive);
codebase = new URL("http://"+gamepack.getHost());
System.out.println("Loading the client with these parameters:");
System.out.println(parameters.toString());
final Applet applet = (Applet) new URLClassLoader(
new URL[] {gamepack})
.loadClass("Rs2Applet").newInstance();
System.out.println("Client loaded. Setting AppletStub.");
AppletStub stub = new AppletStub() {

@Override
public boolean isActive() {
System.out.println("Applet requested isActive.");
return true;
}

@Override
public URL getDocumentBase() {
System.out.println("Applet requested DocumentBase. Returned "+codebase.toString());
return codebase;
}

@Override
public URL getCodeBase() {
System.out.println("Applet requested CodeBase. Returned "+codebase.toString());
return codebase;
}

@Override
public String getParameter(String name) {
String result = parameters.get(name);
System.out.println("Applet requested parameter name \""+name+"\". Returned "+result);
System.out.println("Applet requested DocumentBase. Returned "+codebase.toString());
return result;
}

@Override
public AppletContext getAppletContext() {
System.out.println("Applet requested AppletContext.");
return null;
}

@Override
public void appletResize(int width, int height) {
System.out.println("Applet requested to set the applet size to ("+width+", "+height+"). Doing so.");
applet.setSize(width, height);
}
};
applet.setStub(stub);
System.out.println("AppletStub set! Initializing applet.");
applet.init();
System.out.println("Applet Initialized! Starting applet.");
applet.start();
System.out.println("Applet Started!");
return applet;
}

public static void main(String[] args) throws Exception{
new Main();
}
}
Ah btw that's for finnish users because of this
spoof.addRequestProperty("Accept-Language", "fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4");


Edit: your v2 didn't work.

Wyn

2012-01-06 00:36:58

From: weequ
Well I wouldn't say I used yours as a base but it helped me enormously.

Here is my loader. (Got to clean it up and maybe add Exception handling).

import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFrame;


public class Main extends JFrame {

URL codebase = null;
private Map<String, String> parameters = new HashMap<String, String>();
private JButton userInput;


public Main() throws Exception {
setTitle("Weequ's runescape loader");
setLayout(new GridLayout());
setDefaultCloseOperation(EXIT_ON_CLOSE);
setPreferredSize(new Dimension(840, 680));
pack();
Applet applet = prepareApplet();
add(applet);
System.out.println(applet.toString());
pack();
setVisible(true);
Component[] ca = applet.getComponents();
for (Component c : ca) {
System.out.println(c.toString());
}
}


public String getLink() throws Exception{

URL url = new URL("http://www.runescape.com/game.ws?j=1");
System.out.println("Parsing "+url.toString());
URLConnection spoof = url.openConnection();
//Spoof the connection so we look like a web browser
spoof.addRequestProperty("Host", url.getHost());
spoof.addRequestProperty("Connection", "keep-alive");
spoof.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7");
spoof.addRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
spoof.addRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
spoof.addRequestProperty("Accept-Language", "fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4");
spoof.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
BufferedReader in = new BufferedReader(new InputStreamReader(spoof.getInputStream()));
String strLine = "";
while ((strLine = in.readLine()) != null){
int index = strLine.indexOf("\"game\" src=\"");
if (index == -1) continue;
for (int index2 = index+12; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '"') return strLine.substring(index+12, index2);
}
}
System.out.println("Failed parsin the link from http://www.runescape.com/game.ws?j=1");
return null;
}

public String getArchive(String link) throws Exception {
if (link == null) return null;
System.out.println("Found the link. Parsing "+link);
URL url = new URL(link);
URLConnection spoof = url.openConnection();
spoof.addRequestProperty("Host", url.getHost());
spoof.addRequestProperty("Connection", "keep-alive");
spoof.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7");
spoof.addRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
spoof.addRequestProperty("Referer", "http://www.runescape.com/game.ws?j=1");
spoof.addRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
spoof.addRequestProperty("Accept-Language", "fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4");
spoof.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
BufferedReader in = new BufferedReader(new InputStreamReader(spoof.getInputStream()));
String result = null;
String strLine = "";
while ((strLine = in.readLine()) != null){
if (result == null) {
int index = strLine.indexOf("archive=");
if (index == -1) continue;
for (int index2 = index+8; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '\'') result = strLine.substring(index+8, index2);
}
} else {
int index = strLine.indexOf("<param name=\"");
if (index == -1) continue;
String key = null;
for (int index2 = index+13; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '"') {
key = strLine.substring(index+13, index2);
break;
}
}
if (key == null) continue;
index = strLine.indexOf("value=\"");
if (index == -1) continue;
String value = null;
for (int index2 = index+7; index2 < strLine.length(); index2++) {
if (strLine.charAt(index2) == '"') {
value = strLine.substring(index+7, index2);
break;
}
}
if (value == null) continue;
parameters.put(key, value);
}
}
System.out.println(result);
if (result == null) System.out.println("Failed to find gamepack from "+link);
return result;
}

public final Applet prepareApplet() throws Exception {
String link = getLink();
String archive = getArchive(link);
URL gamepack = new URL("http://"+new URL(link).getHost()+"/"+archive);
codebase = new URL("http://"+gamepack.getHost());
System.out.println("Loading the client with these parameters:");
System.out.println(parameters.toString());
final Applet applet = (Applet) new URLClassLoader(
new URL[] {gamepack})
.loadClass("Rs2Applet").newInstance();
System.out.println("Client loaded. Setting AppletStub.");
AppletStub stub = new AppletStub() {

@Override
public boolean isActive() {
System.out.println("Applet requested isActive.");
return true;
}

@Override
public URL getDocumentBase() {
System.out.println("Applet requested DocumentBase. Returned "+codebase.toString());
return codebase;
}

@Override
public URL getCodeBase() {
System.out.println("Applet requested CodeBase. Returned "+codebase.toString());
return codebase;
}

@Override
public String getParameter(String name) {
String result = parameters.get(name);
System.out.println("Applet requested parameter name \""+name+"\". Returned "+result);
System.out.println("Applet requested DocumentBase. Returned "+codebase.toString());
return result;
}

@Override
public AppletContext getAppletContext() {
System.out.println("Applet requested AppletContext.");
return null;
}

@Override
public void appletResize(int width, int height) {
System.out.println("Applet requested to set the applet size to ("+width+", "+height+"). Doing so.");
applet.setSize(width, height);
}
};
applet.setStub(stub);
System.out.println("AppletStub set! Initializing applet.");
applet.init();
System.out.println("Applet Initialized! Starting applet.");
applet.start();
System.out.println("Applet Started!");
return applet;
}

public static void main(String[] args) throws Exception{
new Main();
}
}
Ah btw that's for finnish users because of this
spoof.addRequestProperty("Accept-Language", "fi-FI,fi;q=0.8,en-US;q=0.6,en;q=0.4");


Edit: your v2 didn't work.


Runs nicely, don't forget to center the window and Frame it :P

And if V2 didn't work make me a jar :D. Cause both run fine for me.

weequ

2012-01-06 00:42:25

I was making it for over 10 hours yesterday :D What you mean by framing it?

Wyn

2012-01-06 00:47:48

setPreferredSize(new Dimension(840, 680));

=

setPreferredSize(new Dimension(763, 504));


:D.

Can you make me a Jar with my source also? I don't see where my manifest is wrong, I tried two different Ide's lol.

weequ

2012-01-06 00:49:10

wyn10 I have the same problem with the jar as you do. I think we will figure it out ;)

Wyn

2012-01-06 00:51:57

From: weequ
wyn10 I have the same problem with the jar as you do. I think we will figure it out ;)


What?

Take source..Compile…Make Jar :P.

I have no problems on my end.

weequ

2012-01-06 00:59:04

From: wyn10
What?

Take source..Compile…Make Jar :P.

I have no problems on my end.
But why our jars are not loading?

Edit: Got mine working.

From: wyn10
Can you make me a Jar with my source also? I don't see where my manifest is wrong, I tried two different Ide's lol.
Attached.

pyroryan

2012-01-06 01:14:53

From: wyn10
Can you make me a Jar with my source also? I don't see where my manifest is wrong, I tried two different Ide's lol.


It isn't. Its just that the person is using Java 6 instead of Java 7. Using different IDEs won't do anything since IDEs still use javac to compile.

weequ

2012-01-06 01:18:33

From: pyroryan
It isn't. Its just that the person is using Java 6 instead of Java 7. Using different IDEs won't do anything since IDEs still use javac to compile.
Well atleast for me it didn't work before but now it does. (See the attachment in my previous post)

Wyn

2012-01-06 05:42:34

From: pyroryan
It isn't. Its just that the person is using Java 6 instead of Java 7. Using different IDEs won't do anything since IDEs still use javac to compile.


That's what I thought at first.

Thanks weequ

Stuart

2012-01-10 00:33:22

Any idea how to get colors from the canvas? I have tried extending applet and that just threw errors in my face =/

Any ideas?

[XoL]

2012-01-10 00:34:34

?
Open simba, use the color identifier on the loader?

Stuart

2012-01-10 00:49:37

From: R4nd0m
?
Open simba, use the color identifier on the loader?

I want to make a scriptable java bot, So far I have added partial reflection (top text reading), mouse movement/clicking, Disable/Reenable mouse, graphics disabling.

Being able to add a few of my java color finding methods would be the icing on the cake :)

weequ

2012-01-10 01:06:36

From: Stuart
I want to make a scriptable java bot, So far I have added partial reflection (top text reading), mouse movement/clicking, Disable/Reenable mouse, graphics disabling.

Being able to add a few of my java color finding methods would be the icing on the cake :)
applet.getComponent(0) is the Canvas component. I think you will have to use that but I'm not sure how you do it. The canvas also have mouse listeners etc so if you wan't to perform clicks without using your own mouse you would use dispatchEvent event on the canvas.

Stuart

2012-01-10 09:53:01

From: weequ
applet.getComponent(0) is the Canvas component. I think you will have to use that but I'm not sure how you do it. The canvas also have mouse listeners etc so if you wan't to perform clicks without using your own mouse you would use dispatchEvent event on the canvas.


Yea i've already done the mouse disabling/reenabling & the clicking. I only need to be able to get a Image of the component then I can get color functions working.

I've tried repaintManager and sending an images getGraphics to the paint method but both turned out just sending me a black image.

Richard

2012-01-11 04:25:51

From: Stuart
Yea i've already done the mouse disabling/reenabling & the clicking. I only need to be able to get a Image of the component then I can get color functions working.

I've tried repaintManager and sending an images getGraphics to the paint method but both turned out just sending me a black image.


I'm having the same problem myself at the moment. I think you have to hack the Runescape client's canvas, and then make it an instance of your own custom made canvas. Using then you can then paint onto a BufferedImage.

Does anyone know how efficient it is to print the client's image onto a BufferedImage, and then reading pixel RGB values?

weequ

2012-01-11 04:37:41

From: Richard
I'm having the same problem myself at the moment. I think you have to hack the Runescape client's canvas, and then make it an instance of your own custom made canvas. Using then you can then paint onto a BufferedImage.

Does anyone know how efficient it is to print the client's image onto a BufferedImage, and then reading pixel RGB values?
I doubt it's very efficient but it might work ok if you don't need to find colors very often.

Stuart

2012-01-11 04:43:28

I deobbed the old nexus classes and they used to make a custom component they called Canvas which had a bufferedImage variable. So I reckon it wouldn't be to bad performance wise.

doublex8

2012-02-10 21:17:26

Hate to grave dig but I just want to thank you for this, I use it all the time

KeepBotting

2012-02-10 21:23:37

Yo, you're Wyn10 from powerbot! I'm KeepBotting, as you probably know.
Tbh I'm all in favor of keeping everything private, I think you should keep it.

Wyn

2012-02-19 23:43:17

From: doublex8
Hate to grave dig but I just want to thank you for this, I use it all the time


No problem.

From: KeepBotting
Yo, you're Wyn10 from powerbot! I'm KeepBotting, as you probably know.
Tbh I'm all in favor of keeping everything private, I think you should keep it.


I keep my money-making methods private. Anything Xp I usually release.

Stuart

2012-02-24 15:35:29

Loader works great apart from 1 thing, When you stop/destroy the applet remain in your resources (in task manager). I believe this is because the classes that were loaded were never unloaded in the ClassLoader.

Any ideas how to fix this?

edit: setting applet to null does nothing either.

edfromhumanresources

2012-02-24 23:16:51

From: Stuart
Yea i've already done the mouse disabling/reenabling & the clicking. I only need to be able to get a Image of the component then I can get color functions working.

I've tried repaintManager and sending an images getGraphics to the paint method but both turned out just sending me a black image.


A wild stab in the dark but are you using ogl or d3d as the renderer? It would probably cause a black image to be observed throughout the swing graphics pipeline.

Stuart

2012-02-25 17:20:43

I got the canvas issue sorted by using xbootclasspath to replace their canvas with my own so that everytime getGraphics is called it stores the image to a bufferedImage for searching :), The resource deleting is the only issue i'm having. Heres how to get image from canvas btw.

Canvas.java - Make the folder (java/awt) and save it in there so its java/awt/Canvas.java


package java.awt;

import java.awt.image.BufferedImage;

import javax.accessibility.Accessible;

public class Canvas extends Component implements Accessible {
private BufferedImage image;

public Canvas() {
image = new BufferedImage(765, 503, BufferedImage.TYPE_INT_ARGB);
}

@Override
public Graphics getGraphics() {
Graphics buffer = image.getGraphics();
buffer.drawString("Hello world", 100, 100);
super.getGraphics().drawImage(image, 0, 0, null);
return image.createGraphics();
}

public BufferedImage getImage() {
BufferedImage img = new BufferedImage(765, 503, BufferedImage.TYPE_INT_RGB);
img.getGraphics().drawImage(image, 0, 0, 765, 503, 0, 0, 765, 503, null);
return img;
}
}

Once you have compiled that zip the java folder and rename the zip canvas.jar (no manifest is required).

Then in your run.bat or VM arguments (eclipse) add this to your run command:


-Xbootclasspath/p:"canvas.jar"

Example:


java -Xmx1024m -Xbootclasspath/p:"canvas.jar" -jar CB.jar

weequ

2012-02-25 19:55:54

From: Stuart
I got the canvas issue sorted by using xbootclasspath to replace their canvas with my own so that everytime getGraphics is called it stores the image to a bufferedImage for searching :), The resource deleting is the only issue i'm having. Heres how to get image from canvas btw.

Canvas.java - Make the folder (java/awt) and save it in there so its java/awt/Canvas.java


package java.awt;

import java.awt.image.BufferedImage;

import javax.accessibility.Accessible;

public class Canvas extends Component implements Accessible {
private BufferedImage image;

public Canvas() {
image = new BufferedImage(765, 503, BufferedImage.TYPE_INT_ARGB);
}

@Override
public Graphics getGraphics() {
Graphics buffer = image.getGraphics();
buffer.drawString("Hello world", 100, 100);
super.getGraphics().drawImage(image, 0, 0, null);
return image.createGraphics();
}

public BufferedImage getImage() {
BufferedImage img = new BufferedImage(765, 503, BufferedImage.TYPE_INT_RGB);
img.getGraphics().drawImage(image, 0, 0, 765, 503, 0, 0, 765, 503, null);
return img;
}
}

Once you have compiled that zip the java folder and rename the zip canvas.jar (no manifest is required).

Then in your run.bat or VM arguments (eclipse) add this to your run command:


-Xbootclasspath/p:"canvas.jar"

Example:


java -Xmx1024m -Xbootclasspath/p:"canvas.jar" -jar CB.jar
Thanks. I think that xbootclasspath will fix some compiling issues I have been having :)

weequ

2012-03-14 15:13:02

Can anyone help me? I have been trying to do the xbootclasspath thing above with no success.

I have added this in the vm arguments:
-Xbootclasspath/p:"Canvas.jar" (Tried eclipse and netbeans)

Should I have the whole java … -Xbootclasspath/p:"Canvas.jar" -jar ..jar thing there or why it doesn't seem to use the class that I want?

I have added System.out.println pretty much everywhere in the Canvas class so I would know if it worked.

Edit: Got it working with a bat file. Just failed to do that with netbeans/eclipse. If anyone knows what I did wrong then please tell me anyway :)

Wyn

2012-08-21 12:52:08

Forgot to update this…

Updated for the Navbar.

amit8944

2012-09-05 01:25:02

you can also take the advertizement out of it if u can
please
thankyou

[XoL]

2012-09-06 13:59:05

From: amit8944
you can also take the advertizement out of it if u can
please
thankyou


Isn't possible, the advertisement is server sided. Just use ad-block, I never get ads?

How do I compile this myself? (On second page you put the .java file)
Tried to compile but I get an error

Swatarianess

2012-09-20 08:40:31

Hey I'm back, failed at doing this again. :( I'll try it with your client Wyn and see if it works :)



Edit:
So as this is an update I guess. To show that this still works. This is what I've done;

-Xbootclasspath Updated 20/09/2012*
java -Xmx1024m -Xbootclasspath/p:"canvas.jar" -jar CB.jar


-Xmx1024m << This is the RAM allocation to the application


-Xbootclasspath/p:"canvas.jar" << This is the canvas.jar which replaces the client's


-jar CB.jar << This is the runnable bot in .jar format. Note: It has to be runnable .jar format or it won't start. Also keep the quotations. Normally if you forget these you get lots of errors…







Cmd Results;


and finnaly what my folder looks like; (or shud look like)

proof:

* dd/mm/yyyy

~Bro433

Wyn

2012-10-06 22:31:05

From: bro433


I know it still works. Cause I'm still using/improving it.







J J

2012-10-07 06:03:52

Looking good :P I like the language options! Also had a look at the source again now that I've been learning Java for the past 2-3 months or so and I actually understand most of what is going on now :)

Using OpenGL/DirectX hooking botting in different languages would also be neat. You can just grab the character set and read the text 100% accurately. But yeah, some functions/procedures won't work. But I think you are just working on a Client right? This part was more for Simba and different languages :P

Anyways, good luck with the development!

The Killer

2012-10-07 07:17:20

looks good :D, has wyn had a derank or has he always been junior???

Wyn

2012-10-08 02:44:00

From: J J
Looking good :P I like the language options! Also had a look at the source again now that I've been learning Java for the past 2-3 months or so and I actually understand most of what is going on now :)

Using OpenGL/DirectX hooking botting in different languages would also be neat. You can just grab the character set and read the text 100% accurately. But yeah, some functions/procedures won't work. But I think you are just working on a Client right? This part was more for Simba and different languages :P

Anyways, good luck with the development!


This is a legit client. I have no need to use it towards botting, just wanted to start a small project for killing time.

From: The Killer
looks good :D, has wyn had a derank or has he always been junior???


I have no desire to become a Srl member. I make my own work when it's needed, I have no desire to use others. My usage in Java far outweighs the need to work in Pascal.

Olly

2012-10-08 11:42:23

From: Wyn
This is a legit client. I have no need to use it towards botting, just wanted to start a small project for killing time.


"Open Powerbot? ":P

Echo_

2012-10-08 12:10:10

I love the UI :thumbsup:

Wyn

2012-10-09 18:01:22

From: Ollybest
"Open Powerbot? ":P


I'm mostly there for the Community, I average 100+ posts a day.

From: Echo_
I love the UI :thumbsup:


Thanks.

Dgby714

2012-10-09 20:14:10

From: Wyn
This is a legit client. I have no need to use it towards botting, just wanted to start a small project for killing time.



I have no desire to become a Srl member. I make my own work when it's needed, I have no desire to use others. My usage in Java far outweighs the need to work in Pascal.


Wyn, You don't have to know Pascal to become a member, you just do for the normal process.

We do have a few members+ that know almost no programming.

Wyn

2012-10-09 21:49:39

From: Dgby714
Wyn, You don't have to know Pascal to become a member, you just do for the normal process.

We do have a few members+ that know almost no programming.


When did I say I didn't know Pascal? I ment I would rather work in Java than in Pascal.

KeepBotting

2012-11-14 20:50:53

This is awesome ;) thanks Wyn.

Chris Reborn

2012-11-14 21:12:43

looks sweet! thanks

Wyn

2012-11-20 12:33:00

From: KeepBotting
This is awesome ;) thanks Wyn.

From: idodew
looks sweet! thanks


I should be releasing the new version soon, been working on a screen/sound recorder in Java for the client.

ryang25

2012-12-13 12:12:16

dead project?

Wyn

2012-12-19 17:37:00

From: ryang25
dead project?


No.

Bel002

2013-05-05 07:45:35

Hey bro.. maybe can u try to make a OSRS client too? TY :)