This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
haas:spring2016:unix:projects:udr1 [2015/03/14 18:27] – external edit 127.0.0.1 | haas:spring2016:unix:projects:udr1 [2016/03/15 13:37] (current) – [Partition Layout] wedge | ||
---|---|---|---|
Line 11: | Line 11: | ||
Typos and bug fixes: | Typos and bug fixes: | ||
- | * Please see the **README** file in the project directory | + | * < |
=====Objective===== | =====Objective===== | ||
- | Practice and review | + | Use your UNIX skills |
- | =====Background===== | + | =====Backstory===== |
- | The last project introduced us to many important concepts. | + | It always starts the same way: you torrent |
- | But the concepts of offsets and quantities of data at an offset is an important thing to understand. With that, udr1 continues to play in that exciting realm, offering you another chance at getting more familiar with some very powerful UNIX tools. | + | Turns out this one had a few tricks up its sleeve. Of particular note: partition scrambling. Oh no! All the memes! |
- | For those who have had the fortune | + | After downing two Mr. Pibbs, a Mars bar, and a pack of Necco Wafers |
- | I am also having you review your file permissions skills through the use of a tool called | + | Turns out there was at least **some** redundancy... a backup of the partition table/ |
- | Extract and process **gizmo** appropriately, and then you can run **urev** and complete your file permission exercises (you have a week to do 96 exercises, but you are limited by how many you can do in one sitting, and there' | + | You need to recover the partition table, restore the disk to its accessible state, and copy pertinent files onto one of its partitions. Basic file management never seemed |
- | This is also intended | + | Time to dust off that hexadecimal, |
+ | |||
+ | =====Background===== | ||
+ | Your data, as we experience it today, is organized in units of files (regular files, directory files, special files). Turns out, that is further organized into things called inodes and superblocks, | ||
+ | |||
+ | Below that, we have the notion of sectors (units of transactions), | ||
+ | |||
+ | So here, below the file system, in fact, what helps establish boundaries | ||
=====Obtain the file===== | =====Obtain the file===== | ||
- | This week's project is located in the **spring2015/udr1/ | + | This week's project is located in the **udr1/ |
- | Make a copy of this into your home directory | + | You need to go there and run a program called **prep**, by providing it the absolute path to the directory you've made to store your files for the **udr1** project. |
+ | |||
+ | For example, if you've made a **src/ | ||
+ | |||
+ | < | ||
+ | lab46:/ | ||
+ | Processing disk.image ......................................... | ||
+ | MBR backup is at offset 0xXXXXXX | ||
+ | Process complete. Your file is in '/ | ||
+ | lab46:/ | ||
+ | </ | ||
+ | |||
+ | A couple | ||
+ | |||
+ | * the file you need, **disk.image** will be copied | ||
+ | * You'll get an offset for the "**MBR backup**" | ||
- | **NOTE:** Hopefully it has been standard practice to locate project files in their own unique subdirectory, | ||
- | |||
=====Process===== | =====Process===== | ||
- | The data you seek (2 files) is obfuscated and contained within this file. | + | In order to gain access to the drive (in the form of the file called **disk.image**, |
- | Plain text directions give clues on how to find both pieces | + | There is a backup stored |
- | Some additional information: | + | Once you have it, you'll want to restore it onto the drive; it needs to occupy the first sector on the drive. |
- | * The first file should be named **udr1.text** | + | Once you have that in place, we can use a hex editor to study the partition table and determine |
- | * The second (big) file runs from the starting | + | |
- | * It should be named 'gizmo', and reside | + | You'll want to extract each partition individually from the disk image so you can better interact with it. You'll need to determine the partition type and ensure a viable filesystem is in place (think back to the puzzle boxes). Ultimately |
- | * gizmo is binary data, and entirely reversed- | + | |
- | * You are to write a shell script to perform the de-reversal of the data, reading from data.file and through whatever processing is needed, produce the file called | + | To facilitate your efforts, please name each extracted partition files as follows: |
- | * The **urev** tool has some additional constraints with respect | + | |
+ | * partition #1: **udr1.part1.img** | ||
+ | * if there' | ||
+ | | ||
+ | * if there' | ||
+ | |||
+ | As this is a disk image of the chief meme archivist' | ||
+ | |||
+ | Finally, reintegrating the changed fourth partition over the old one, so that you can submit the whole restored image, along with a list of command-lines | ||
=====Useful tools===== | =====Useful tools===== | ||
You may want to become familiar with the manual pages of the following tools (in addition to tools you've already encountered): | You may want to become familiar with the manual pages of the following tools (in addition to tools you've already encountered): | ||
- | * **dd**(1) | + | * **dd**(1) |
* **bc**(1) | * **bc**(1) | ||
- | * **du**(1) | + | * **mtools**(1) |
- | * **bash**(1) shell scripting | + | |
- | * **od**(1) | + | |
- | * **bvi**(1) | + | |
* **hexedit**(1) | * **hexedit**(1) | ||
- | ... along with other tools previously encountered. | + | The aim is for this entire project to be performed on lab46. No external resources/ |
+ | |||
+ | Be sure to ask questions! There are bound to be many. | ||
+ | |||
+ | =====Partition Access===== | ||
+ | The partitions are defined in the partition table, located near the end of the first sector of the drive. | ||
+ | |||
+ | Of particular note, you're interested in groups of 16 bytes starting at offset **0x1BE**. | ||
+ | |||
+ | |||
+ | You may want to consult a reference of the binary layout of the MBR/ | ||
+ | |||
+ | * http:// | ||
+ | |||
+ | ====Partition Layout==== | ||
+ | A partition is defined in 16 bytes (the classic PC layout allows for four primary partitions). The byte layout is as follows: | ||
+ | |||
+ | ^ Byte ^ Description | ||
+ | | 0 | Boot Indicator (0x80 indicates it is set bootable) | ||
+ | | 1 | Starting CHS values (you can ignore for this project) | ||
+ | | 2 | ::: | | ||
+ | | 3 | ::: | | ||
+ | | 4 | Partition Type ID | | ||
+ | | 5 | Ending CHS values (you can ignore for this project) | ||
+ | | 6 | ::: | | ||
+ | | 7 | ::: | | ||
+ | | 8 | Starting Sector (little endian format) | ||
+ | | 9 | ::: | | ||
+ | | 10 | ::: | | ||
+ | | 11 | ::: | | ||
+ | | 12 | Partition Size (in Sectors) | ||
+ | | 13 | ::: | | ||
+ | | 14 | ::: | | ||
+ | | 15 | ::: | | ||
+ | |||
+ | ====Partition Types==== | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 10 OPUS 55 EZ-Drive | ||
+ | 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor | ||
+ | 12 Compaq diagnost 5c Priam Edisk | ||
+ | 14 Hidden FAT16 <3 61 SpeedStor | ||
+ | 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS | ||
+ | 17 Hidden HPFS/NTF 64 Novell Netware | ||
+ | 18 AST SmartSleep | ||
+ | 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep | ||
+ | 1c Hidden W95 FAT3 75 PC/IX | ||
+ | 1e Hidden W95 FAT1 80 Old Minix | ||
+ | </ | ||
=====Submission===== | =====Submission===== | ||
Successful completion will result in the following criteria being met: | Successful completion will result in the following criteria being met: | ||
- | * Resulting file with proper settings should enable | + | * When all is said and done, you will submit 2 files to me: |
- | | + | |
- | * Bonus opportunity: while still performing | + | * has the backup MBR restored to the proper place |
- | * When all is said and done, you will submit 3 files: | + | * has the mudkip/ |
- | * **udr1.text** | + | * **steps.txt**, |
- | * Append the dd line(s) as well as any other command lines needed to extract | + | * a list of command-lines used to accomplish every step of this project from start to finish (excluding the successful run of **prep** and the successful **submit**). |
- | * your bash script enabling | + | * explanations of the commands, as well as how you derived any numbers used. |
- | * Be sure to include comments indicating | + | * type ID (in hex as well as descriptive text) of each partition |
- | * Your extracted/ | + | * which partition is marked as bootable? |
+ | * total size (in bytes and sectors) of the MBR/ | ||
+ | * total size of each partition (as defined | ||
+ | * total formatted size of each filesystem | ||
+ | * amount of space used in each filesystem | ||
+ | * amount | ||
+ | * the disk label of each partition/ | ||
+ | * what file(s) are present in the fourth partition upon copying all mudkip/ | ||
+ | * what file(s) are left out? | ||
====Submit==== | ====Submit==== | ||
Line 80: | Line 175: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
Submitting unix project " | Submitting unix project " | ||
- | -> udr1.text(OK) | + | -> disk.image(OK) |
- | -> getgizmo.bash(OK) | + | -> steps.txt(OK) |
- | -> gizmo(OK) | + | |
SUCCESSFULLY SUBMITTED | SUCCESSFULLY SUBMITTED | ||
lab46: | lab46: | ||
</ | </ |