350-201 Question 244
Single answerA cybersecurity analyst is tasked with analyzing a Python script used to automate the retrieval of logs from a Cisco Secure Firewall. Below is a snippet of the script:
import requests
def get_firewall_logs(url, token):
headers = {
'Authorization': f'Bearer {token}'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()
else:
return None
firewall_url = 'https://firewall.example.com/api/logs'
api_token = '12345abcde'
logs = get_firewall_logs(firewall_url, api_token)
if logs:
print('Logs retrieved successfully:', logs)
else:
print('Failed to retrieve logs')
What is the primary function of the Python script above?
- A
To retrieve logs from a Cisco Secure Firewall using an API.
- B
To analyze and parse logs from a local Cisco Secure Firewall log file.
- C
To send logs from a Cisco Secure Firewall to a remote server.
- D
To configure authentication policies on a Cisco Secure Firewall.
Show answer and explanation
Correct answer: A
Explanation
The Python script uses the 'requests' library to make an API call to a Cisco Secure Firewall endpoint. It retrieves logs by passing an authorization token in the headers and processing the response. The purpose of this script is to automate the retrieval of logs from the firewall, not to analyze, send, or configure anything else.
- A. Correct.
Correct. The script retrieves logs from a Cisco Secure Firewall by making an HTTP GET request to the firewall's API endpoint, using an authorization token.
- B. Incorrect.
Incorrect. The script does not analyze or parse logs from a local file. Instead, it retrieves logs via an API call.
- C. Incorrect.
Incorrect. The script retrieves logs from the firewall but does not send them to a remote server.
- D. Incorrect.
Incorrect. The script does not configure authentication policies; its purpose is to retrieve logs from the firewall.