Tezlaz

Acc creater

Aug 6th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.58 KB | None | 0 0
  1. package scripts.tools;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.net.HttpURLConnection;
  8. import java.net.URL;
  9. import java.net.URLEncoder;
  10. import java.util.Random;
  11.  
  12. public class AccountCreator {
  13.  
  14. public static boolean createAccount(String email, String name, String password) {
  15. String SUBSTR_BLOCKED = "blocked from creating too many";
  16. String SUBSTR_TAKEN = "passwords you have";
  17. String SUBSTR_CREATED = "Click the link we have included in the confirmation email.";
  18. // Get random age to use when creating the account
  19. Random r = new Random();
  20. int age = 18 + r.nextInt(10);
  21. try {
  22. String urlParameters = "onlyOneEmail=" + URLEncoder.encode("1", "UTF-8") + "&age="
  23. + URLEncoder.encode("" + age, "UTF-8") + "&displayname_preset=" + URLEncoder.encode("true", "UTF-8")
  24. + "&displayname=" + URLEncoder.encode(name, "UTF-8") + "&email1="
  25. + URLEncoder.encode(email, "UTF-8") + "&password1=" + URLEncoder.encode(password, "UTF-8")
  26. + "&password2=" + URLEncoder.encode(password, "UTF-8") + "&agree_pp_and_tac="
  27. + URLEncoder.encode("1", "UTF-8") + "&submit=" + URLEncoder.encode("Join Now", "UTF-8");
  28. URL ur = new URL("https://secure.runescape.com/m=account-creation/g=oldscape/create_account_funnel.ws");
  29. HttpURLConnection yc = (HttpURLConnection) ur.openConnection();
  30. yc.setDoOutput(true);
  31. yc.setDoInput(true);
  32. HttpURLConnection.setFollowRedirects(true);
  33. yc.setRequestMethod("POST");
  34. yc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
  35. yc.setRequestProperty("charset", "utf-8");
  36. yc.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
  37. yc.setUseCaches(false);
  38. DataOutputStream wr = new DataOutputStream(yc.getOutputStream());
  39. wr.writeBytes(urlParameters);
  40. wr.flush();
  41. wr.close();
  42. BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
  43. String inputLine;
  44. while ((inputLine = in.readLine()) != null) {
  45. if (inputLine.contains(SUBSTR_TAKEN)) {
  46. // Account name taken
  47. System.out.println("NAME TAKEN");
  48. } else if (inputLine.contains(SUBSTR_BLOCKED)) {
  49. // Blocked for creating too many accounts
  50. System.out.println("BLOCKED");
  51. } else if (inputLine.contains(SUBSTR_CREATED)) {
  52. // Account successfully created
  53. System.out.println("SUCESS");
  54. in.close();
  55. return true;
  56. }
  57. }
  58. in.close();
  59. } catch (IOException e) {
  60. e.printStackTrace();
  61. }
  62. return false;
  63. }
  64.  
  65. }
Add Comment
Please, Sign In to add comment