mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2025-06-08 20:45:27 +00:00
challenge result ordering, listener fixes
This commit is contained in:
parent
d82feffeba
commit
2261468aca
@ -258,9 +258,9 @@ def click_verify(driver: ChromiumPage) -> DataPacket:
|
|||||||
)
|
)
|
||||||
ve = bde.ele("text:Verify you are human", timeout=10)
|
ve = bde.ele("text:Verify you are human", timeout=10)
|
||||||
|
|
||||||
driver.listen.start(driver.url)
|
driver.listen.resume()
|
||||||
ve.click()
|
ve.click()
|
||||||
data = driver.listen.wait(count=1)
|
data = driver.listen.wait(count=1,timeout=5)
|
||||||
|
|
||||||
if isinstance(data, DataPacket):
|
if isinstance(data, DataPacket):
|
||||||
return data
|
return data
|
||||||
@ -294,10 +294,13 @@ def _evil_logic(req: V1RequestBase, driver: ChromiumPage, method: str) -> Challe
|
|||||||
|
|
||||||
# navigate to the page
|
# navigate to the page
|
||||||
logging.debug('Navigating to... %s', req.url)
|
logging.debug('Navigating to... %s', req.url)
|
||||||
|
driver.listen.start(req.url)
|
||||||
if method == 'POST':
|
if method == 'POST':
|
||||||
_post_request(req, driver)
|
_post_request(req, driver)
|
||||||
else:
|
else:
|
||||||
driver.get(req.url)
|
driver.get(req.url)
|
||||||
|
data = driver.listen.wait(count=1,timeout=5)
|
||||||
|
driver.listen.pause()
|
||||||
|
|
||||||
# set cookies if required
|
# set cookies if required
|
||||||
if req.cookies is not None and len(req.cookies) > 0:
|
if req.cookies is not None and len(req.cookies) > 0:
|
||||||
@ -306,10 +309,13 @@ def _evil_logic(req: V1RequestBase, driver: ChromiumPage, method: str) -> Challe
|
|||||||
driver.set.cookies.remove(cookie['name'])
|
driver.set.cookies.remove(cookie['name'])
|
||||||
driver.set.cookies(cookie)
|
driver.set.cookies(cookie)
|
||||||
# reload the page
|
# reload the page
|
||||||
|
driver.listen.resume()
|
||||||
if method == 'POST':
|
if method == 'POST':
|
||||||
_post_request(req, driver)
|
_post_request(req, driver)
|
||||||
else:
|
else:
|
||||||
driver.get(req.url)
|
driver.get(req.url)
|
||||||
|
data = driver.listen.wait(count=1, timeout=5)
|
||||||
|
driver.listen.pause()
|
||||||
|
|
||||||
# wait for the page
|
# wait for the page
|
||||||
if utils.get_config_log_html():
|
if utils.get_config_log_html():
|
||||||
@ -327,7 +333,6 @@ def _evil_logic(req: V1RequestBase, driver: ChromiumPage, method: str) -> Challe
|
|||||||
'Probably your IP is banned for this site, check in your web browser.')
|
'Probably your IP is banned for this site, check in your web browser.')
|
||||||
|
|
||||||
attempt = 0
|
attempt = 0
|
||||||
data = DataPacket
|
|
||||||
challenge_found = True
|
challenge_found = True
|
||||||
while challenge_found:
|
while challenge_found:
|
||||||
try:
|
try:
|
||||||
@ -354,15 +359,15 @@ def _evil_logic(req: V1RequestBase, driver: ChromiumPage, method: str) -> Challe
|
|||||||
|
|
||||||
challenge_res = ChallengeResolutionResultT({})
|
challenge_res = ChallengeResolutionResultT({})
|
||||||
challenge_res.url = driver.url
|
challenge_res.url = driver.url
|
||||||
challenge_res.cookies = driver.cookies()
|
|
||||||
challenge_res.userAgent = utils.get_user_agent(driver)
|
|
||||||
|
|
||||||
if data is not None and data.response is not None:
|
if data is not None and data.response is not None:
|
||||||
challenge_res.status = data.response.status
|
challenge_res.status = data.response.status
|
||||||
if not req.returnOnlyCookies:
|
if not req.returnOnlyCookies:
|
||||||
challenge_res.response = data.response.body
|
challenge_res.response = data.response.body
|
||||||
challenge_res.headers = data.response.headers.copy()
|
challenge_res.headers = data.response.headers.copy()
|
||||||
|
|
||||||
|
challenge_res.cookies = driver.cookies()
|
||||||
|
challenge_res.userAgent = utils.get_user_agent(driver)
|
||||||
|
|
||||||
res.result = challenge_res
|
res.result = challenge_res
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user