PT0-003 · Question #107
A penetration tester needs to test a very large number of URLs for public access. Given the following code snippet: Which of the following changes is required?
The correct answer is A. The condition on line 6. The code is checking if the response status code is 401 (Unauthorized) to determine if a URL is accessible. However, a 401 status code means authentication is required, not that the URL is publicly accessible. The correct condition should check for 200 (OK) or similar success…
Question
A penetration tester needs to test a very large number of URLs for public access. Given the following code snippet:
Which of the following changes is required?
Exhibit
Options
- AThe condition on line 6
- BThe method on line 5
- CThe import on line 1
- DThe delimiter in line 3
How the community answered
(25 responses)- A76% (19)
- B8% (2)
- C12% (3)
- D4% (1)
Explanation
The code is checking if the response status code is 401 (Unauthorized) to determine if a URL is accessible. However, a 401 status code means authentication is required, not that the URL is publicly accessible. The correct condition should check for 200 (OK) or similar success status Change line 6 from: if response.status == 401: if response.status_code == 200: # Checks if URL is publicly accessible
Topics
Community Discussion
No community discussion yet for this question.
