Question: import re # DO NOT EDIT THIS LINE # Function that takes a file and loads it into a Python list variable and # returns
import re # DO NOT EDIT THIS LINE
# Function that takes a file and loads it into a Python list variable and
# returns a list variabe with each item being a line from the file
def loadfileintolistfilename:
with openfilename as f:
lines freadsplitlines
return lines
def main: # DO NOT EDIT THIS LINE
printWelcome to the Log Analyzer!"
# PART A
#
# Create a variable and set its value to the response from an input call asking
# for a filename of a log file What log would you like to parse?" To test your
# code, you should enter the name of the log file in the repository, which is
# labdataproblemlog
## YOUR CODE HERE ##
# PART B
#
# Using the loadfileintolist function, load the lines from the log file into a
# list variabe named lines
## YOUR CODE HERE ##
# PART C
#
# You will be looking for unique IP addressed and usernames in DOMAINusername
# format in the log file. Create two lists that will hold these values for display
## YOUR CODE HERE ##
# PART D
#
# Create a new python regular expression object by compiling an expression to
# look for an IP address
## YOUR CODE HERE ##
# PART E
#
# Search the contents of each line for an IP address. If there is a match and that match
# doesn't already exist in the list, append it to the list. Remember, IP addresses look like
#
## YOUR CODE HERE ##
# PART F
#
# Create a new python regular expression object by compiling an expression to
# look for user accounts. User accounts will be in the format DOMAINusername
## YOUR CODE HERE ##
# PART G
#
# Search the contents of each line for a user account using the regular expression you created.
# If there is a match and that match doesn't already exist in the list, append it to the list
## YOUR CODE HERE ##
# PART H
#
# For each IP address you found, print it to the screen
## YOUR CODE HERE ##
# PART I
#
# For each user account you found, print it to the screen
## YOUR CODE HERE ##
return # DO NOT EDIT THIS LINE
if namemain: # DO NOT EDIT THIS LINE
main# DO NOT EDIT THIS LINE
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
