Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
Update signature deciphering
Browse files Browse the repository at this point in the history
  • Loading branch information
HaarigerHarald committed Dec 18, 2015
1 parent c4a0c06 commit cf310aa
Showing 1 changed file with 15 additions and 9 deletions.
Expand Up @@ -399,18 +399,24 @@ private boolean decipherSignature(final SparseArray<String> encSignatures) throw
if (LOGGING)
Log.d(LOG_TAG, "Decipher Functname: " + decipherFunctionName);

Pattern patMainVariable = Pattern.compile("(var |,)" + decipherFunctionName + "(=function\\((.{1,3})\\)\\{)");

// Get the main function.
String mainDecipherFunct = "function " + decipherFunctionName + "(";
if (!javascriptFile.contains(mainDecipherFunct)) {
mainDecipherFunct = "var " + decipherFunctionName + "=function(";
}
String mainDecipherFunct;

int startIndex = javascriptFile.indexOf(mainDecipherFunct) + mainDecipherFunct.length();
if (startIndex < mainDecipherFunct.length()) {
return false;
mat = patMainVariable.matcher(javascriptFile);
if (mat.find()) {
mainDecipherFunct = "var " + decipherFunctionName + mat.group(2);
} else {
Pattern patMainFunction = Pattern.compile("(function |,)" + decipherFunctionName + "(\\((.{1,3})\\)\\{)");
mat = patMainFunction.matcher(javascriptFile);
if (!mat.find())
return false;
mainDecipherFunct = "function " + decipherFunctionName + mat.group(2);
}
for (int braces = 0, i = startIndex; i < javascriptFile.length(); i++) {

int startIndex = mat.end();

for (int braces = 1, i = startIndex; i < javascriptFile.length(); i++) {
if (braces == 0 && startIndex + 5 < i) {
mainDecipherFunct += javascriptFile.substring(startIndex, i) + ";";
break;
Expand Down

0 comments on commit cf310aa

Please sign in to comment.