Page 3 of 3 FirstFirst 123
Results 51 to 65 of 65

Thread: [Tutorial] [Part I] Runescape Injection Basics

  1. #51
    Join Date
    Mar 2012
    Location
    Oklahoma
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    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??
    Code:
    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);
            }
    
            }

  2. #52
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Quote Originally Posted by DatSik View Post
    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??
    Code:
    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?

  3. #53
    Join Date
    Mar 2012
    Location
    Oklahoma
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    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

  4. #54
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Quote Originally Posted by DatSik View Post
    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.

  5. #55
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    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.

  6. #56
    Join Date
    Mar 2012
    Location
    Oklahoma
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Quote Originally Posted by Kasi View Post
    It is convention, But it is not wrong.
    Quote Originally Posted by NKN View Post
    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.

    Code:
    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\company\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

  7. #57
    Join Date
    Mar 2012
    Location
    Oklahoma
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    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


  8. #58
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Quote Originally Posted by Kasi View Post
    It is convention, But it is not wrong.
    Java is case sensitive, having that capitalized will throw an error.
    Quote Originally Posted by DatSik View Post
    Also, here is a quick GIF just to show what its looking like for me

    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.

  9. #59
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    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.

  10. #60
    Join Date
    Mar 2012
    Location
    Oklahoma
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    23 Post(s)

    Default

    oh wow.. and i thought i was being careful... Thank you so much, i appreiate it man

  11. #61
    Join Date
    Dec 2014
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Nice tutorial, NKN.


    I've a few questions:
    1)

    2)

    Could you tell me some more information about number 2 and 3?

  12. #62
    Join Date
    Dec 2014
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Nice tutorial, NKN!


    I've a few questions:
    1)
    2)

    Could you tell me something more about number 2 and 3? Their function and how they works?

    Thank you!

  13. #63
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Great tutorial, but at my level it might as well be in another language XD

  14. #64
    Join Date
    Dec 2010
    Posts
    483
    Mentioned
    30 Post(s)
    Quoted
    328 Post(s)

    Default

    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.

    Java Code:
    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.

    Java Code:
    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";
        }
    Java Code:
    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.
    Java Code:
    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.

  15. #65
    Join Date
    Dec 2017
    Posts
    11
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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.

Page 3 of 3 FirstFirst 123

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •