This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2014:unix:labs:labb [2014/03/23 19:09] – removed wedge | haas:spring2014:unix:labs:labb [2014/04/15 09:18] (current) – [Exercise] wedge | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <WRAP centeralign round box> | ||
+ | < | ||
+ | < | ||
+ | <fs 125%>Lab 0xB: Data Manipulation</ | ||
+ | </ | ||
+ | ~~TOC~~ | ||
+ | =====Objective===== | ||
+ | To explore some aspects of data manipulation and data security on the system. | ||
+ | |||
+ | =====Reading===== | ||
+ | Please reference the following manual pages: | ||
+ | |||
+ | * **dd**(**1**) | ||
+ | * **md5sum**(**1**) | ||
+ | * **diff**(**1**) | ||
+ | * **bvi**(**1**) | ||
+ | * **hexedit**(**1**) | ||
+ | * **file**(**1**) | ||
+ | |||
+ | =====Background===== | ||
+ | The **dd**(**1**) utility, short for //data dump//, is a tool that specializes in taking data from a source file and depositing it in a destination file. In combination with its various options, we have the capability of more fine-grained access to data that would otherwise not be as convenient using the standard data manipulation tools (**cp**(**1**), | ||
+ | |||
+ | ====Copying==== | ||
+ | To illustrate the basic nature of **dd**(**1**), | ||
+ | |||
+ | When given just a source and a destination, | ||
+ | |||
+ | For example: | ||
+ | |||
+ | <cli> | ||
+ | lab46:~$ dd if=/ | ||
+ | 9+1 records in | ||
+ | 9+1 records out | ||
+ | 4912 bytes (4.9 kB) copied, 0.0496519 s, 98.9 kB/s | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | Here, **if=** specifies the source (input file) of our data, and **of=** specifies the destination (output file) for the data. | ||
+ | |||
+ | Doing some comparisons: | ||
+ | |||
+ | <cli> | ||
+ | lab46:~$ ls -l / | ||
+ | -rwxr-xr-x 1 root root 4912 May 4 2010 / | ||
+ | -rw-r--r-- 1 user lab46 4912 Nov 13 14:57 howlong | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | ====Investigating==== | ||
+ | |||
+ | ^ 1. ^|Answer me the following:| | ||
+ | | ^ a.|What is different about these two files?| | ||
+ | |:::^ b.|What is similar?| | ||
+ | |:::^ c.|If **dd**(**1**) copies (or duplicates) data, why do you suppose these differences exist?| | ||
+ | |:::^ d.|What is the output of **file**(**1**) when you run it on both of these files?| | ||
+ | |:::^ e.|When you execute each file, is the output the same or different?| | ||
+ | |:::^ f.|Any prerequisite steps needed to get either file to run? What were they?| | ||
+ | |||
+ | Consistency of data has been a desire of computer users long before computers were readily available. To be able to verify the authenticity of two works of data, minimizing the chances of some hidden alteration or forgery is an important capability to possess. | ||
+ | |||
+ | ====Comparisons==== | ||
+ | |||
+ | Although many ways exist, there are two common ways of comparing two files: | ||
+ | |||
+ | * **diff**(**1**): | ||
+ | * **md5sum**(**1**): | ||
+ | |||
+ | ^ 2. ^|Answer me the following:| | ||
+ | | ^ a.|Are **/ | ||
+ | |:::^ b.|Using **diff**(**1**), | ||
+ | |:::^ c.|Using **md5sum**(**1**), | ||
+ | |:::^ d.|Using **md5sum**(**1**), | ||
+ | |:::^ e.|How could an MD5 hash be useful with regards to data integrity and security?| | ||
+ | |:::^ f.|In what situations could **diff**(**1**) be a useful tool for comparing differences? | ||
+ | =====Exercise===== | ||
+ | |||
+ | ^ 3. ^|Do the following:| | ||
+ | | ^ a.|Using **dd**(**1**), | ||
+ | |:::^ b.|How did you do this?| | ||
+ | |:::^ c.|How could you verify you were successful? | ||
+ | |:::^ d.|If you ran **echo "more information" | ||
+ | |:::^ e.|Can you find this information in **test.file**? | ||
+ | |:::^ f.|If you wanted to retrieve the information you just added using **dd**(**1**), | ||
+ | |||
+ | <WRAP round info box> | ||
+ | |||
+ | In the **data/** subdirectory of the UNIX Public Directory is a file called **data.file** | ||
+ | |||
+ | Please copy this to your home directory to work on the following question. | ||
+ | |||
+ | ^ 4. ^|Applying your skills to analyze **data.file**, | ||
+ | | ^ a.|How large (in bytes) is this file?| | ||
+ | |:::^ b.|What information predominantly appears to be in the first 3kB of the file?| | ||
+ | |:::^ c.|Does this information remain constant throughout the file? Are there ranges where it differs? What are they?| | ||
+ | |:::^ d.|How would you extract the data at one of these ranges and place it into unique files? Extract the data at each identified range.| | ||
+ | |:::^ e.|How many such ranges of data are there in this file?| | ||
+ | |:::^ f.|Run **file**(**1**) on each file that hosts extracted data. What is each type of file?| | ||
+ | |:::^ g.|Based on the output of **file**(**1**), | ||
+ | |||
+ | |||
+ | =====Conclusions===== | ||
+ | This assignment has activities which you should tend to- document/ | ||
+ | |||
+ | As always, the class mailing list and class IRC channel are available for assistance, but not answers. |