This commit is contained in:
enimax-anime
2022-12-01 13:01:46 -08:00
committed by GitHub
parent 2320cd2d44
commit 1115b9dea3
2 changed files with 8 additions and 3 deletions

View File

@ -36,10 +36,15 @@ class ZoroExtractor(private val client: OkHttpClient) {
val srcRes = newClient.newCall(GET(SOURCES_URL + id, cache = cacheControl)) val srcRes = newClient.newCall(GET(SOURCES_URL + id, cache = cacheControl))
.execute() .execute()
.body!!.string() .body!!.string()
val key = newClient.newCall(GET("https://raw.githubusercontent.com/consumet/rapidclown/main/key.txt"))
.execute()
.body!!.string()
if ("\"encrypted\":false" in srcRes) return srcRes if ("\"encrypted\":false" in srcRes) return srcRes
if (!srcRes.contains("{\"sources\":")) return null if (!srcRes.contains("{\"sources\":")) return null
val encrypted = srcRes.substringAfter("sources\":\"").substringBefore("\"") val encrypted = srcRes.substringAfter("sources\":\"").substringBefore("\"")
val decrypted = Decryptor.decrypt(encrypted, cachedJs) ?: return null val decrypted = Decryptor.decrypt(encrypted, key) ?: return null
val end = srcRes.replace("\"$encrypted\"", decrypted) val end = srcRes.replace("\"$encrypted\"", decrypted)
return end return end
} }

View File

@ -9,11 +9,11 @@ import javax.crypto.spec.SecretKeySpec
object Decryptor { object Decryptor {
fun decrypt(encodedData: String, js: String): String? { fun decrypt(encodedData: String, remoteKey: String): String? {
val saltedData = Base64.decode(encodedData, Base64.DEFAULT) val saltedData = Base64.decode(encodedData, Base64.DEFAULT)
val salt = saltedData.copyOfRange(8, 16) val salt = saltedData.copyOfRange(8, 16)
val ciphertext = saltedData.copyOfRange(16, saltedData.size) val ciphertext = saltedData.copyOfRange(16, saltedData.size)
val password = FindPassword.getPassword(js).toByteArray() val password = remoteKey.toByteArray()
val (key, iv) = GenerateKeyAndIv(password, salt) ?: return null val (key, iv) = GenerateKeyAndIv(password, salt) ?: return null
val keySpec = SecretKeySpec(key, "AES") val keySpec = SecretKeySpec(key, "AES")
val ivSpec = IvParameterSpec(iv) val ivSpec = IvParameterSpec(iv)