Initial commit

This commit is contained in:
5vl 2023-03-18 17:02:34 +01:00
commit 0ff9351b1c
4 changed files with 208 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

27
.gitignore vendored Normal file
View File

@ -0,0 +1,27 @@
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
.idea/
target/

118
pom.xml Normal file
View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>PointGetter</artifactId>
<groupId>me.fivevl</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>PointGetter</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<kotlin.code.style>official</kotlin.code.style>
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
</properties>
<repositories>
<repository>
<id>mavenCentral</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.8.0</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>me.fivevl.dsbot.MainKt</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>me.fivevl.pointgetter.Main</mainClass>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
<version>1.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,61 @@
package me.fivevl.pointgetter
import java.awt.Robot
import java.awt.event.KeyEvent
import kotlin.random.Random
object Main {
private val r = Robot()
@JvmStatic
fun main(args: Array<String>) {
for (i in 3 downTo 1) {
println("Seconds left to destruction: $i")
Thread.sleep(1000)
}
for (i in 1..34) {
println("Searched for ${sendRandomText()}, iteration $i on 'PC' mode")
Thread.sleep(1000)
}
r.keyPress(KeyEvent.VK_CONTROL)
r.keyPress(KeyEvent.VK_SHIFT)
r.keyPress(KeyEvent.VK_I)
r.keyRelease(KeyEvent.VK_CONTROL)
r.keyRelease(KeyEvent.VK_SHIFT)
r.keyRelease(KeyEvent.VK_I)
Thread.sleep(1000)
for (i in 1..20) {
println("Searched for ${sendRandomText()}, iteration $i on 'Phone' mode")
Thread.sleep(1000)
}
println("Done!")
}
private fun sendRandomText(): String {
val rand = Random.nextLong(10000000, 99999999).toString()
r.keyPress(KeyEvent.VK_ALT)
r.keyPress(KeyEvent.VK_D)
r.keyRelease(KeyEvent.VK_ALT)
r.keyRelease(KeyEvent.VK_D)
for (j in rand.indices) {
val k = when {
rand[j] == '0' -> KeyEvent.VK_0
rand[j] == '1' -> KeyEvent.VK_1
rand[j] == '2' -> KeyEvent.VK_2
rand[j] == '3' -> KeyEvent.VK_3
rand[j] == '4' -> KeyEvent.VK_4
rand[j] == '5' -> KeyEvent.VK_5
rand[j] == '6' -> KeyEvent.VK_6
rand[j] == '7' -> KeyEvent.VK_7
rand[j] == '8' -> KeyEvent.VK_8
rand[j] == '9' -> KeyEvent.VK_9
else -> 0
}
r.keyPress(k)
r.keyRelease(k)
}
r.keyPress(KeyEvent.VK_ENTER)
r.keyRelease(KeyEvent.VK_ENTER)
return rand
}
}