Skip to content

Commit

Permalink
read secret from cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylarod committed Jan 11, 2024
1 parent 68d1bfb commit 0fb4604
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,16 @@ object XXTEA {

suspend fun main(vararg args: String) {
val map = MaxSizeHashMap<ChatIdentifier, JoinRequest>(128)

if (args.size != 1){
println("Invalid BotToken")
if (args.size != 2){
println("Usage: java -jar ksugmbot.jar {BotToken} {secret}")
return
}

val secret = args[1]
val fakepassword = XXTEA.encrypt("ksu2023usk", secret)
val encodedPassword: String = Base64.getEncoder().encodeToString(fakepassword)
println(encodedPassword)

println("BotToken: ${args[0]}")

telegramBotWithBehaviourAndLongPolling(args[0], CoroutineScope(Dispatchers.IO)) {
Expand All @@ -207,7 +211,6 @@ suspend fun main(vararg args: String) {
start *= 10;
}
val password = Random.nextLong(start, (start * 10) - 1).toString()
val secret = "20221209"
val fakepassword = XXTEA.encrypt(password, secret)
val encodedPassword: String = Base64.getEncoder().encodeToString(fakepassword)
bot.sendMessage(it.from.id, model.problem.replace("[PASSWORD]", encodedPassword))
Expand Down

0 comments on commit 0fb4604

Please sign in to comment.