Skip to content

Commit

Permalink
Randomized Password
Browse files Browse the repository at this point in the history
  • Loading branch information
Howard20181 committed Aug 4, 2023
1 parent b3961ee commit bbb5304
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import java.util.*
import kotlin.collections.HashMap
import kotlin.math.abs
import kotlin.math.absoluteValue
import kotlin.random.Random

/**
* This is one of the most easiest bot - it will just print information about itself
Expand Down Expand Up @@ -199,7 +200,12 @@ suspend fun main(vararg args: String) {
telegramBotWithBehaviourAndLongPolling(args[0], CoroutineScope(Dispatchers.IO)) {
onChatJoinRequest {
val model = getModel(it.from?.asCommonUser()?.ietfLanguageCode?.code)
val password = abs(it.chat.id.chatId).toString()
val passwordLength = (it.chat.id.chatId).absoluteValue.toString().length
var start: Long = 1;
for (i in 1..passwordLength-1) {
start *= 10;
}
val password = Random.nextLong(start, (start * 10) - 1)
val secret = "20221209"
val fakepassword = XXTEA.encrypt(password.toString(), secret)
val encodedPassword: String = Base64.getEncoder().encodeToString(fakepassword)
Expand Down

0 comments on commit bbb5304

Please sign in to comment.