diff --git a/modules/paypal/pages.py b/modules/paypal/pages.py index 6b20b69e8e4296d835ee775b7e2be1a26320121b..a2604b7befde4929a2d822a0a84ae9da4512797e 100644 --- a/modules/paypal/pages.py +++ b/modules/paypal/pages.py @@ -93,7 +93,7 @@ def exec_decoder(mtc): cleaner_code = re.sub(r"%s\('([^']+)'\)" % re.escape(decoder_name), exec_decoder, cleaner_code) cookie = re.search(r'xppcts = (\w+);', cleaner_code).group(1) - sessionID = re.search(r"%s'([^']+)'" % re.escape("'&_sessionID='+encodeURIComponent("), cleaner_code).group(1) + sessionID = re.search(r"%s\w+\('([^']+)'" % re.escape("'&_sessionID='+encodeURIComponent("), cleaner_code).group(1) csrf = re.search(r"%s'([^']+)'" % re.escape("'&_csrf='+encodeURIComponent("), cleaner_code).group(1) key, value = re.findall(r"'(\w+)','(\w+)'", cleaner_code)[-1] @@ -106,9 +106,12 @@ def exec_decoder(mtc): get_token_func_declaration = "var " + get_token_func_name + "=" cleaner_code = cleaner_code.replace(get_token_func_declaration, get_token_func_declaration + "window.ADS_JS_TOKEN=") - # Remove the call to an infinite loop - loop_func_name = re.search(r"\(function\(\w+,\s?\w+,\s?\w+,\s?\w+\)\{var\s(\w+)=", cleaner_code).group(1) - cleaner_code = cleaner_code.replace(loop_func_name + "();", "") + # Paypal will try to create an infinite loop to make the parse fail, based on different + # weird things like a check of 'ind\\u0435xOf' vs 'indexOf'. + cleaner_code = cleaner_code.replace(r"'ind\\u0435xOf'", "'indexOf'") + # It also calls "data" which is undefined instead of a return (next call is an infinite + # recursive function). This should theorically not happen if window.domain is correctly set + # to "paypal.com" though. cleaner_code = cleaner_code.replace("data;", "return;") # Add a function that returns the token