Thread: 100% Working URLClassLoader Client

Results 1 to 10 of 10
  1. #1 100% Working URLClassLoader Client 
    Community Veteran


    Join Date
    Dec 2008
    Posts
    4,264
    Thanks given
    405
    Thanks received
    432
    Discord
    View profile
    Rep Power
    1684
    Well, here is something I was quite proud of. If you use this, the client the uses will download is only 5kb. It uses your webclients archive and loads that.

    Don't ask me how to get it working for your server, because I won't help.

    Note: This was STRICTLY made for MY server, you will need to edit the substrings, etc for it to work for you(most people wont be able to get it to work for them).

    Code:
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import java.net.*;
    
    import javax.imageio.ImageIO;
    import javax.swing.*;
    
    public class Launcher {
    
    	public static JFrame clientFrame;
    	public static JPanel clientPanel = new JPanel();
    
    	public static void main(String[] args) {
    		try {
    			String pageSource = getPageSource();
    			String fileLocation = pageSource.substring(pageSource.indexOf("archive=")+9, pageSource.indexOf("archive=")+31);
    			URL url = new URL("http://play.silvarea.com/"+fileLocation);
    			URLClassLoader classLoader = new URLClassLoader(new URL[]{(url)});
    			Applet client = (Applet) classLoader.loadClass("Loader").newInstance();
    			client.init();
    			client.start();
    			clientFrame = new JFrame("Silvarea Client | Version: "+getWebVersion());
    			clientFrame.setLayout(new BorderLayout());
    			clientPanel.setLayout(new BorderLayout());
    			clientPanel.add(client);
    			clientPanel.setPreferredSize(new Dimension(800, 540));
    			clientFrame.getContentPane().add(clientPanel, "Center");
    			InputStream stream = Launcher.class.getResourceAsStream("/icons/icon.png");
    			BufferedImage image = ImageIO.read(stream);
    			clientFrame.setIconImage(image);
    			clientFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    			clientFrame.pack();
    			clientFrame.setVisible(true);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    	}
    
    	public static String getPageSource() throws IOException {
    		URL website = new URL("http://play.silvarea.com/");
    		HttpURLConnection connection = (HttpURLConnection) website.openConnection();
    		connection.setRequestMethod("GET");
    		InputStream input = connection.getInputStream();
    		ByteArrayOutputStream output = new ByteArrayOutputStream();
    		byte[] buffer = new byte[1024];
    		int bytes = 0;
    		while((bytes = input.read(buffer)) != -1) {
    			output.write(buffer, 0, bytes);
    		}
    		input.close();
    		output.close();
    		return new StringBuilder().append(output).toString();
    	}
    
    	public static double getWebVersion() throws IOException {
    		String pageSource = getPageSource();
    		String fileLocation = pageSource.substring(pageSource.indexOf("archive=")+9, pageSource.lastIndexOf(".jar")+4);
    		double version = Double.parseDouble(fileLocation.substring(15, fileLocation.length()-4));
    		return version;
    	}
    
    }
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Gunner4Life Market Banned Market Banned



    Join Date
    Jun 2011
    Posts
    2,357
    Thanks given
    132
    Thanks received
    666
    Rep Power
    648
    we kind of new this from when lubricant had RAT.Java in pulsescape release
    Reply With Quote  
     

  4. #3  
    Banned

    Join Date
    Mar 2010
    Posts
    1,048
    Thanks given
    239
    Thanks received
    226
    Rep Power
    0
    Quote Originally Posted by Humid View Post
    we kind of new this from when lubricant had RAT.Java in pulsescape release
    Reply With Quote  
     

  5. #4  
    Banned
    Join Date
    Jun 2012
    Age
    25
    Posts
    709
    Thanks given
    521
    Thanks received
    87
    Rep Power
    0
    Nice work i suppose
    Reply With Quote  
     

  6. #5  
    Community Veteran


    Join Date
    Dec 2008
    Posts
    4,264
    Thanks given
    405
    Thanks received
    432
    Discord
    View profile
    Rep Power
    1684
    Quote Originally Posted by Humid View Post
    we kind of new this from when lubricant had RAT.Java in pulsescape release
    I'm not telling you to run this.... I'm saying use this to make it work for your server
    Reply With Quote  
     

  7. #6  
    Renown Programmer and Respected Member
    Maxi's Avatar
    Join Date
    Jun 2008
    Posts
    3,201
    Thanks given
    281
    Thanks received
    1,093
    Rep Power
    1366
    Ziotic has a loader with more functionality, you could look at it to improve yours further
    Reply With Quote  
     

  8. Thankful user:


  9. #7  
    Super Donator


    Join Date
    Sep 2008
    Age
    27
    Posts
    1,897
    Thanks given
    677
    Thanks received
    776
    Rep Power
    456
    1 issue is that if your site goes down, the client won't be able to load.
    Reply With Quote  
     

  10. #8  
    Community Veteran


    Join Date
    Dec 2008
    Posts
    4,264
    Thanks given
    405
    Thanks received
    432
    Discord
    View profile
    Rep Power
    1684
    Quote Originally Posted by Maxi View Post
    Ziotic has a loader with more functionality, you could look at it to improve yours further
    Will do. Thanks


    Quote Originally Posted by Roboyto View Post
    1 issue is that if your site goes down, the client won't be able to load.
    True, but there are other alternatives you could use
    Reply With Quote  
     

  11. #9  
    Banned

    Join Date
    Sep 2009
    Posts
    1,878
    Thanks given
    411
    Thanks received
    1,637
    Rep Power
    0
    Alternative to that issue is that you can check if the connection times out to use a downloadable client, pretty simple.

    Good job @ release.
    Reply With Quote  
     

  12. Thankful user:


  13. #10  
    Banned

    Join Date
    Jun 2010
    Age
    23
    Posts
    4,836
    Thanks given
    1,676
    Thanks received
    1,563
    Discord
    View profile
    Rep Power
    0
    Used a piece of this for my ClientLoader. Thanks.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Replies: 10
    Last Post: 02-03-2011, 12:32 AM
  2. Replies: 0
    Last Post: 08-31-2010, 06:38 AM
  3. Need a Swats client 2010 100% working with [PI]
    By AFGscape in forum Requests
    Replies: 4
    Last Post: 08-25-2010, 01:48 AM
  4. Fully Working 503 Compiler - 100% by me - JDK 4 And 5 working
    By Inspired Dreams in forum Configuration
    Replies: 4
    Last Post: 08-03-2008, 02:23 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •