コード例 #1
0
        private string DecryptSignature(string js, string signature)
        {
            var functionLines = GetDecryptionFunctionLines(js);
            var decryptor     = new Decryptor();

            foreach (var functionLine in functionLines)
            {
                if (decryptor.IsComplete)
                {
                    break;
                }
                /* Pass  TK["do"](a, 36); or TK.BH(a, 1); */
                var match = FunctionRegex.Match(functionLine.Replace("[\"", ".").Replace("\"]", ""));
                if (match.Success)
                {
                    decryptor.AddFunction(js, match.Groups[1].Value);
                }
            }

            foreach (var functionLine in functionLines)
            {
                var match = FunctionRegex.Match(functionLine.Replace("[\"", ".").Replace("\"]", ""));
                if (match.Success)
                {
                    signature = decryptor.ExecuteFunction(signature, functionLine, match.Groups[1].Value);
                }
            }

            return(signature);
        }
コード例 #2
0
        private string DecryptSignature(string js, string signature, string decryptFunction)
        {
            var functionLines = GetDecryptionFunctionLines(js, decryptFunction);
            var decryptor     = new Decryptor();

            foreach (var functionLine in functionLines)
            {
                if (decryptor.IsComplete)
                {
                    break;
                }

                var match = FunctionRegex.Match(functionLine);

                if (match.Success)
                {
                    decryptor.AddFunction(js, match.Groups[1].Value);
                }
            }

            foreach (var functionLine in functionLines)
            {
                var match = FunctionRegex.Match(functionLine);

                if (match.Success)
                {
                    signature = decryptor.ExecuteFunction(signature, functionLine, match.Groups[1].Value);
                }
            }

            return(signature);
        }
コード例 #3
0
        private string DecryptSignature(string js, string signature)
        {
            var functionNameRegex      = new Regex(@"\w+(?:.|\[)(\""?\w+(?:\"")?)\]?\(");
            var functionLines          = GetDecryptionFunctionLines(js);
            var decryptor              = new Decryptor();
            var decipherDefinitionName = Regex.Match(string.Join(";", functionLines), "([\\$_\\w]+).\\w+\\(\\w+,\\d+\\);").Groups[1].Value;

            if (string.IsNullOrEmpty(decipherDefinitionName))
            {
                throw new Exception("Could not find signature decipher definition name. Please report this issue to us.");
            }

            var decipherDefinitionBody = Regex.Match(js, $@"var\s+{Regex.Escape(decipherDefinitionName)}=\{{(\w+:function\(\w+(,\w+)?\)\{{(.*?)\}}),?\}};", RegexOptions.Singleline).Groups[0].Value;

            if (string.IsNullOrEmpty(decipherDefinitionBody))
            {
                throw new Exception("Could not find signature decipher definition body. Please report this issue to us.");
            }
            foreach (var functionLine in functionLines)
            {
                if (decryptor.IsComplete)
                {
                    break;
                }

                var match = functionNameRegex.Match(functionLine);
                if (match.Success)
                {
                    decryptor.AddFunction(decipherDefinitionBody, match.Groups[1].Value);
                }
            }

            foreach (var functionLine in functionLines)
            {
                var match = functionNameRegex.Match(functionLine);
                if (match.Success)
                {
                    signature = decryptor.ExecuteFunction(signature, functionLine, match.Groups[1].Value);
                }
            }

            return(signature);
        }