PT0-003 · Question #117
During a REST API security assessment, a penetration tester was able to sniff JSON content containing user credentials. The JSON structure was as follows: < transaction_id: "1234S6", content: [ {…
The correct answer is C. json['content'][1]['password'][0]. To correctly return the password for the user "ozzy" from the given JSON structure, the Python code snippet should navigate the nested structure appropriately. The "content" array contains objects with "user_id" and "password" fields. The correct password for "ozzy" can be…
Question
During a REST API security assessment, a penetration tester was able to sniff JSON content containing user credentials. The JSON structure was as follows:
< transaction_id: "1234S6", content: [ { user_id: "mrcrowley", password: ["54321#"] b < user_id: "ozzy", password: ["1112228"] ) ] Assuming that the variable json contains the parsed JSON data, which of the following Python code snippets correctly returns the password for the user ozzy?
Options
- Ajson['content']['password'][1]
- Bjson['user_id']['password'][0][1]
- Cjson['content'][1]['password'][0]
- Djson['content'][0]['password'][1]
How the community answered
(23 responses)- A4% (1)
- B4% (1)
- C83% (19)
- D9% (2)
Explanation
To correctly return the password for the user "ozzy" from the given JSON structure, the Python code snippet should navigate the nested structure appropriately. The "content" array contains objects with "user_id" and "password" fields. The correct password for "ozzy" can be accessed using the code json['content'][1]['password'][0], which navigates to the second object in the "content" array (index 1) and then accesses the first element (index 0) of the "password" array for
Topics
Community Discussion
No community discussion yet for this question.