I am trying to solve this rotation picker captcha from funcaptcha and as of right now my script opens up the image of the captcha in a new tab and uses selenium to take a screenshot of the captcha (not the full page) and then encodes with with base64 (after some testing i can confirm it does this correctly and am getting valid base64). I send a multipart request to XEVIL:
I am just confused on why I am getting the unsolvable. People are solving these with 2Captcha on XEVIL so I know it is possible.
Python:
def solve_captcha_with_xevil(self, image_data):
try:
base64_image = "data:image/png;base64," + base64.b64encode(image_data).decode('utf-8')
challenge_info = {
"publicKey": self.public_key,
"site": "https://www.site.com/",
"surl": self.service_url,
"capiMode": "inline",
"styleTheme": "default",
"languageEnabled": False,
"jsfEnabled": False,
"extraData": {
"blob": base64_image
},
"ancestorOrigins": ["https://www.site.com", "https://www.site.com"],
"treeIndex": [1, 0],
"treeStructure": "[[],[[]]]",
"locationHref": "https://www.site.com/arkose/iframe"
}
browser_info = {
'Mobile': False,
'User-Agent': self.driver.execute_script("return navigator.userAgent;"),
'Sec-Ch-Ua': self.driver.execute_script("return navigator.userAgent;"), # Simplified for now
}
data = {
"method": "base64",
"key": "505461bc976144145e1886144c5823c4",
"json": "1",
"imginstructions": self.captcha_instructions,
"publickey": self.public_key,
"proxy": "szbqhzsz:[email protected]:6010",
"body": base64_image,
"challengeInfo": challenge_info,
"browserInfo": browser_info
}
# Add service URL if available
if hasattr(self, 'service_url'):
data["surl"] = self.service_url
xevil_url = "http://127.0.0.1:80/in.php"
Output("DEBUG").log("Sending multipart request to XEvil")
# Send multipart request
retries = 3
task_id = None
for _ in range(retries):
response = requests.post(xevil_url, data=data)
if response.status_code == 200:
json_response = response.json()
Output("DEBUG").log(f"xEvil response: {json_response}")
if json_response.get("status") == 1:
task_id = json_response.get("request")
if task_id and task_id != "1": # Ensure the task ID is valid
break
time.sleep(5) # Wait before retrying
else:
Output("ERROR").log("Failed to get a valid task ID from XEvil")
return None
Output("DEBUG").log(f"xEvil task ID: {task_id}")
# Poll xEvil for the solution
solution_url = f"http://127.0.0.1:80/res.php?action=get&json=1&id={task_id}"
while True:
time.sleep(10) # Wait 10 seconds before polling again
solution_response = requests.get(solution_url)
if solution_response.status_code == 200:
solution_json = solution_response.json()
Output("DEBUG").log(f"Solution response: {solution_json}")
if solution_json.get("status") == 1:
token = solution_json.get("request")
Output("DEBUG").log(f"Received token from xEvil: {token}")
return token
elif solution_json.get("request") == "CAPCHA_NOT_READY":
Output("DEBUG").log("Captcha not ready, retrying...")
continue
else:
Output("ERROR").log(f"xEvil failed to solve captcha: {solution_json}")
return None
else:
Output("ERROR").log(f"Failed to poll xEvil. Status: {solution_response.status_code}")
return None
except Exception as e:
Output("ERROR").log(f"Error solving captcha with xEvil: {str(e)}")
return None
I am just confused on why I am getting the unsolvable. People are solving these with 2Captcha on XEVIL so I know it is possible.