Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
fix cfi
Browse files Browse the repository at this point in the history
  • Loading branch information
raulhaag committed Apr 1, 2019
1 parent 2ce0d2c commit 25167ab
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/main/java/ar/rulosoft/navegadores/CFInterceptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* Resolver based on habrahabr.ru/post/258101/.
* and https://github.com/VeNoMouS/cloudflare-scrape-js2py
*/
public class CFInterceptor implements Interceptor {

Expand Down Expand Up @@ -61,9 +62,13 @@ public Response resolveOverCF(Chain chain, Response response) throws IOException
}

String operation = rawOperation.replaceAll("a\\.value = (.+ \\+ t\\.length.+?);.+", "$1").replaceAll("\\s{3,}[a-z](?: = |\\.).+", "");
String js = operation.replaceAll("t.length", domain.length() + "").replaceAll("\n", "");
js = js.replaceAll("atob", "Atob.atob").replaceAll("function\\(p\\)\\{[^\\}]+\\}", rv).replaceAll("a.value = (\\([^;]+;)", "$1");
String js = operation.substring(0, operation.indexOf(";")) + "; p = 0; k ='fk'; t = \"" + domain + "\"" + operation.substring(operation.indexOf(";"));
js = js.replaceAll("atob", "Atob.atob").replaceAll("a.value = (\\([^;]+;)", "$1").replaceAll(";\\s*;", ";");
js = js.replace("function(p){return eval((true+\"\")[0]+\".\"+([][\"fill\"]+\"\")[3]+(+(101))[\"to\"+String[\"name\"]](21)[1]+(false+\"\")[1]+(true+\"\")[1]+Function(\"return escape\")()((\"\")[\"italics\"]())[2]+(true+[][\"fill\"])[10]+(undefined+\"\")[2]+(true+\"\")[3]+(+[]+Array)[10]+(true+\"\")[0]+\"(\"+p+\")\")}", "t.charCodeAt");
js = js.replaceAll(";", ";\n");

Duktape duktape = Duktape.create();
duktape.evaluate("var document = {getElementById: function(p) { return {innerHTML:\"" + rv + "\"};}};");
Atob atob = new Atob() {
@Override
public String atob(String str) {
Expand Down

0 comments on commit 25167ab

Please sign in to comment.