-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMain.java
More file actions
118 lines (91 loc) · 3.74 KB
/
Main.java
File metadata and controls
118 lines (91 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import org.openqa.selenium.*;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.LinkedList;
import java.util.concurrent.TimeUnit;
public class Main {
public static void main(String[] args) throws IOException {
String CURR_DIR = System.getProperty("user.dir");
if (System.getProperty("os.name").equals("Linux")) {
File chromeFile = new File(CURR_DIR + "/linux/chromedriver");
System.setProperty("webdriver.chrome.driver", chromeFile.getAbsolutePath());
} else if (System.getProperty("os.name").startsWith("Windows")) {
File chromeFile = new File(CURR_DIR + "/windows/chromedriver.exe");
System.setProperty("webdriver.chrome.driver", chromeFile.getAbsolutePath());
} else {
File chromeFile = new File(CURR_DIR + "/mac/chromedriver");
System.setProperty("webdriver.chrome.driver", chromeFile.getAbsolutePath());
}
WebDriver driver = new ChromeDriver();
driver.get("https://www.jklm.fun");
driver.manage().window().maximize();
Path filePath = new File(CURR_DIR + "/wordlist.txt").toPath();
Charset charset = Charset.defaultCharset();
List<String> stringList = Files.readAllLines(filePath, charset);
String[] wordlist = stringList.toArray(new String[] {});
while (true) {
if ((driver.findElements(By.xpath("/html/body/div[2]/div[4]/div[1]/iframe")).size() > 0)) {
try {
driver.switchTo().frame(0); // Switch to correct iframe
if (!(driver.findElements(By.xpath("/html/body/div[2]/div[3]/div[1]/div[1]/button"))
.size() > 0)) {
driver.switchTo().parentFrame();
}
} catch (Exception e) {
}
}
try {
if (!driver.findElement(By.xpath("/html/body/div[2]/div[3]/div[2]/div[1]")).isDisplayed()) {
if (driver.findElement(By.xpath("/html/body/div[2]/div[3]/div[1]/div[1]/button")).isDisplayed()) {
driver.findElement(By.xpath("/html/body/div[2]/div[3]/div[1]/div[1]/button")).click(); // Auto join
}
LinkedList<String> listOfWords = new LinkedList<>();
String syllable = driver.findElement(By.xpath("/html/body/div[2]/div[2]/div[2]/div[2]/div"))
.getText().toLowerCase();
System.out.println(syllable);
WebElement answerBox = driver
.findElement(By.xpath("/html/body/div[2]/div[3]/div[2]/div[2]/form/input"));
for (String line : wordlist) {
if (line.contains(syllable)) {
listOfWords.add(line);
}
}
int random = (int) (Math.random() * (listOfWords.size() - 0) + 0);
String matchingWord = listOfWords.get(random);
answerBox.click();
// TimeUnit.SECONDS.sleep((int) (Math.random() * (65 - 15) + 15) / 100);
for (char character : matchingWord.toCharArray()) {
int fail = (int) (Math.random() * (1000 - 0) + 0);
if (fail == 2) {
int loops = (int) (Math.random() * (3 - 0) + 0);
for (int i = 0; i < loops; i++) {
answerBox.sendKeys(Character.toString((char) ('A' + Math.random() * ('Z' - 'A' + 1))));
TimeUnit.SECONDS.sleep((int) (Math.random() * (5 - 2) + 2) / 60);
}
TimeUnit.MILLISECONDS.sleep(300);
for (int i = 0; i < loops; i++) {
answerBox.sendKeys(Keys.BACK_SPACE);
}
TimeUnit.MILLISECONDS.sleep(100);
answerBox.sendKeys(Character.toString(character));
} else {
answerBox.sendKeys(Character.toString(character));
TimeUnit.SECONDS.sleep((int) (Math.random() * (50 - 5) + 5) / 60);
}
}
answerBox.sendKeys(Keys.RETURN);
TimeUnit.MILLISECONDS.sleep(100);
}
} catch (Exception e) {
}
}
}
}