Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import java.net.Proxy;
  2.  
  3. import net.minecraft.util.Session;
  4.  
  5. import com.mojang.authlib.Agent;
  6. import com.mojang.authlib.exceptions.AuthenticationException;
  7. import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
  8. import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication;
  9.  
  10. /*
  11. * Author: Opim10
  12. * Version: 1
  13. * Use: Yggdrasil Utils for YggdrasilAuthenticator;
  14. */
  15.  
  16. public class YggdrasilPayload {
  17.  
  18. public static Session loginPassword(String username, String password)
  19. {
  20. if(username == null || username.length() <= 0 || password == null || password.length() <= 0)
  21. return null;
  22.  
  23. YggdrasilAuthenticationService a = new YggdrasilAuthenticationService(Proxy.NO_PROXY, "");
  24. YggdrasilUserAuthentication b = (YggdrasilUserAuthentication)a.createUserAuthentication(Agent.MINECRAFT);
  25. b.setUsername(username);
  26. b.setPassword(password);
  27. try
  28. {
  29. b.logIn();
  30. return new Session(b.getSelectedProfile().getName(), b.getSelectedProfile().getId().toString(), b.getAuthenticatedToken(), "mojang");
  31. } catch (AuthenticationException e)
  32. {
  33. e.printStackTrace();
  34. System.out.println("Failed login: "+username+":"+password);
  35. }
  36. return null;
  37. }
  38.  
  39. public static Session loginCrack(String username)
  40. {
  41. return new Session(username, "", "", "mojang");
  42. }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement