Advertisement
Guest User

ddddd

a guest
Jun 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1.  
  2. package easyxyzspammer;
  3.  
  4. import com.gargoylesoftware.htmlunit.BrowserVersion;
  5. import com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController;
  6. import com.gargoylesoftware.htmlunit.SilentCssErrorHandler;
  7. import com.gargoylesoftware.htmlunit.WebClient;
  8. import com.gargoylesoftware.htmlunit.html.DomElement;
  9. import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
  10. import com.gargoylesoftware.htmlunit.html.HtmlButton;
  11. import com.gargoylesoftware.htmlunit.html.HtmlButtonInput;
  12. import com.gargoylesoftware.htmlunit.html.HtmlInput;
  13. import com.gargoylesoftware.htmlunit.html.HtmlPage;
  14. import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
  15. import java.io.BufferedReader;
  16. import java.io.FileReader;
  17. import java.io.IOException;
  18. import static java.lang.Thread.sleep;
  19. import java.util.ArrayList;
  20. import java.util.Random;
  21. import java.util.logging.Level;
  22. import javax.swing.JOptionPane;
  23.  
  24.  
  25. public class EasyXyzSpammer {
  26.  
  27. static ArrayList<String> allNames = new ArrayList<>();
  28. static ArrayList<HtmlPage> allSetupNamePages = new ArrayList<>();
  29. static ArrayList<HtmlPage> allOnGamePages = new ArrayList<>();
  30. public static void main(String[] args) throws Exception {
  31. String gameId = JOptionPane.showInputDialog("Enter Game Id");
  32. final String SIGNINPAGELINK = "https://pyx-1.pretendyoure.xyz/zy/game.jsp#game="+gameId;
  33.  
  34. java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
  35. System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
  36. //load name array
  37. String testName;
  38. Random rand = new Random();
  39. int randomNameNum = 0;
  40. String nameUsed = "";
  41. boolean eof = false;
  42. try {
  43.  
  44. BufferedReader reader = new BufferedReader(new FileReader("src/easyxyzspammer/names.txt"));
  45. while(!eof) {
  46. testName = reader.readLine();
  47. if(testName != null) {
  48. allNames.add(testName);
  49. } else {
  50. eof = true;
  51. System.out.println("Loaded Name Array, Continuing Program...");
  52. }
  53. }
  54.  
  55. } catch (IOException e) {
  56. System.out.println("IO Exception Caught: " + e);
  57. }
  58.  
  59. try (final WebClient xyzClient = new WebClient(BrowserVersion.BEST_SUPPORTED)) {
  60. xyzClient.getOptions().setThrowExceptionOnScriptError(false);
  61. xyzClient.setJavaScriptTimeout(10000);
  62. xyzClient.getOptions().setJavaScriptEnabled(true);
  63. xyzClient.getOptions().setThrowExceptionOnScriptError(false);
  64. xyzClient.getOptions().setCssEnabled(false);
  65. xyzClient.setAjaxController(new NicelyResynchronizingAjaxController());
  66. xyzClient.getOptions().setTimeout(10000);
  67. xyzClient.setCssErrorHandler(new SilentCssErrorHandler());
  68. for(int j = 0; j < 20; j++) {
  69. System.out.println("Run: " + j + "\n ");
  70. randomNameNum = rand.nextInt(allNames.size()) + 0;
  71. allSetupNamePages.add(xyzClient.getPage(SIGNINPAGELINK));
  72.  
  73. HtmlInput setNickname = allSetupNamePages.get(j).getHtmlElementById("nickname");
  74. xyzClient.waitForBackgroundJavaScriptStartingBefore(100);
  75. setNickname.reset();
  76. setNickname.type(allNames.get(randomNameNum));
  77. nameUsed = allNames.get(randomNameNum);
  78. xyzClient.waitForBackgroundJavaScriptStartingBefore(300);
  79. System.out.println("Set Nickname Successfully!, Continuing To Game Page...");
  80.  
  81. HtmlButtonInput goToGamePageButton = allSetupNamePages.get(j).getHtmlElementById("nicknameconfirm");
  82. allOnGamePages.add(goToGamePageButton.click());
  83. xyzClient.waitForBackgroundJavaScript(200);
  84. System.out.println("Joined Game: " + gameId + " With Name: " + nameUsed + " Successfully!\n");
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement