This challenge is open-book. You are permitted to use any study resources to meet the goal. Ultimately the goal is to build understanding. If you ask someone else to do the work for you then you will fail to gain understanding.
The challenge is to use common Linux command-line utilities to look through the current directory for files and for each file print out (on the same line):
- The MD5 checksum of the file followed by a colon and space.
- If the file is writeable by “other” the text “WARNING: FILE IS WORLD WRITEABLE: “
- The filename.
Sample output is shown below.
Setup
The following BASH script will create a directory with three sample files that you can use to test your script. This script only needs to be run once. It should not be part of the script that you submit to your instructor.
#!/bin/bash
TARGET="SampleFiles"
mkdir ${TARGET}
echo -n "asdfasdf" > ${TARGET}/asdf.txt
echo "This is a bunch of text" > ${TARGET}/file2.txt
echo "Probably not binary data" > ${TARGET}/third.dat
chmod 400 ${TARGET}/asdf.txt
chmod 755 ${TARGET}/file2.txt
chmod 447 ${TARGET}/third.dat
Expected Output
This is what your script should generate based on the three sample files that were generated above:
$ ../lab01.sh
6a204bd89f3c8348afd5c77c717a097a: asdf.txt
17748a55c79f5fd63906a3b72fdb33db: file2.txt
da9e2290ca13710b878b600f3c737c01: WARNING: FILE IS WORLD WRITEABLE: third.dat
your script needs to produce the same output. The script itself can be named something else as long as the output is identical.
Send your program to your instructor when it is done. It will be run against other, not-disclosed, files to see if it generates the same output as the instructor’s code.
If you have any questions about this lab please raise them with your instructor. This page may be changed as questions arise.