View Full Version : [Tutorial] [Part I] Runescape Injection Basics
Forenote: This is how I learned, if anything can be simplified/if I did it wrong, leave a post explaining why and how I need to fix the issue. Thanks. :)
Table of Contents
Introduction
Setting up your class
Preparing the loader
Final Notes
Introduction
Awhile ago, I looked into fooling with Java injection on oldschool. I didn't get too far, but I did manage to do some things. :)
By the end of this tutorial, you should be able to load the gamepack, and display it as an applet. No actual injection is being done here, we're just setting on up.
I'll be using Intellij throughout this tutorial, so the pictures may be a little off.
You also need a basic understanding of Java to complete this tutorial.
Well, let's get too it.
Setting up your class
You'll want to make a new project by clicking File>New Project.
If you did that, it should look like this:
http://puu.sh/2kaA8.png
Just click okay on the next window.
You'll be presented a window like so(Large Image):
http://puu.sh/2kaFi.png
Expand your project so it looks like so:
http://puu.sh/2kaK3.png
Now, right click on the src, and make new package.
Name it something like com.bot
You're almost set now... but wait,you need ASM!
Lucky for you, I prepared a download of the all extensive ASM jar, found here. (https://www.dropbox.com/s/xr5y2esg5mb9008/asm-all-4.1.jar)
After you put that in a safe place, click: CTRL+Shift+Alt+S
A box like this will appear:
http://puu.sh/2kaVp.png
Click the Modules tab on the left, and inside that, click Dependencies, so it looks like
http://puu.sh/2kaXq.png
You'll then want to click the green plus(+) sign at the right of that window, and select Jar or Directories.
Navigate to your ASM-All-4.1.jar you downloaded earlier, and select it.
You will now want to export it by selecting the little tick box.
http://puu.sh/2kb07.png
Click apply, then okay.
We are now prepared to code!
Preparing your loader
For your benefit, all the code will be screen shotted, so you can not copy and paste. This will force you to write out all code within the tutorials.
Alright, here we go. Another note, I will explain what the code does after I post it. So don't worry if you don't understand it at first, just type it, and all will be clear.
http://puu.sh/2kbDP.png
This is your first code you need to write down.
It searches a pattern(Which we will get to later) for a field. It then runs it through a Matcher to check for matches, then assigns group 1 and 2 (Name of parameter, and value) to a map.
You can read about Maps here (http://docs.oracle.com/javase/tutorial/collections/interfaces/map.html)
Next, we add a new method. Copy this out
http://puu.sh/2kbNt.png
What this does is it opens a URL connection, and then adds request properties, stuff that a browser would have. It opens a DataInputStream, and returns the HTML of the webpage.
Near the top of the code, under the imports, change public class main{ to:
http://puu.sh/2kbZh.png
Then add this code to the bottom:
http://puu.sh/2kc1i.png
This code sets up our class to start the game applet, by setting up the appletstub, all it does. :)
Your next code is: http://puu.sh/2kc3q.png
This code downloads the info from the website, and downloads the gamepack to your PC, allowing for further editing.
This next part is the nitty gritty.
http://puu.sh/2kc8l.png
Alright, here we go.
What this does, it makes a new JFrame, (Replace "NKN's Oldschool Loader" with w/e you want.")
It then adds a new label, which has a picture so the user has something "nice" to look at when it's loading.
String str gets the HTML source of the runescape page we're going to be loading from. This is how we will parse everything.
The next line starts a pattern, looking for the location of the gamepack. The code states, if a match is found, do this
We initialize a new AppletStub with Main stub = new Main(); (Remember, Main implements AppletStub?)
This sets up the stub. Don't worry about the pattern, it's in Regex if you REALLY want to know.
We then download the gamepack, and save it.
We set the stubs' codebase and document base to the jar file location, and load the java parameters (Like max and min memory, ect.)
We then load the classes, and cast an Applet to it, loading the client class inside the gamepack.jar file.
We set the stub, and the size, start the applet, and add it to the JFrame, before making the label invisible and making the applet show!
Viola, loading the game should be done... it's not working when you click play? Did you forget to add it to execute?!
Run back to the top, and try this code on for size:
http://puu.sh/2kclu.png
Click run, you should end up with something like:
http://puu.sh/2kcmR.png for the loader, and
http://puu.sh/2kcnC.png for the game!
Final Thoughts
I know this isn't the best detailed tutorial, but I tried my best. Some things can be made simpler, if you have any ideas, leave a post. Try not to flame me with them though, as this is how I learned it. :( Well, if you made it this far, congrats! You made a loader!
StickToTheScript
03-19-2013, 01:23 AM
Hmm... I am really tempted to actually attempt to make one of these. It would be kinda fun! and looks like it too!
Well I understood a little bit of this... one day.. one day I may come back and understand this
Neodymium
03-19-2013, 01:27 AM
This is how BenLand loads the client in SMART, correct? I recognize most of this code.
Anyways, I will definitely try this from scratch when I get the time. Thanks for the guide. ;)
This is how BenLand loads the client in SMART, correct? I recognize most of this code.
Anyways, I will definitely try this from scratch when I get the time. Thanks for the guide. ;)
He does it a bit different. It interacts with Simba, and is a lot more complex. ;)
Vinyl Scratch
03-19-2013, 01:30 AM
Nice one, NKN.
+Rep, will do this tomorrow.
Richard
03-19-2013, 01:44 AM
I've never seen any tutorials using ASM, only BCEL. I'd love to see what your future guides will be like!
I've also not seen a huge number of people using IntelliJ, how have you been finding it? I'm far too generic in always using eclipse.
One final note, about the naming of packages you did. The general convention is that you name these essentially in reverse of your domain: [URL suffix].[domain].[packages...].Class. For example: com.villavu.bot.Loader
I've never seen any tutorials using ASM, only BCEL. I'd love to see what your future guides will be like!
I've also not seen a huge number of people using IntelliJ, how have you been finding it? I'm far too generic in always using eclipse.
One final note, about the naming of packages you did. The general convention is that you name these essentially in reverse of your domain: [URL suffix].[domain].[packages...].Class. For example: com.villavu.bot.Loader
I found IntelliJ confusing at first, but after awhile I like it better than Eclipse. Not sure why, just grew on me I guess.
As for the final note, wouldn't that be for people with a website, so they can use an API? Most people don't have websites laying around. D: But anywho, thanks for the insight. :)
Richard
03-19-2013, 01:54 AM
I found IntelliJ confusing at first, but after awhile I like it better than Eclipse. Not sure why, just grew on me I guess.
As for the final note, wouldn't that be for people with a website, so they can use an API? Most people don't have websites laying around. D: But anywho, thanks for the insight. :)
I'm not sure if I'm too set in my ways to try out a new IDE yet :p Then again, it sounds like my degree intends to steer clear of java for the first year, focusing on more practical languages. Which is a shame in some ways.
About the naming, it's just "one of those things", there's no real reason behind it, and it often makes sense to do it in other ways. I probably shouldn't have said anything, as programmers we must find our own, more practical methods, free of conformity!
I'm not sure if I'm too set in my ways to try out a new IDE yet :p Then again, it sounds like my degree intends to steer clear of java for the first year, focusing on more practical languages. Which is a shame in some ways.
Where are you getting your degree?
I start my first programming year as a freshmen in highschool next year, we start with Visual Basic, then the year after that, Java.
Richard
03-19-2013, 02:03 AM
Where are you getting your degree?
I start my first programming year as a freshmen in highschool next year, we start with Visual Basic, then the year after that, Java.
If all goes to plan with my A level retakes, should be going to the University of Exeter, but we'll see. If I end up doing better than expected, maybe UCL or Bristol.
Also, when it comes to VB, don't get put off by this general idea that it's useless. It can actually be pretty useful when applied in the right areas. On top of that, if you use Visual Studio, then it gets you used to the UI for moving on to C/C++ if you plan to stay with that IDE (although I seem to be in a minority here for supporting MS :p)
(although I seem to be in a minority hear for supporting MS :p)
My highschool makes us use Visual Studio for all Basic/C++ applications, don't fret. <3
xtrapsp
03-19-2013, 10:52 AM
Told you people would like it ;) +REP
speedster
03-19-2013, 10:55 AM
Not yet to the injection part :D but awesome starter kick-starter! nice tutorial :)
the flea
03-19-2013, 11:34 AM
Looks like this may be a promising tutorial series. I'm eagerly awaiting the next parts as they are the bits I know less about.
+rep thanks for your time
Might want to explain more about regular expressions and what it's actually getting. Other than that it's nice to start off with for people :)
WillB
03-21-2013, 06:13 PM
Great tut. Thanks! :D
The Killer
03-21-2013, 06:22 PM
Don't really know much java but Bookmark'd for later :p
Silentcore
03-21-2013, 06:45 PM
Very nice guide, im looking forward into the rest parts..
Sawyer
03-24-2013, 05:02 PM
I'll try this. Very nice tut, very easy to follow, and the pictures vs. copy/paste forces people to actually possibly learn.
Adium
03-25-2013, 06:01 AM
I followed your tutorial. However, only the loader loads. Then it just sits there and displays the .gif. Any ideas?
I followed your tutorial. However, only the loader loads. Then it just sits there and displays the .gif. Any ideas?
You're loading the applet wrong. Make sure all the methods are typed out correctly.
Adium
03-25-2013, 06:20 PM
You're loading the applet wrong. Make sure all the methods are typed out correctly.
What should <~> be? I put a random number in because <~> gave me an error.
What should <~> be? I put a random number in because <~> gave me an error.
What..?
Adium
03-25-2013, 07:19 PM
What..?
public class Main {
private static Map<String, String> parameters = new HashMap<~>();
..... The HashMap
I don't think thats the problem though.
Richard
03-25-2013, 07:21 PM
public class Main {
private static Map<String, String> parameters = new HashMap<~>();
..... The HashMap
I don't think thats the problem though.
The way Maps work in java changed with 1.7, make sure you're up to date.
Whoops, misread the issue.
One second
Adium
03-25-2013, 07:25 PM
The way Maps work in java changed with 1.7, make sure you're up to date.
I'm rolling with 1.7. I get an error on the actual "~"
Multiple markers at this line
- Syntax error on token "~", delete this token
- HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized
- Type safety: The expression of type HashMap needs unchecked conversion to conform to
Map<String,String>
Check this part:
http://puu.sh/2kc1i.png
100% Match :spot:
I'm rolling with 1.7. I get an error on the actual "~"
100% Match :spot:
private static Map<String, String> parameters = new HashMap<String, String>();
Try that
Adium
03-25-2013, 07:38 PM
private static Map<String, String> parameters = new HashMap<String, String>();
Try that
No luck, I'm also now getting a weird error that I wasn't getting before.
Exception in thread "main" java.lang.ClassNotFoundException: client
at java.net.URLClassLoader$1.run(URLClassLoader.java: 366)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:4 23)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 56)
at Main.<init>(Main.java:111)
at Main.main(Main.java:24)
Gonna re-write from scratch to make sure I didn't do anything stupid :)
Problem Solved :) Thanks guys
detuks
03-31-2013, 01:38 PM
while(param.find()){
String key = param.group(1);
String value = param.group(2);
parameters.put(key,value);
System.out.println("key: "+ key + " value: "+value);
}
It doesn't find key nor value
fixed it!
Exception in thread "main" ci
at dm.g(dm.java:59)
at client.init(client.java:697)
at Main.<init>(Main.java:62)
at Main.main(Main.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main (AppMain.java:120)
How to fix this? 0.o
And stub.getParameter(parameters.get("java_arguments")); should be -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC ??
while(param.find()){
String key = param.group(1);
String value = param.group(2);
parameters.put(key,value);
System.out.println("key: "+ key + " value: "+value);
}
It doesn't find key nor value
fixed it!
Exception in thread "main" ci
at dm.g(dm.java:59)
at client.init(client.java:697)
at Main.<init>(Main.java:62)
at Main.main(Main.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main (AppMain.java:120)
How to fix this? 0.o
And stub.getParameter(parameters.get("java_arguments")); should be -Xmx256m -Xss2m -Dsun.java2d.noddraw=true -XX:CompileThreshold=1500 -Xincgc -XX:+UseConcMarkSweepGC -XX:+UseParNewGC ??
Post your
public String getParameter
function
Sorry for the delay!
computerichy
11-28-2013, 08:24 PM
Hey :P I thank you highly for your tutorial on how to inject the old school RuneScape client, and I was just wondering if you at all knew any way of how this method could be applied to the RuneScape 3 client. Would it be possible to modify the current code given for old school so that it is compatible with version 3, or is the method completely different (for Java RS3, of course)?
Hey :P I thank you highly for your tutorial on how to inject the old school RuneScape client, and I was just wondering if you at all knew any way of how this method could be applied to the RuneScape 3 client. Would it be possible to modify the current code given for old school so that it is compatible with version 3, or is the method completely different (for Java RS3, of course)?
Yeah, you could use it for RS3.
It's a bit more difficult because of the inner pack.
[XoL]
11-28-2013, 09:25 PM
Nice job man, been waiting for someone to make some kind of tut for anything :p
computerichy
02-05-2014, 09:54 PM
Is there a possibility that you are able to create a loader, or some of the core code to load the applet?
Is there a possibility that you are able to create a loader, or some of the core code to load the applet?
Uhh.. I'm able yes. Did you want the code, is that what you're asking?
computerichy
02-05-2014, 11:33 PM
I would really appreciate if you were kind enough to, yes; It seems difficult to find support on injecting the RS3 client, which I guess is due to the illegitimate uses and the majority of developers prefer secretion. I, however am aiming to create a feature-full and supportive client to improve the user's experience through entertainment and efficiency, that incorporates both old school and RS3. If you were to support the client loading and injection component, I would be more than obliged to fully credit you for your support.
I would really appreciate if you were kind enough to, yes; It seems difficult to find support on injecting the RS3 client, which I guess is due to the illegitimate uses and the majority of developers prefer secretion. I, however am aiming to create a feature-full and supportive client to improve the user's experience through entertainment and efficiency, that incorporates both old school and RS3. If you were to support the client loading and injection component, I would be more than obliged to fully credit you for your support.
I haven't done RS3 injection, but I'll look at it later today. If I get anything, I'll PM you it.
computerichy
02-06-2014, 11:20 PM
I haven't done RS3 injection, but I'll look at it later today. If I get anything, I'll PM you it.
Thank you, I would really appreciate it as I've attempted myself and seems to be quite a complex issue.
computerichy
02-18-2014, 12:06 AM
The issue is now solved, I've successfully been able to load the RS3 client as an applet by parsing the parameters using the 'jav_config.ws' page.
DatSik
06-24-2014, 12:39 AM
Thank you so much, this is fantastic.
PS- Where is part 2! Keep it up man
KeepBotting
06-24-2014, 01:03 AM
Thank you so much, this is fantastic.
PS- Where is part 2! Keep it up manthis thread is a year old.
DatSik
06-24-2014, 01:36 AM
this thread is a year old.
So? that doesent make it any less useful, I have just discovered it, Im not intending to grave-dig or anything, and honestly i didnt know anything about the date
this thread is a year old.
Grave-digging tutorials is a crime now?
KeepBotting
06-24-2014, 02:54 AM
Grave-digging tutorials is a crime now?
wasn't referring to grave digging, he thanked him for it and asked for part 2.
do you honestly think NKN still checks this thread?
wasn't referring to grave digging, he thanked him for it and asked for part 2.
do you honestly think NKN still checks this thread?
NKN actually started coming back on skype recently. Anyhow, isn't really your choice to make, Only reason why i posted was because he thought you were targeting him on the grave-digging; as did i.
wasn't referring to grave digging, he thanked him for it and asked for part 2.
do you honestly think NKN still checks this thread?
Hello yes I subscribe to all my threads so I can reply.
I might do a part 2, would probably need to rewrite this one first, it's pretty god awful.
KeepBotting
06-24-2014, 11:52 AM
So? that doesent make it any less useful, I have just discovered it, Im not intending to grave-dig or anything, and honestly i didnt know anything about the date
NKN actually started coming back on skype recently. Anyhow, isn't really your choice to make, Only reason why i posted was because he thought you were targeting him on the grave-digging; as did i.
I'm sorry, my apologies. I was quick to jump to the conclusion that his post was useless. It was not. I was wrong.
DatSik
06-24-2014, 08:52 PM
I'm sorry, my apologies. I was quick to jump to the conclusion that his post was useless. It was not. I was wrong.
Your a good dude. thumbs up to you
DatSik
06-25-2014, 08:40 PM
Ok, so here is my complete code, i have like 50 errors lol. I wrote all this on the main source code i never created new classes or anything, im a first tme java user coming from delphi..so its a bit alien to me. Am i supposed to create new classes on the com.bot section or what??
package com.company;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main implements AppletStub {
private static Map<String, String> parameters = new HashMap<~>();
public static void main (String[] args) {
}
public Main(Pattern parameterPattern, String frameSource) {
Matcher param = parameterPattern.matcher(frameSource);
while (param.find()) {
String key = param.group(1);
String value = param.group(2);
parameters.put(key, value);
System.out.println("Paramter loaded. Key = " + key + ", Value ="
+ value);
}
}
}
private static String getPageSource (URL url) throws IOException,
InterruptedException {
URLConnection cn = url.openConnection();
cn.addRequestProperty(
"Accept",
"text/xml,application/xml,application/xhtml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
cn.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7")
cn.addRequestProperty("Accept-Encoding", "gzip,deflate");
cn.addRequestProperty("Accept-Language","en-gb,en;q=0.5");
cn.addRequestProperty("Connection", "keep-alive");
cn.addRequestProperty("Host", "www.runescape.com");
cn.addRequestProperty("Keep-Alive", "300");
cn.addRequestProperty("User-Agent",
"Mozilla/5.0 (Windows NT 6.1; rv: 9.0.1 Gecko/20100101 Firefox/9.0.1");
DataInputStream di = new DataInputStream(cn.getInputStream());
byte[] tmp = new byte[cn.getContentLength()];
di.readFully(tmp);
di.close();
return new String(tmp);
}
}
public void setDocumentBase(URL documentBase){
this.documentBase = documentBase;
}
public void setCodeBase(URL codeBase){
this.codeBase = codeBase;
}
private URL documentBase;
private URL codeBase;
@Override
public boolean isActive(){
return false;
}
@Override
public URL getDocumentBase(){
return documentBase;
}
@Override
public URL getCodeBase(){
return codeBase;
}
@Override
public String getParameter (String name){
return parameters.get(name);
}
@Override
public AppletContext getAppletContext(){
return null;
}
@Override
public void appletResize(int width, int height){
}
}
public static void Download(String world, String archive) throws Exception{
URLConnection jarConnection = new URL(world + archive).openConnection();
FileOutputStreame out = new FileOutputStream("./gamepack.jar");
InputStream input = jarConnection.getInputStream();
byte[] info = new byte[1024];
int lnl
while (ln = input.read(info)) != -1) {
out.write(info,0,ln);
}
public Main() throws Exception{
JFrame i = new JFrame("Delphi RS");
JLabel label = new JLabel();
ImageIcon icon = new ImageIcon(new URL(
"http://www.runescape.com/img/rsp777/oldschool ani.gif"));
icon.setImageOBserver(null);
label.setIcon(icon);
i.add(label);
i.pack();
i.setVisible(true);
String str = getPageSource(new URL("http://oldschool38.runescape.com"));
Pattern pattern = Pattern.compile("gamep\\w+"));
Matcher match = pattern.matcher(str);
if (match.find()){
Main stub = new Main(Pattern.compile("<param name=\"([^\\s+value=\"([^>]*)\">"), str);
Download("http://oldschool38.runescape.com/", match.group(0)+ "jar");
stub.setCodeBase(new URL("http://oldschool38.runescape.com/" + match.group(0)+ ".jar"));
stub.setDocumentBase(new URL("http://oldschool38.runescape.com/" + match.group(0)+ "jar"));
stub.getParamter (parameters.get("java_arguments"));
URLClaseLoader claseLoader = new URLClassLoader(new URL[]{ new URL("file:gamepack.jar")});
Applet applet = (Applet) classLoader.loadClass ("client").newInstance();
applet.setStub(stub);
applet.setPreferredSize(new Dimensions(763, 504));
applet.init();
applet.start();
i.add(applet);
i.pack();
i.setDefaultCloaseOperation(JFrame.EXIT_ON_CLOSE);
label.setVisible(false);
}
}
Ok, so here is my complete code, i have like 50 errors lol. I wrote all this on the main source code i never created new classes or anything, im a first tme java user coming from delphi..so its a bit alien to me. Am i supposed to create new classes on the com.bot section or what??
package com.company;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main implements AppletStub {
private static Map<String, String> parameters = new HashMap<~>();
public static void main (String[] args) {
}
public Main(Pattern parameterPattern, String frameSource) {
Matcher param = parameterPattern.matcher(frameSource);
while (param.find()) {
String key = param.group(1);
String value = param.group(2);
parameters.put(key, value);
System.out.println("Paramter loaded. Key = " + key + ", Value ="
+ value);
}
}
}
private static String getPageSource (URL url) throws IOException,
InterruptedException {
URLConnection cn = url.openConnection();
cn.addRequestProperty(
"Accept",
"text/xml,application/xml,application/xhtml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
cn.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7")
cn.addRequestProperty("Accept-Encoding", "gzip,deflate");
cn.addRequestProperty("Accept-Language","en-gb,en;q=0.5");
cn.addRequestProperty("Connection", "keep-alive");
cn.addRequestProperty("Host", "www.runescape.com");
cn.addRequestProperty("Keep-Alive", "300");
cn.addRequestProperty("User-Agent",
"Mozilla/5.0 (Windows NT 6.1; rv: 9.0.1 Gecko/20100101 Firefox/9.0.1");
DataInputStream di = new DataInputStream(cn.getInputStream());
byte[] tmp = new byte[cn.getContentLength()];
di.readFully(tmp);
di.close();
return new String(tmp);
}
}
public void setDocumentBase(URL documentBase){
this.documentBase = documentBase;
}
public void setCodeBase(URL codeBase){
this.codeBase = codeBase;
}
private URL documentBase;
private URL codeBase;
@Override
public boolean isActive(){
return false;
}
@Override
public URL getDocumentBase(){
return documentBase;
}
@Override
public URL getCodeBase(){
return codeBase;
}
@Override
public String getParameter (String name){
return parameters.get(name);
}
@Override
public AppletContext getAppletContext(){
return null;
}
@Override
public void appletResize(int width, int height){
}
}
public static void Download(String world, String archive) throws Exception{
URLConnection jarConnection = new URL(world + archive).openConnection();
FileOutputStreame out = new FileOutputStream("./gamepack.jar");
InputStream input = jarConnection.getInputStream();
byte[] info = new byte[1024];
int lnl
while (ln = input.read(info)) != -1) {
out.write(info,0,ln);
}
public Main() throws Exception{
JFrame i = new JFrame("Delphi RS");
JLabel label = new JLabel();
ImageIcon icon = new ImageIcon(new URL(
"http://www.runescape.com/img/rsp777/oldschool ani.gif"));
icon.setImageOBserver(null);
label.setIcon(icon);
i.add(label);
i.pack();
i.setVisible(true);
String str = getPageSource(new URL("http://oldschool38.runescape.com"));
Pattern pattern = Pattern.compile("gamep\\w+"));
Matcher match = pattern.matcher(str);
if (match.find()){
Main stub = new Main(Pattern.compile("<param name=\"([^\\s+value=\"([^>]*)\">"), str);
Download("http://oldschool38.runescape.com/", match.group(0)+ "jar");
stub.setCodeBase(new URL("http://oldschool38.runescape.com/" + match.group(0)+ ".jar"));
stub.setDocumentBase(new URL("http://oldschool38.runescape.com/" + match.group(0)+ "jar"));
stub.getParamter (parameters.get("java_arguments"));
URLClaseLoader claseLoader = new URLClassLoader(new URL[]{ new URL("file:gamepack.jar")});
Applet applet = (Applet) classLoader.loadClass ("client").newInstance();
applet.setStub(stub);
applet.setPreferredSize(new Dimensions(763, 504));
applet.init();
applet.start();
i.add(applet);
i.pack();
i.setDefaultCloaseOperation(JFrame.EXIT_ON_CLOSE);
label.setVisible(false);
}
}
What're the errors?
DatSik
06-26-2014, 01:23 AM
lol wow im sorry.. i will post them, but did i do it right? am i supposed to create alot of different classes and such? will post them soon,thanks for looking man
lol wow im sorry.. i will post them, but did i do it right? am i supposed to create alot of different classes and such? will post them soon,thanks for looking man
I know for starters in that code you capitalized two letters instead of one for a method name. Check near the bottom.
I know for starters in that code you capitalized two letters instead of one for a method name. Check near the bottom.
It is convention, But it is not wrong.
DatSik
06-26-2014, 03:40 AM
It is convention, But it is not wrong.
I know for starters in that code you capitalized two letters instead of one for a method name. Check near the bottom.
First off sorry it took me so long to get back on, and second..Thank you both of you for throwing in some advice, its much appreciated. Now here is what im getting.
Information:java: Errors occurred while compiling module 'TestInject'
Information:Compilation completed with 69 errors and 0 warnings in 26 sec
Information:69 errors
Information:0 warnings
C:\Users\Melissa\IdeaProjects\TestInject\src\com\c ompany\Main.java
Error:(17, 65) java: illegal start of type
Error:(17, 66) java: '(' or '[' expected
Error:(17, 67) java: ';' expected
Error:(17, 68) java: illegal start of type
Error:(17, 69) java: <identifier> expected
Error:(17, 70) java: ';' expected
Error:(32, 19) java: class, interface, or enum expected
Error:(35, 8) java: class, interface, or enum expected
Error:(38, 8) java: class, interface, or enum expected
Error:(40, 8) java: class, interface, or enum expected
Error:(41, 8) java: class, interface, or enum expected
Error:(42, 8) java: class, interface, or enum expected
Error:(43, 8) java: class, interface, or enum expected
Error:(44, 8) java: class, interface, or enum expected
Error:(46, 8) java: class, interface, or enum expected
Error:(47, 8) java: class, interface, or enum expected
Error:(48, 8) java: class, interface, or enum expected
Error:(49, 8) java: class, interface, or enum expected
Error:(50, 8) java: class, interface, or enum expected
Error:(51, 1) java: class, interface, or enum expected
Error:(53, 12) java: class, interface, or enum expected
Error:(55, 5) java: class, interface, or enum expected
Error:(57, 12) java: class, interface, or enum expected
Error:(59, 5) java: class, interface, or enum expected
Error:(63, 13) java: class, interface, or enum expected
Error:(65, 12) java: class, interface, or enum expected
Error:(67, 5) java: class, interface, or enum expected
Error:(69, 12) java: class, interface, or enum expected
Error:(71, 5) java: class, interface, or enum expected
Error:(73, 12) java: class, interface, or enum expected
Error:(75, 5) java: class, interface, or enum expected
Error:(77, 12) java: class, interface, or enum expected
Error:(79, 5) java: class, interface, or enum expected
Error:(82, 12) java: class, interface, or enum expected
Error:(84, 5) java: class, interface, or enum expected
Error:(87, 12) java: class, interface, or enum expected
Error:(92, 19) java: class, interface, or enum expected
Error:(94, 9) java: class, interface, or enum expected
Error:(95, 9) java: class, interface, or enum expected
Error:(96, 9) java: class, interface, or enum expected
Error:(97, 9) java: class, interface, or enum expected
Error:(101, 9) java: class, interface, or enum expected
Error:(103, 12) java: class, interface, or enum expected
Error:(105, 9) java: class, interface, or enum expected
Error:(106, 9) java: class, interface, or enum expected
Error:(108, 9) java: class, interface, or enum expected
Error:(109, 9) java: class, interface, or enum expected
Error:(110, 9) java: class, interface, or enum expected
Error:(111, 9) java: class, interface, or enum expected
Error:(112, 9) java: class, interface, or enum expected
Error:(113, 9) java: class, interface, or enum expected
Error:(114, 9) java: class, interface, or enum expected
Error:(115, 9) java: class, interface, or enum expected
Error:(116, 9) java: class, interface, or enum expected
Error:(118, 14) java: class, interface, or enum expected
Error:(119, 14) java: class, interface, or enum expected
Error:(120, 14) java: class, interface, or enum expected
Error:(121, 14) java: class, interface, or enum expected
Error:(122, 14) java: class, interface, or enum expected
Error:(123, 14) java: class, interface, or enum expected
Error:(124, 14) java: class, interface, or enum expected
Error:(125, 14) java: class, interface, or enum expected
Error:(126, 14) java: class, interface, or enum expected
Error:(127, 14) java: class, interface, or enum expected
Error:(128, 14) java: class, interface, or enum expected
Error:(129, 14) java: class, interface, or enum expected
Error:(130, 14) java: class, interface, or enum expected
Error:(131, 14) java: class, interface, or enum expected
Error:(132, 9) java: class, interface, or enum expected
DatSik
06-26-2014, 04:01 AM
I know for starters in that code you capitalized two letters instead of one for a method name. Check near the bottom.
Also, here is a quick GIF just to show what its looking like for me
http://i.imgur.com/gmla6iV.gif
It is convention, But it is not wrong.
Java is case sensitive, having that capitalized will throw an error.
Also, here is a quick GIF just to show what its looking like for me
http://i.imgur.com/gmla6iV.gif
Alright so I looked at your code in my IDE.
You have a few misplaced ending brackets }
Some things are spelled incorrectly (Class instead of clase)
When you set your stub, it needs to end in ".jar" not "jar"
You copied the Pattern.compile("<param name=\"([^\\s]+)\"\\s+value=\"([^>]*)\">"), str); incorrectly (There's my edited copy so it's fixed for you.)
Your main method was empty, it should also throw Exception.
stub. getParameter you need to remove the space.
So yeah, pretty much just misclicks or incorrect copying.
Hashmap defining was done incorrectly. (Maybe works on Java 7, I'm dev'ing with Java 6 and I forgot to change it over.)
Here's a difference checker for you, I advise you try and solve the errors yourself instead of copy/pasting, you'll thank yourself later.
http://www.diffchecker.com/o8w67xm0
Mine is on the left.
Java is case sensitive, having that capitalized will throw an error.
Ahh i did not take any looks at the code. I thought you were just talking about naming conventions and not case sensitivity, my mistake.
DatSik
06-26-2014, 04:10 PM
oh wow.. and i thought i was being careful... Thank you so much, i appreiate it man
Zhendos
12-22-2014, 06:30 PM
Nice tutorial, NKN.
http://i61.tinypic.com/2yzj7rc.jpg
I've a few questions:
1) http://i57.tinypic.com/2ev9kjq.png
2) http://i62.tinypic.com/2q18ifp.png
Could you tell me some more information about number 2 and 3?
Zhendos
12-23-2014, 12:28 PM
Nice tutorial, NKN!
http://i57.tinypic.com/vno610.png
I've a few questions:
1) http://i58.tinypic.com/2z57rqf.png
2) http://i58.tinypic.com/qpnp5l.png
Could you tell me something more about number 2 and 3? Their function and how they works?
Thank you!
o0Matthius0o
03-01-2015, 12:29 PM
Great tutorial, but at my level it might as well be in another language XD
the bank
03-02-2015, 05:30 PM
I don't get it? This is supposedly a tutorial on injection, yet references absolutely no methods of injection what so ever. Plus you import the ASM API then don't even use it.
This is a tutorial on creating a loader. Not on injection. Infact, if you understood the first thing about what "injection" is you would realize it has literally nothing to do with loading a runescape client.
And no, this isn't the "basics" or first part in a series...its a completely different subject matter.
I mean no disrespect, but perhaps you should learn what you're talking about before you try and talk about it.
Now, treating this guide as a "How to Make a RS Loader" tutorial, I also have more points.
1: Code, Width, Height, and Archive all require specific regular expressions to add to your parameters, and aren't implemented properly in your code. Withotu these your risk of a ban sky rockets.
private final String codeRegex = "code\\=([^ >]*)";
private final String widthRegex = "width\\=([^ >]*)";
private final String heightRegex = "height\\=([^ >]*)";
private final String archiveRegex = "archive\\=([^ >]*)";
2: Your user agent is like 7 years old. Did you find it in an old tutorial? Maybe one of mine? Use a newer one. Also check for running os, because if they differ = ban.
static {
String osname = System.getProperty("os.name");
String windowing = "X11";
if (osname.contains("Windows")) windowing = "Windows";
else if (osname.contains("Mac")) windowing = "Macintosh";
USER_AGENT = "Mozilla/5.0 (" + windowing + "; U; " + osname + " " + System.getProperty("os.version") + "; " + Locale.getDefault().getLanguage()+"-"+Locale.getDefault().getCountry()+"; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10";
}
private String useragent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0"; //(This is still pretty old)
3: You didn't specify a protocol for your web functions, or a proper useragent for Java.
clientConnection.addRequestProperty("Protocol", "HTTP/1.1");
clientConnection.addRequestProperty("Connection", "keep-alive");
clientConnection.addRequestProperty("Keep-Alive", "200");
//This useragent it for the java plugin, probably shouldn't mess with it
clientConnection.addRequestProperty("User-Agent", "Mozilla/4.0 (" + System.getProperty("os.name") + " " + System.getProperty("os.version") + ") Java/" + System.getProperty("java.version"));
4: Your naming, syntax, and use of inheritance is piss fucking poor. Main extends AppletStub? Lol. C'mon you can do better!
Once again, no disrespect but if you're going to make a tutorial, make sure you actually know the subject matter you're trying to teach. And more so, name your tutorial properly.
botscaper
12-22-2017, 11:41 PM
Oh man this looks really nice, I want to be able to create a custom client but I have no idea where to learn how to do that. I only have some very basic knowledge of java, like methods, arrays, and loops. Does anyone know where I can start learning how to do things like this? I'd obviously start small with personal projects and stuff until I have it down, and then maybe later try to attempt something like this.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.