Question

In: Computer Science

This and subsequent questions should be answered in python 3.14 LAB: Detecting Network Change (files and...

This and subsequent questions should be answered in python

3.14 LAB: Detecting Network Change (files and lists) Securing a network from attacks means a network administrator is watching traffic and user activity. Change detection (CD) is a method used to track changes in your network. CD can detect files accessed during off hours to more complex algorithmic detections added to software applications that manage this process. This program is going to manage user login times and attempt to detect any change in a users typical login attempts. It will use an input file to store data and read the file using the csv.reader( ) method. The file will contain a list of login_names, followed by login_time separated by commas. Write a program that first reads in the name of an input file, reads the information stored in that file and determines if the user login has occurred at off hour times. The company employees work from 9 am to 5 pm so any other time would be an off hour login attempt. If the login attempt is made after hours, store the user name and login time in a dictionary with the user name as the key. Display all anomaly attempts at the end of the program. If there are no questionable login attempts display No anomaly login attempts Ex: If the input is: input1.csv and the contents of input1.csv are: (store time as integers and use military time to simulate am and pm attempts) bob,2,paula,1,nancy,8,thomas,23,zach,22,charlotte,4 the output is: Anomaly login attempts: nancy:8 thomas:23 zach:22 charlotte:4 Ex: If the input is: input2.csv and the contents of input2.csv are: (store time as integers and use military time to simulate am and pm attempts) the output is: No anomaly login attempts Note: There is a newline at the end of the output, and input1.csv is available to download.

Solutions

Expert Solution

import csv

anomalies = dict()
filename = input("Enter filename: ")
with open(filename, mode='r') as f:
    csv_reader = csv.reader(f)
    for row in csv_reader:
        name, time = row[0], row[1]
        time = int(time)
        #If time is between 9 am to 5pm(17) then it's normal
        if not(9<=time<=17):
            #If it belongs to off hours add to anomalies
            anomalies[name] = time

if len(anomalies)==0:
    #It means anomalies dictionary is empty, no anomalies
    print('No anomaly login attemps.')
else:
    for key, value in anomalies.items():
        print(key, ',', value)


Related Solutions

Instructions: All the questions should be answered with a graph Graphs should be made in excel...
Instructions: All the questions should be answered with a graph Graphs should be made in excel and pasted in the word Explanation must be handwritten not typed The assignment should be very neatly done or else it will not be considered for evaluation. Q1. Explain law of demand and Supply with two separate graphs. Q2. What is Contraction and Expansion for Demand and Supply. Explain with a Demand schedule and graph. Q3.  Consider Product X is Car. With help of graph...
USE PYTHON 4.15 LAB: Exact change Write a program with total change amount as an integer...
USE PYTHON 4.15 LAB: Exact change Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1 Quarter...
PLEASE ANSWER WASNT ANSWERED PYTHON You will ask 3 questions USERNAME = "user1" PASSWORD = "password1"...
PLEASE ANSWER WASNT ANSWERED PYTHON You will ask 3 questions USERNAME = "user1" PASSWORD = "password1" What is your user name? What is your password? What is your age? If the user name and password are incorrect, display a message that says - Your credentials are not valid If both user name and password are correct, ask question 3 If the answer to question 3 is eighteen and greater, display a message that says - You're considered an adult If...
Part 1: Case study analysis These questions relate to the case study and should be answered...
Part 1: Case study analysis These questions relate to the case study and should be answered in the context of the information provided. Case 1: A midsized biopharmaceutical (ALFA) company with hundreds of employees worldwide recently faced a crossroads. The company was growing rapidly, but its internal contract management process wasn’t equipped to keep up with the demands of a larger company. Because the company relied on paper-based manual processes, it encountered inefficiency across departments. End users submitted paper forms...
What three questions should be answered before purchasing stock? What is stock? Which is better, top...
What three questions should be answered before purchasing stock? What is stock? Which is better, top down or bottom up budgeting? Why do people buy stock when stocks are risky and savings are FDIC insured? What is an example of a stock overreacting to news and how might you benefit from such news? What is the difference between debt financing and equity financing? Which is better from the perspective of the company seeking funding, debt financing or equity financing? How...
Language: Python Implement the Book class as demonstrated below. You should not change the Book methods...
Language: Python Implement the Book class as demonstrated below. You should not change the Book methods and implementation as provided. The docstrings in the template contain descriptions of each method. >>> b=Book ( ' Code' , 'Charles Ptzold' 'Computing' , 2001) >>> b Book ( ' Code' , 'Charles Ptzold' 'Computing' , 2001) >>> str (b) ' Code : Charles Ptzold: Computing: 2001 ' >>> b. getTitle ( ) ' Code ' >>> b. getAuthor() ' Charles Ptzold' >>> b....
Lab 4 Pre-Lab Questions What constitutes personal protective equipment? When should personal protective equipment be worn?...
Lab 4 Pre-Lab Questions What constitutes personal protective equipment? When should personal protective equipment be worn? Why is personal protective equipment important? Why are there increasing levels of biological containment procedures? What level of biological containment will be necessary to complete the experiments in this manual? What document should you refer to if you have questions regarding the safety or disposal of a chemical? Where can this document be located? List five safety procedures that should always be adhered to...
Use python simulations to answer the following questions. You should be able to make minor modifications...
Use python simulations to answer the following questions. You should be able to make minor modifications to previous simulations to estimate these probabilities: 1) Suppose the pocket contains one fair coin and one two-headed coin. Find the approximate probability that the coin is fair given that it came up heads on the first flip. 2) Suppose the pocket contains one fair coin and one two-headed coin. Find the approximate probability that the coin is fair given that it came up...
Post-Lab Questions: Answer. 1. What should you examine to determine the precision of your results? Explain....
Post-Lab Questions: Answer. 1. What should you examine to determine the precision of your results? Explain. 2. What should you examine to determine the accuracy of your results? Explain. 3. If the standardization of the NaOH in Experiment 7 was not performed correctly and the experimental normality was too low, how would that affect the experimental equivalent weight being determined in this experiment? Would it be too high or too low? Explain. 4. You were allowed to weigh out between...
Write 5 questions about Object Oriented Programming in Python. Each question should have 7 options. Please...
Write 5 questions about Object Oriented Programming in Python. Each question should have 7 options. Please provide 7 answer options for EACH question and the select answer for EACH question
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT