Update cloudflare interceptor and android studio

This commit is contained in:
inorichi 2018-04-05 10:36:29 +02:00
parent d38cd2547a
commit 95e60ed775
4 changed files with 9 additions and 10 deletions

View File

@ -30,7 +30,7 @@ ext {
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
buildToolsVersion '27.0.3'
publishNonDefault true
defaultConfig {

View File

@ -47,19 +47,18 @@ class CloudflareInterceptor : Interceptor {
}
val js = operation
.replace(Regex("""a\.value =(.+?) \+.*"""), "$1")
.replace(Regex("""a\.value = (.+ \+ t\.length).+"""), "$1")
.replace(Regex("""\s{3,}[a-z](?: = |\.).+"""), "")
.replace("t.length", "${domain.length}")
.replace("\n", "")
val result = (duktape.evaluate(js) as Double).toInt()
val answer = "${result + domain.length}"
val result = (duktape.evaluate(js) as Double)
val cloudflareUrl = HttpUrl.parse("${url.scheme()}://$domain/cdn-cgi/l/chk_jschl")!!
.newBuilder()
.addQueryParameter("jschl_vc", challenge)
.addQueryParameter("pass", pass)
.addQueryParameter("jschl_answer", answer)
.addQueryParameter("jschl_answer", "$result")
.toString()
val cloudflareHeaders = originalRequest.headers()
@ -71,4 +70,4 @@ class CloudflareInterceptor : Interceptor {
}
}
}
}

View File

@ -7,7 +7,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0'
classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.2'
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Wed Oct 25 23:17:30 CEST 2017
#Thu Apr 05 09:21:32 CEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip