Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Ubuntu Create two scripts as follows: 1. Reads files in a selected directo

ID: 3707058 • Letter: U

Question

Using Ubuntu Create two scripts as follows:

1. Reads files in a selected directory, generates a hash of each one using sha256sum, and compares the current hash with the earlier one saved in “hashes.txt”. Have this script write out any differences. Next schedule a cron job for each script to run each approximately every 10 minutes. Submit the scripts, copies of hashes.txt, your cron settings, and the resulting “tripwire” file.

** note to responder: please write down everything you do, from the start to end all the commands, like how you created the text file and any to every command you used. I'm a begginner at this" Thank you*

Explanation / Answer

echo will normally output a newline, which is suppressed with -n. Try this:

SHA256 is the currently recommended hash function.

Unless you have a reason to use the weaker algorithms, then SHA256 is the way to go.

To create the text file, simply redirect the output to the file. For example, if you have a Ubuntu ISO image you want to hash:

There are several ways you could achieve this. The easiest I have seen is to use the following.

The syntax uses the cp command followed by the path to the directory the desired files are located in with all the files you wish to copy wrapped in brackets and separated by commas.

Make sure to note that there are no spaces between the files. The last part of the command, /home/usr/destination/, is the directory you wish to copy the files into.

or if the all the files have the same prefix but different endings you could do something like this:

Where file1,file2,file3 and file4 would be copied.

From how you worded the question I believe this is what you're looking for but it also sounds like you might be looking for a command to read from a list of files and copy all of them to a certain directory. If that is the case let me know and i'll edit my answer.

Dealing with python

So I wrote a little python script that I believe should get the job done. However, I am not sure how well versed you are in python (if versed at all) so I will try explaining how to use this script the best I can and please ask as many questions about it as you need.

(This program use, time.sleep(10*60)) take a second than convert to minat multiply 60

This script should be relatively simple to use. First off, copy the above code into the program gedit (should be pre-installed in Ubuntu) or any other text editor.

After that is complete, save the file as move.py in your home directory (it can be any directory but for ease of instruction lets just use the home directory) or add the directory the file is contained in to your PATH. Then cd to your home directory (or whatever directory you saved move.py in) from the terminal and type the following command:

This should copy all of the files that are listed from the source directory to the destination directory with duplicates taking the format and so on. file.txt should be a file that lists all the pictures you would like to copy with each entry on its own separate line.

In no way should this script effect the source directory, however just make sure to enter the correct paths to the source and destination directory and the worst that could happen is you copy the files to the wrong directory.

NOTE:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote