mirror of
https://github.com/sherlock-project/sherlock
synced 2024-11-22 20:03:03 +00:00
Fix Slides F+, Add multi err code support
Error codes module expanded to support arrays of error codes rather than only one. Using this new functionality, Slides was set to error codes 404 (as standard) AND 204 (non standard), to accomodate for that website's odd edge case.
This commit is contained in:
parent
eb89787dcd
commit
e6d0f1ee7b
2 changed files with 11 additions and 6 deletions
|
@ -1757,6 +1757,7 @@
|
||||||
"username_claimed": "blue"
|
"username_claimed": "blue"
|
||||||
},
|
},
|
||||||
"Slides": {
|
"Slides": {
|
||||||
|
"errorCode": [204, 404],
|
||||||
"errorType": "status_code",
|
"errorType": "status_code",
|
||||||
"url": "https://slides.com/{}",
|
"url": "https://slides.com/{}",
|
||||||
"urlMain": "https://slides.com/",
|
"urlMain": "https://slides.com/",
|
||||||
|
|
|
@ -351,7 +351,6 @@ def sherlock(
|
||||||
|
|
||||||
# Get the expected error type
|
# Get the expected error type
|
||||||
error_type = net_info["errorType"]
|
error_type = net_info["errorType"]
|
||||||
error_code = net_info.get("errorCode")
|
|
||||||
|
|
||||||
# Retrieve future and ensure it has finished
|
# Retrieve future and ensure it has finished
|
||||||
future = net_info["request_future"]
|
future = net_info["request_future"]
|
||||||
|
@ -407,14 +406,19 @@ def sherlock(
|
||||||
else:
|
else:
|
||||||
query_status = QueryStatus.AVAILABLE
|
query_status = QueryStatus.AVAILABLE
|
||||||
elif error_type == "status_code":
|
elif error_type == "status_code":
|
||||||
# Checks if the Status Code is equal to the optional "errorCode" given in 'data.json'
|
query_status = QueryStatus.AVAILABLE
|
||||||
if error_code == r.status_code:
|
error_codes = net_info.get("errorCode")
|
||||||
query_status = QueryStatus.AVAILABLE
|
|
||||||
|
if error_codes: # (if set in data.json)
|
||||||
|
if isinstance(error_codes, int):
|
||||||
|
if error_codes != r.status_code:
|
||||||
|
query_status = QueryStatus.CLAIMED
|
||||||
|
else:
|
||||||
|
if r.status_code not in error_codes:
|
||||||
|
query_status = QueryStatus.CLAIMED
|
||||||
# Checks if the status code of the response is 2XX
|
# Checks if the status code of the response is 2XX
|
||||||
elif not r.status_code >= 300 or r.status_code < 200:
|
elif not r.status_code >= 300 or r.status_code < 200:
|
||||||
query_status = QueryStatus.CLAIMED
|
query_status = QueryStatus.CLAIMED
|
||||||
else:
|
|
||||||
query_status = QueryStatus.AVAILABLE
|
|
||||||
elif error_type == "response_url":
|
elif error_type == "response_url":
|
||||||
# For this detection method, we have turned off the redirect.
|
# For this detection method, we have turned off the redirect.
|
||||||
# So, there is no need to check the response URL: it will always
|
# So, there is no need to check the response URL: it will always
|
||||||
|
|
Loading…
Reference in a new issue