Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Python Expert

Task 1

You must prepare a program which would carry out some of the basic tasks accomplished by a file integrity checker such as Tripwire. In this first part of the assignment you will be dealing strictly with processing one file at a time in any operation (in task 2 you will deal with directories). The program must present the user with a menu of four choices:

1) Add a file to the integrity database,

2) Remove a file from the integrity database,

3) Check the file for changes, and

4) Quit.

Your integrity database must be maintained as a python dictionary with nested components. Between invocations of your program, the database must be stored in a file using the pickle module. You must establish a default name for your database, but permit the user to override this name by giving a new name as a command line argument. If the database already exists, read it in. If not, then create an empty new database. The database must be represented by a nested dictionary structure that mirrors the tree-like nature of the file system. The top level dictionary represents the root directory. Its components are the files and directories contained in /, indexing by their name as a key. Any subdirectories must be represented by another dictionary, continuing recursively.

When adding a new file into the database a nested set of entries must be made in this structure (if they do not already exist) according to the full path name of the file (all filenames could be assumed to have absolute paths) by breaking it up into the directory names between slashes. The final entry for the file must be a computed checksum value based on the file contents as indicated below. It is an error if the indicated name does not represent a valid file.

Removing a file from the database means first deleting the entry at the lowest file level in the structure, and then if the containing dictionary becomes empty it must be deleted also, and so forth up the line until a non-empty dictionary is encountered. It is an error if you attempt to remove the entry which is not in the database.

Checking the integrity of a file means computing the checksum value of the specified file and comparing it against the value stored in the database and reporting the result. It is an error if the file doesn't exist on the system or in the database.

Task 2

You would add the following options to your program from task 1.

1) add the directory of files to the database. The user supplies the name of a directory. You must add a checksum entry for every file in the directory (not the directory itself), as well as recursively descend into any subdirectories, adding entries for files in them (but not themselves).

2) Delete the directory of files from the database. The user supplies the name of a directory. You must delete entries for all files contained in that directory, and any of its subdirectories.

3) Check the integrity of files in a directory. The user supplies the name of a directory. Each file contained in that directory, and recursively through its subdirectories, must have its checksum checked against the corresponding entry in the database, if it exists. All of the files that have been changed based on different checksums must be listed in sorted order. Any new files which are not currently in the database must be given in a separate sorted list.

Add the ability to store a file's permissions along with the checksum value in the database. Every time an entry is made in the database, the permissions must also be stored. Add a command line option, -p, that if specified means that an integrity check is not just comparing the checksum values, but also comparing to see if the permission bits have changed.

This version of the program must be able to handle relative file names based on the present working directory, not just absolute paths as was allowed in task 1.

Python, Programming

  • Category:- Python
  • Reference No.:- M91306

Have any Question? 


Related Questions in Python

Write python code to solve the following problem1 write a

Write Python code to solve the following problem: 1. Write a Python program that prompts the user for his/her amount of money, then reports how many Nintendo Wiis the person can afford, and how much more money he/she wil ...

Problem descriptionthe previous assignment assumes its

Problem Description The previous assignment assumes its input includes spaces between every token in an expression, but many programmers tend not to use so many spaces, if the expression is unambiguous. For example, both ...

Python assignmentwrite a python program to crack a password

Python Assignment Write a Python program to crack a password in the Linux /etc/shadow file. Write a program using Python to implement a password cracker for Linux. You should utilize a dictionary (small - English) to cra ...

Python homeworkyou will write a program that acts like a

Python HomeWork You will write a program that acts like a simple calculator for binary numbers. You should read in a string of input that has the format: number operator number. Each of the numbers should be presented in ...

1 read python tutorial httpsdocspythonorg3tutorialindexhtml

1. Read Python Tutorial (https://docs.python.org/3/tutorial/index.html) sections 1 to 4.5. 2. Write a Python program that prints out a table of values of all even powers of 2 from 2**0 through 2**32. For each value, prin ...

You have all experienced how when you are typing a text

You have all experienced how when you are typing a text message the application will provide potential words that complete what you are typing (and sometimes insist on completing them incorrectly). You will write a Pytho ...

Introductionthe assignment is to design a service oriented

Introduction The assignment is to design a Service Oriented Architecture-based solution for a given domain. You must show a good understanding of Service Oriented principles. In addition you must show knowledge and under ...

1 alternating sumsprovide code for an integer-valued

1. Alternating sums Provide code for an integer-valued function altSumSquares(n) that calculates and returns as its value the alternating sum of the squares of the first n positive integers. You may not use a formula to ...

Project add time and object interaction to the

Project: Add Time and Object Interaction to the Simulation Addendums Addendums to the project will be posted at: https://www.cs.uoregon.edu/Classes/16S/cis211/Projects/P4/P4.html This specification is very detailed, and ...

Programming assignments1read python tutorial

Programming Assignments 1. Read Python Tutorial (https://docs.python.org/3/tutorial/index.html) sections 4.6 to 4.8. 2. Write a Python function that checks whether a passed string is palindrome or not. Note: A palindrome ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

A cola-dispensing machine is set to dispense 9 ounces of

A cola-dispensing machine is set to dispense 9 ounces of cola per cup, with a standard deviation of 1.0 ounce. The manuf

What is marketingbullwhat is marketing think back to your

What is Marketing? • "What is marketing"? Think back to your impressions before you started this class versus how you

Question -your client david smith runs a small it

QUESTION - Your client, David Smith runs a small IT consulting business specialising in computer software and techno

Inspection of a random sample of 22 aircraft showed that 15

Inspection of a random sample of 22 aircraft showed that 15 needed repairs to fix a wiring problem that might compromise

Effective hrmquestionhow can an effective hrm system help

Effective HRM Question How can an effective HRM system help facilitate the achievement of an organization's strate