SRL Archive - RuneScape

Runescape Loader


lordsaturn

2010-06-27 00:24:29

Wee.. Another simple java based client loader. Attached jar with src.

package load;
import java.applet.Applet;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.DataInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import java.util.HashMap;

import javax.swing.JFrame;
import javax.swing.JPanel;


public class Loader extends JFrame implements AppletStub {

private static int world = 1;

private static final HashMap<String, String> parameters = new HashMap<String, String>();

public Loader(){
try {
declareParameters(false);
URL loadURL = new URL(getBaseURL().toExternalForm()+"runescape.jar");

URLClassLoader clientClassLoader = new URLClassLoader(new URL[] { loadURL });
Class clientClass = clientClassLoader.loadClass("client");
Applet loader = (Applet) clientClass.newInstance();
loader.setStub(this);

setTitle("Runescape Loader by lordsaturn v"+Loader.class.getPackage().getImplementationVersion());
JPanel theGame = new JPanel(new BorderLayout());
theGame.setPreferredSize(new Dimension(768, 560));
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(768, 560);

loader.init();
loader.start();
theGame.add(loader);
getContentPane().add(theGame, BorderLayout.CENTER);

} catch (Exception e) {
e.printStackTrace();
}
}

public void declareParameters(boolean hardcoded){
if (hardcoded){ //build 612
//<applet name="RuneScape" id="game" width="100%" height="100%" alt="Please visit http://www.runescape.com/kbase/guid/the_game_won_t_load for assistance" archive="loader-976989916.jar" code="loader.class" mayscript="">
parameters.put("name", "RuneScape");
parameters.put("id", "game");
parameters.put("width", "100%");
parameters.put("height", "100%");
parameters.put("alt", "Please visit http://www.runescape.com/kbase/guid/the_game_won_t_load for assistance");

parameters.put("archive", "loader-976989916.jar");
parameters.put("code", "loader.class");

parameters.put("cabbase", "loader-2057789173.cab");
parameters.put("java_arguments", "-Xmx102m -Dsun.java2d.noddraw=true");
parameters.put("colourid", "0");
parameters.put("worldid", Integer.toString(world));
parameters.put("lobbyid", "1103");//1100 - 1003
parameters.put("lobbyaddress", "lobby4.runescape.com"); //lobby1 - lobby4
parameters.put("demoid", "901");
parameters.put("demoaddress", "demoworld1.runescape.com");
parameters.put("modewhere", "0");
parameters.put("modewhat", "0");
parameters.put("lang", "0");
parameters.put("objecttag", "0");
parameters.put("js", "1");
parameters.put("game", "0");
parameters.put("affid", "0");
parameters.put("advert", "1");
parameters.put("settings", "wwGlrZHF5gKN6D3mDdihco3oPeYN2KFybL9hUUFqOvk");
parameters.put("country", "0");
parameters.put("haveie6", "0");
parameters.put("havefirefox", "0");
parameters.put("cookieprefix", "");
parameters.put("cookiehost", ".runescape.com");
parameters.put("cachesubdirid", "0");
parameters.put("crashurl", "http://www.runescape.com/slu.ws?j=1&amp;crash=1");
parameters.put("unsignedurl", "http://www.runescape.com/slu.ws?j=1");
parameters.put("sitesettings_member", "0");
parameters.put("frombilling", "false");
parameters.put("sskey", "");
parameters.put("force64mb", "false");
parameters.put("worldflags", "1");
parameters.put("userFlow", "4513017905689612128");
parameters.put("separate_jvm", "true");
}else
parseParams();
}

public void parseParams(){
try {
//get first page source
URL aURL = new URL("http://www.runescape.com/game.ws?j=1");
URLConnection uc = openConnection(aURL, "http://www.runescape.com/");
String pgSrc = getPageSource(uc);

//get second page url
int aIndex = pgSrc.indexOf("src")+5;
String aStr = pgSrc.substring(aIndex, pgSrc.indexOf("\"", aIndex));
aURL = new URL(aStr);

//get world number
aIndex = aStr.indexOf(".");
world = Integer.parseInt(aStr.substring(aIndex-2, aIndex));

//get second page source
uc = openConnection(aURL, uc.getRequestProperty("Referer"));
pgSrc = getPageSource(uc);

//get third page url
aIndex = pgSrc.indexOf("plugin");
aURL = new URL(getBaseURL().toExternalForm()+pgSrc.substring(aIndex, pgSrc.indexOf("\"", aIndex)));

//get third page source
uc = openConnection(aURL, uc.getRequestProperty("Referer"));
pgSrc = getPageSource(uc);

//get parameters
int firstIndex = pgSrc.indexOf("('", 0)+2;
int lastIndex = pgSrc.indexOf("')", firstIndex);
int lastCodePoint = firstIndex;
while (firstIndex >= lastCodePoint){
aStr = pgSrc.substring(firstIndex, lastIndex);
aIndex = aStr.indexOf("=");
if ((aIndex != -1) && !aStr.contains("<div") && !aStr.contains("<br")){
if (!aStr.contains("param")){ //applet config
int firstSpaceIndex = 0, lastSpaceIndex = aStr.indexOf(" ");
while (firstSpaceIndex < lastSpaceIndex){//multiple params per line
if (aStr.charAt(aIndex+1) == '"'){ //use quotes to find lastSpaceIndex
lastSpaceIndex = aIndex+2;
while (aStr.charAt(lastSpaceIndex++) != '"') ;
}
parameters.put(aStr.substring(firstSpaceIndex, aIndex),
aStr.substring(aIndex+1, lastSpaceIndex).replaceAll("\"", ""));
firstSpaceIndex = lastSpaceIndex+1;
lastSpaceIndex = aStr.indexOf(" ", firstSpaceIndex);
aIndex = aStr.indexOf("=", aIndex+1);
}
}else{
parameters.put(aStr.substring(aIndex+1, aStr.indexOf(" ", aIndex)).replaceAll("\"", ""),
aStr.substring(aStr.indexOf("=", aIndex+1)+1, aStr.indexOf(">")).replaceAll("\"", ""));
}
}
lastCodePoint = firstIndex;
firstIndex = pgSrc.indexOf("('", firstIndex)+2;
lastIndex = pgSrc.indexOf("')", firstIndex);
}



} catch (Exception e) {
e.printStackTrace();
}
}

public URL getBaseURL(){
URL u = null;
try {
u = new URL("http://world"+world+".runescape.com/");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return u;
}

public URLConnection openConnection(URL at, String referer){
URLConnection uc = null;
try{
uc = at.openConnection();

uc.addRequestProperty("Accept", "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5");
uc.addRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.3");
uc.addRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
uc.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
uc.addRequestProperty("Connection", "keep-alive");
uc.addRequestProperty("Host", "runescape.com");
uc.addRequestProperty("Referer", referer);
uc.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4");
}catch (Exception e){
e.printStackTrace();
}
return uc;
}

public String getPageSource(URLConnection uc){
byte[] buffer = null;
try{
DataInputStream di = new DataInputStream(uc.getInputStream());
buffer = new byte[uc.getContentLength()];
di.readFully(buffer);
di.close();
//Thread.sleep(250 + (int) Math.random() * 500);
return new String(buffer);
}catch (Exception e){
e.printStackTrace();
}
return new String(buffer);
}

public void load(){}

public static void main(String[] args) {
new Loader().setVisible(true);
}

@Override
public void appletResize(int arg0, int arg1) {
// TODO Auto-generated method stub

}

@Override
public AppletContext getAppletContext() {
// TODO Auto-generated method stub
return null;
}

@Override
public URL getCodeBase() {
return getBaseURL();
}

@Override
public URL getDocumentBase() {
return getBaseURL();
}

@Override
public String getParameter(String arg0) {
return parameters.get(arg0);
}

}


YoHoJo

2010-06-27 00:51:51

Awesome stuff :D! Now keep adding to it and make it an awesome runescape client with tons of tools and utilities!

Frement

2010-06-27 00:53:08

From: YoHoJo
Awesome stuff :D! Now keep adding to it and make it an awesome runescape client with tons of tools and utilities!


Yeah, with automatic Simba download and hyperlink to villavu! :D

YoHoJo

2010-06-27 00:55:09

Calculators, Hiscores, Maps, Timers, GE Lookup, Treasure Trail Helpers, SRL Built In, and then add WoW support, Starcraft Support, Xbox Support, PS3 Support, Ds Emulator, MP3 Player, and Blue Ray. That's what I would do man! Jus' Sayin'

i luffs yeww

2010-06-27 01:47:26

^ Out of those, I assume only the first seven are valid (I like the mp3 player, actually).

TRiLeZ

2010-06-27 03:36:21

Nice. Why don't you use the loader instead of the client so it will load signed? Also, use regex to parse the parameters.


parameters.put("archive", "loader-976989916.jar");
parameters.put("code", "loader.class");
You're not using the loader… I also suggest you don't have the option for hard coded params.

Gu3st...

2010-06-27 06:07:50

From: YoHoJo
Calculators, Hiscores, Maps, Timers, GE Lookup, Treasure Trail Helpers, SRL Built In, and then add WoW support, Starcraft Support, Xbox Support, PS3 Support, Ds Emulator, MP3 Player, and Blue Ray. That's what I would do man! Jus' Sayin'
Don't forget wi-fi, magnifying glass, frying pan, color picker, Steam Built In, Short-keys to your favorite games…