SRL Archive - Reflection Tutorials

Contributing Original Research / Creating NEW Reflection Things


BenLand100

2010-12-14 12:10:55

If you want to do something that you can't mooch off someone else (easily), then you have to actually know what you are doing and get down and dirty with the runescape client.

There are two basic routes you can take — decompile the runescape jar (nearly impossible to do completely / correctly, i.e. it will not recompile after you decompile it, but its good pseudo code), or view the bytecode directly (provided you know bytecode well enough, you can do this and make on the fly edits if you so choose; this is the method you will eventually have to take if you plan on writing an updater/adding to an existing updater).

Firstly, you need stuff to work on — download a runescape.jar and extract it. If you find yourself wondering how to extract it, you probably need to stop here and do some learning about java. If you just need a pointer, JAR archives are the same format as ZIP archives (quick and dirty method, change extension to zip and use you favorite extractor. The stuff inside are the java binary files (.class), and the directory structure (there really isn't one in the runescape jar) would be the package structure. There are a lot of class files, you need them all.

Decompiling: Get a decompiler. JAD (which seems to have disappeared since I was active, but it is mirrored here: http://www.varaneckas.com/jad) is a nice simple decompiler that I used to use, it's at least got a windows version (might be only for windows but runs in wine just fine). There are probably other decompilers out there, so ask around in the java-based hacking forums and see what the new cool toy is. Decompile all of the class files to get something that looks like java source code. It won't be exactly java source code because Jagex takes steps called obfuscation which basically scrambles the bytecode into a form that can't be (easily) decompiled, but still runs in the JVM just fine. NOTE: the java hackers that are up to date on their shit might know exactly how jagex obfuscates (this was the case quite a while ago) and could provide you with what is called an "unobsfucated jar" which would decompile perfectly for you. In this case, it might make it easier, but you won't be looking at the same bytecode in the jar, so its useless for hooking, just good for searching with your eyes. To that end, a "renamed jar" would have meaningful names in place of the single/two character names that Jagex replaces all symbols with, which might be useful for searching, but you will need to know the "actual" obfuscated name of the fields/classes in order to make a path.

Bytecode: Learn bytecode, at least some. DON'T EVEN TRY TO DO THIS IF YOU DON'T KNOW BYTECODE WELL ENOUGH TO GUESS WHAT SOURCE CODE IT WAS DERIVED FROM. Seriously, you will just be wasting your own time and the time of anyone you ask for help. Arguably, this is the more powerful method to use, as you can find your hooks and your paths at the same time. Get a dynamic bytecode viewer (my personal preference, however the program that I used to use does not exist anymore, but this is pretty good http://www.cs.ioc.ee/~ando/jbe/), OR a program that dumps the bytecode in human readable form. Then, dive in. A word to the wise, learn to look for unique patterns in bytecode that can be used to identify your hooks — this is the basic principle that updaters work on.

Okay, so what now? Well you either decided to dig through source code or bytecode, look for the part of the client that does the thing you want to do, e.g. if you want to find the interface positions, look for the part that lays out the interfaces on the screen. Observe the code; see how the client does it, what fields it uses, what algorithm it uses. Then take what you learned, make it into pascal code using the SMART interface to read the fields, and voila, you contributed something original. I'm proud of you, you should be a reflection dev. ;) If you want to take it some steps further, observe the bytecode of the code you examined. Look for a way to uniquely identify that code from ALL the other code in the client. Learn a bytecode manipulator like BCEL (my personal preference), and write code to search for that code section in the client. Now you have an updater that can find the path automatically from client version to client version (this is important since the names change, though you could find it manually every time).

Things you should know / common pitfalls:


  • Bytecode is obfuscated so it is a little different every time. Jagex does this specifically to prevent things like updater from working (this was stepped up significantly after Aryan, so it might be more accurate to say it was added to prevent people from decompiling and refactoring the client)
  • Last time I checked, Method (or someone) had something he called a "refactored client" which was really just a deobfuscated and renamed client, I don't think he actually did any refactoring. Anyway, it is an excellent resource for learning how the client works, I suggest you find his (or someone's) and learn.
  • Static variables and methods are NEVER in the same place. They are shuffled around through the various classes in the client just to confuse you.
  • Names are NEVER the same and have no significance (with the client class being the exception, you can always find it. at least, i assume that is still the case)
  • This is not easy and takes a LOT of effort. When the code changes, updaters usually break and you have to manually go in and fix them.
  • The client is HUGE, so don't expect to easily find anything
  • You really do need background information on how the client functions and a very good understanding of java. I'm not just saying this to discourage you. If you don't know what you are doing, you will end up like Cstrike and go ask so many stupid questions, to someone that does know what they are doing, that you piss them off and they rage at you until you run away with your tail between your legs.

i luffs yeww

2010-12-14 12:20:27

"If you don't know what you are doing, you will end up like Cstrike and go ask so many stupid questions to someone that does know what they are doing, that you piss hem off and they rage at you until you run away with your tail between your legs." I lol'd.

:) I'm liking that you're posting this stuff. Very helpful. Granted I won't do anything with it because I don't wanna waste my or anyone else's time, but hopefully we can get some good contributions sooner or later.

HyperSecret

2010-12-14 12:56:40

I like the bullet-points.

Do you know of any other places other than MITB and RS-Hacking to learn this?

BenLand100

2010-12-14 13:01:53

From: HyperSecret
I like the bullet-points.

Do you know of any other places other than MITB and RS-Hacking to learn this?

Yes I do, but you won't like the answer.

I would say you can learn it all by yourself. When I and the others that spearheaded this type thing were doing it, we basically made it up as we went. There weren't any "guides" or "tutorials" or even general ideas. We just knew enough about how the language functioned to use it to our advantage. I guess, then, you could go learn about java and then you would be able to do it.

BenLand100

2010-12-14 14:09:37

We seem to have a serious problem with Hobbit who thinks he has the right to modify and control discussion however he sees fit without discussing it with anyone. The posts he physically removed were between Squancy, myself, and mormonman. Basically, Squancy called me an asshole for referring to Cstrike in my original post because I didn't keep private shit private. I said it was hypocritical to post that here. He said the forums are getting more and more like RSBot. And mormonman said it was nothing like RSBot because 50 people weren't here flaming him.

Dear Hobbit, don't be a dick and delete this. This is not your thread, your post, etc. You have no right.

Overtime

2010-12-14 14:21:39

He has every right considering you got rid of active SRL contributer.

Not only did i join this forum 4 years ago, i came upon this forum for questions to be answered

If it was help question in math, english, SRL ,java, etc. I knew it would be answered.

Not bash down on other members calling them noobs, learn your shit, etc.

Which is why I think of this forum as a RS-Bot community.

There are numerous of people asking for help, and there are "assholes" who just bash on them till they leave.

Im not pointing fingers, but there are also people who provide better help here than my ISP provider.

I have respect for you BenLand, but these childish acts has caused an active Reflection developer to leave a community that he thinks of now as a bunch of "assholes".

Thanks again for your great work.

Keep it up.

Troll

2010-12-14 14:25:31

Squancy is right, also he may of asked a lot of questions but when i asked him for help he was always more then happy to help to help me

BenLand100

2010-12-14 14:26:34

From: Squancy
He has every right considering you got rid of active SRL contributer.

This was discussed in another topic already (provided Hobbit hasn't physically removed it), however, it is worth noting that it was his decision to leave, and I bashed him for telling me he didn't need to / wasn't going to learn how to do what he wanted to do and expected me to do it for him, which arguably is not something a developer should do. If he left simply because I told him he didn't know what he was doing (which is what happened), there were other issues beyond what I was involved with. It is, I suppose, open to interpretation as to whether or not that is out of line, but regardless, I never asked him to leave.

Per Hobbit's watchful/obsessive compulsive/psychotic eye, you're probably better off continuing this in another thread or on IRC if you wish. Apparently there is something wrong with discussion here.

3Garrett3

2010-12-14 14:44:31

At least stay on the topic. This was a legit topic useful to other people's learning, and you went and fucked it up by arguing about ridiculous shit.

Here's some advice. Grow up. Have a good discussion/debate elsewhere, but being dicks to eachother on a topic that is actually helpful is childish and makes you all look like assholes.

BenLand100

2010-12-14 14:53:02

I think we got it covered. ANYWAY, here is a bytecode viewer that I have used before, its pretty neat (but doesn't have many good searching abilities, which would be nice to have).

http://www.cs.ioc.ee/~ando/jbe/

It's worth looking at if you're interested.

Home

2010-12-14 14:55:01

Don't start flaming or anything and yes this is offtopic.

Most of the forum users don't like newcomers, deal with it, 
but if you're nice to them, they'll be nice to you.


~Home

Sir R. M8gic1an

2011-01-16 18:35:17

No, Hobbit does indeed have no right to physically delete such posts. Ben's an Admin too.

~RM

Hobbit

2011-01-16 21:14:28

From: Sir R. Magician
No, Hobbit does indeed have no right to physically delete such posts. Ben's an Admin too.

~RM


Over 1 month old.
And even if it wasn't, this doesn't concern you. This was between Ben and I and Wizzup if he chose to get involved. But not you. (If we're going off how you view things)

BenLand100

2011-01-16 21:42:11

From: Sir R. Magician
No, Hobbit does indeed have no right to physically delete such posts. Ben's an Admin too.

~RM

Regardless, we both physically deleted things, and I was just being an asshole as usual. Nothing to see here, folks.

The Claw

2011-01-16 22:15:34

Lmao. Back on topic…;)