CiscoCisco
300-215 · Question #98
300-215 Question #98: Real Exam Question with Answer & Explanation
Sign in or unlock 300-215 to reveal the answer and full explanation for question #98. The question stem and answer options stay visible for context.
Submitted by chiamaka_o· Mar 6, 2026Automation and Scripting / Security tool development - understanding Python file handling, regex searching, and output redirection as applied to cybersecurity log analysis tasks (e.g., CompTIA CySA+ or Security+ scripting objectives)
Question
Which scripts will search a log file for the IP address of 192.168.100.100 and create an output file named parsed_host.log while printing results to the console? A. B. C. D.
Options
- Aimport os import re line_regex = re.compile(r".*fwd=\192\\.168\\.100\\.100\\W.*$") output_filename = os.path.normpath("output/parsed_host.log") with open(output_filename, "w") as out_file: out_file_write("") with open("output/filename_","a") as out_file: with open("parsed_host.log", "r") as in_file: for line in in_file: if (line_regex.search(line)): print line out_file.write(line)
- Bimport os import re line_regex = re.compile(r".*fwd=\192\\.168\\.100\\.100\\W.*$") output_filename = os.path.normpath("output/parsed_host.log") with open(output_filename, "w") as out_file: out_file.write("") with open("test_log_log", "a") as out_file: with open("parsed_host_log", "r") as in_file: for line in in_file: if (line_regex.search(line)): print line out_file.write(line)
- Cimport os import re line_regex = re.compile(r".*fwd=\192\\.168\\.100\\.100\\W.*$") output_filename = os.path.normpath("output/parsed_host.log") with open(output_filename, "w") as out_file: out_file.write("") with open("parsed_host.log", "a") as out_file: with open("test_log_log", "r") as in_file: for line in in_file: if (line_regex.search(line)): print line out_file.write(line)
- Dimport os import re line_regex = re.compile(r".*fwd=\192\\.168\\.100\\.100\\W.*$") output_filename = os.path.normpath("output/parsed_host.log") with open(output_filename, "w") as out_file: out_file.write("") with open("test_log_log", "r") as in_file: for line in in_file: if (line_regex.search(line)): print line with open("parsed_host.log", "a") as out_file: out_file.write(line)
Unlock 300-215 to see the answer
You've previewed enough free 300-215 questions. Unlock 300-215 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#Python scripting#log parsing#regular expressions#file I/O