Commit 26d4c6db authored by Benjamin Bouvier's avatar Benjamin Bouvier

[paypal] Fix anti-scraping protection against global browser objects;

And also update pages regexp to match the website.
parent 26de3847
Pipeline #1089 failed with stages
in 0 seconds
......@@ -39,7 +39,7 @@ class Paypal(LoginBrowser):
'/cgi-bin/webscr\?cmd=_login-submit.+$',
'/fr/webapps/mpp/home', LoginPage)
landing = URL('/home',
'/\w+/home', # locale home
'/(?!myaccount)\w+/home', # locale home
'/$', LandingPage)
useless = URL('/cgi-bin/webscr\?cmd=_login-processing.+$',
'/cgi-bin/webscr\?cmd=_account.*$',
......@@ -55,6 +55,7 @@ class Paypal(LoginBrowser):
'/myaccount/?\?country_lang.x=true',
'/businessexp/fees/interchange-fees',
'/mep/dashboard',
'/myaccount/home',
HomePage)
error = URL('/auth/validatecaptcha$', ErrorPage)
history_details = URL('https://\w+.paypal.com/cgi-bin/webscr\?cmd=_history-details-from-hub&id=[\-A-Z0-9]+$',
......
......@@ -77,6 +77,18 @@ class LoginPage(HTMLPage):
# e+=function(e,t){return typeof navigator!="undefined"?e:t}
code1 = re.sub(r'if\((?:typeof |document)[^)]*\)', 'if(true)', code1)
# JS code checks that some PhantomJS globals aren't defined on the
# global window object; put an empty window object, so that all these
# tests fail.
# It then tests the user agent against some known scrappers; just put
# the default Tor user agent in there.
code1 = """
window = {};
navigator = {
userAgent: "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0"
};
""" + code1
js = Javascript(code1)
func_name = re.search(r'function (\w+)\(\)', code1).group(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment