Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Creating a tripwire script that can be executed on various directories. By comparing the directory content against a static / pre - existing record, the

Creating a tripwire script that can be executed on various directories. By comparing the directory content against a static/pre-existing record, the tripwire script will determine whether files have been added, removed or altered.
Instructions
In Linux, create a test directory and add at least two different text files with your first and last name inside the content of each file.
Create a script called "tripwire.py" that will take in either two arguments (in order to compare the static tripwireRecord content against the current state of a directory) or take in four arguments (in order to create the tripwireRecord).
Create a function that will simply read file content and return a hash result. There are many hash algorithms that are available. You can use the following example:
, fileHash = hashlib.md5(data).hexdigest()
Read each file content as "rb" to read bytes and then you can run the above statement to create a hash result that you can store and use for comparison purposes.
Note: Hash algorithms are complex and the results change drastically just by changing one byte in a file. This is why they are used in many applications.
Once you have run your script and created a tripwireRecord file containing the file name and hash pair, you should be able to add more functionality. This will enable you to handle the evaluation aspect that compares the content of the tripwireRecord file against the current directory content.
Note: You will need to check various scenarios by altering the tripwireRecord file content or by changing the directory content by modifying, removing or adding a file.
With the tripwireRecord file now available, there are many different approaches to comparing the directory against the tripwireRecord content. Here is one of these approaches, as an example:
a. Read the tripwireRecord to get the directory name and the filename - hash pairs.
b. Read the content of the current directory and for each file to check if a record exists in the tripwireRecord. If the record does exist, compare the hash values to check if the file is identical. If the file does not exist in the tripwireRecord, this means that the file has been added to the directory after the tripwireRecord file has been created. Add the results into two different buckets (such as arrays).
c. After evaluating all of the files in the current directory, there may be some file names that have not been compared in the tripwireRecord. In this case, you can assume that those files in the current directory have been removed.
d. Keep track of the file names in some data structure (e.g., three different arrays like modified, added, removed).
e. Write the results to the console.
Incorporate error handling such as arguments passed in, file handling, etc.
Deliverables
Submit a 10-minute demo of you running your script in your environment. Your demo must meet the following requirements:
a. Shows you verbally describing your code and what is happening at execution.
b. Proves that all of the functionalities of your script work.
c. Do not submit a link to YouTube or other public video sharing service. You must submit your work in D2L. Failure to do this will result in a 0% grade.
Note: The demo must be no longer than 10 minutes. Content beyond 10 minutes will not be watched.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

Write formal and informal proposals.

Answered: 1 week ago

Question

Describe the components of a formal report.

Answered: 1 week ago

Question

Write formal and informal reports.

Answered: 1 week ago