hex dump von Master Boot Record, Hard Drive Partition, Partition Table, FAT Partition Boot Sector
-
hi,
wie kann ich mir einen hex dump von Master Boot Record, Hard Drive Partition, Partition Table, FAT Partition Boot Sector anzeigen lassen?
der typ hier hat das auch irgendwie gemacht: http://www.cs.utsa.edu/~jcochett/gradproj/docs/ntfs.pdfbye
-
ruediger schrieb:
hi,
wie kann ich mir einen hex dump von Master Boot Record, Hard Drive Partition, Partition Table, FAT Partition Boot Sector anzeigen lassen?
der typ hier hat das auch irgendwie gemacht: http://www.cs.utsa.edu/~jcochett/gradproj/docs/ntfs.pdfbye
Unter Windows zumindest gibts da den Trick, dass man spezielle Files auslesen kann, z. B. mit "//./C:" kann man den MBR des Laufwerks C auslesen. Hab den MSDN-Link leider verloren, aber hier mal folgender Java-Code fuer dich, vielleicht hilft der ja a bisserl:
import java.io.*; class BootsectorReader { // fills a string with initial '0' if it's shorter than desiredLength public static String fill(String str, int desiredLength) { while (str.length() < desiredLength) str = '0' + str; return str; } // prints some information about the bootsector stored in the array a public static void printInformation(int[] a) { System.out.println(); System.out.println("Bootsektor:"); System.out.println("========================================================"); System.out.print("Hersteller: "); for (int i = 0; i < 8; ++i) System.out.print((char) a[3+i]); System.out.println(); System.out.print("Bytes/Sektor: "); System.out.println(a[0x0B] + a[0x0C]*256); System.out.print("Sektoren/Cluster: "); System.out.println((int) a[0x0D]); System.out.print("Sektoren/Spur: "); System.out.println(a[0x18] + a[0x19]*256); System.out.print("Schreib-/LeseKoepfe: "); System.out.println(a[0x1A] + a[0x1B]*256); System.out.print("Partitionstyp: "); System.out.println(Integer.toHexString(a[0x24]).toUpperCase() + 'h'); } // prints the hex value of the lower byte of each character in array a public static void printHex(int[] a) { for (int i : a) System.out.print(fill(Integer.toHexString(i),2).toUpperCase()+' '); } /* * prints the given char-array. * Values representing valid ASCII letters will be printed as they are, * all other values will be replaces by dots */ public static void printAscii(int[] a) { for (int i : a) { if (32 <= i && i <= 127) // char is printable System.out.print((char) i); else System.out.print('.'); } } public static void main(String[] args) throws Exception { if (args.length < 1) { System.out.println("USAGE: java Bootsector <DEVICENAME>\n"); System.exit(0); } InputStream file = new BufferedInputStream(new FileInputStream("//./" + args[0] + ":")); int[] sectorData = new int[512]; for (int i = 0; i < sectorData.length; ++i) sectorData[i] = file.read(); file.close(); // print buffer, 16 bytes per line (both in hex and as ASCII) int[] actualLine = new int[16]; for (int i = 0; i < sectorData.length; i += 16) { System.arraycopy(sectorData, i, actualLine, 0, 16); System.out.print(fill(Integer.toHexString(i), 4) + ": "); printHex(actualLine); System.out.print('\t'); printAscii(actualLine); System.out.println(); } printInformation(sectorData); } }EDIT: mein 1337. Post
SCNR :xmas2:
-
Unter Linux ohne programmieren einfach mit dd, z.B. den mbr:
dd if=/dev/hda1 of=bootsect.img bs=512c count=1
-
[root@Linux dev]# ls -lh total 0 crw-rw---- 1 root root 14, 12 Dec 21 15:53 adsp crw------- 1 root root 10, 175 Dec 21 15:53 agpgart crw------- 1 root root 14, 4 Dec 21 15:53 audio drwxr-xr-x 3 root root 60 Dec 21 15:53 bus lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdrom -> hda lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdrom-hda -> hda lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdrom-hdb -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdrw -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdrw-hdb -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdwriter -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 cdwriter-hdb -> hdb crw------- 1 root root 5, 1 Dec 21 17:37 console lrwxrwxrwx 1 root root 11 Dec 21 15:53 core -> /proc/kcore drwxr-xr-x 6 root root 120 Dec 21 15:53 disk brw-r----- 1 root disk 253, 0 Dec 21 10:53 dm-0 brw-r----- 1 root disk 253, 1 Dec 21 10:53 dm-1 drwxr-xr-x 2 root root 60 Dec 21 15:54 dri crw------- 1 root root 14, 3 Dec 21 15:53 dsp lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvd -> hda lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvd-hda -> hda lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvd-hdb -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvdrw -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvdrw-hdb -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvdwriter -> hdb lrwxrwxrwx 1 root root 3 Dec 21 15:53 dvdwriter-hdb -> hdb lrwxrwxrwx 1 root root 13 Dec 21 15:53 fd -> /proc/self/fd brw-rw---- 1 root floppy 2, 0 Dec 21 15:53 fd0 brw-rw---- 1 root floppy 2, 84 Dec 21 15:53 fd0u1040 brw-rw---- 1 root floppy 2, 88 Dec 21 15:53 fd0u1120 brw-rw---- 1 root floppy 2, 28 Dec 21 15:53 fd0u1440 brw-rw---- 1 root floppy 2, 44 Dec 21 15:53 fd0u1680 brw-rw---- 1 root floppy 2, 60 Dec 21 15:53 fd0u1722 brw-rw---- 1 root floppy 2, 76 Dec 21 15:53 fd0u1743 brw-rw---- 1 root floppy 2, 96 Dec 21 15:53 fd0u1760 brw-rw---- 1 root floppy 2, 116 Dec 21 15:53 fd0u1840 brw-rw---- 1 root floppy 2, 100 Dec 21 15:53 fd0u1920 brw-rw---- 1 root floppy 2, 12 Dec 21 15:53 fd0u360 brw-rw---- 1 root floppy 2, 16 Dec 21 15:53 fd0u720 brw-rw---- 1 root floppy 2, 120 Dec 21 15:53 fd0u800 brw-rw---- 1 root floppy 2, 52 Dec 21 15:53 fd0u820 brw-rw---- 1 root floppy 2, 68 Dec 21 15:53 fd0u830 lrwxrwxrwx 1 root root 3 Dec 21 15:53 floppy-fd0 -> fd0 crw-rw-rw- 1 root root 1, 7 Dec 21 15:53 full srwxrwxrwx 1 root root 0 Dec 21 15:54 gpmctl brw-rw---- 1 root disk 3, 0 Dec 21 15:53 hda brw-rw---- 1 root disk 3, 64 Dec 21 15:53 hdb crw------- 1 root root 10, 228 Dec 21 15:53 hpet prw------- 1 root root 0 Dec 21 17:37 initctl drwxr-xr-x 2 root root 60 Dec 21 16:36 input crw------- 1 root root 1, 11 Dec 21 15:53 kmsg srw-rw-rw- 1 root root 0 Dec 21 15:54 log brw-r----- 1 root disk 7, 0 Dec 21 15:53 loop0 brw-r----- 1 root disk 7, 1 Dec 21 15:53 loop1 brw-r----- 1 root disk 7, 2 Dec 21 15:53 loop2 brw-r----- 1 root disk 7, 3 Dec 21 15:53 loop3 brw-r----- 1 root disk 7, 4 Dec 21 15:53 loop4 brw-r----- 1 root disk 7, 5 Dec 21 15:53 loop5 brw-r----- 1 root disk 7, 6 Dec 21 15:53 loop6 brw-r----- 1 root disk 7, 7 Dec 21 15:53 loop7 crw-rw---- 1 root lp 6, 0 Dec 21 15:53 lp0 lrwxrwxrwx 1 root root 13 Dec 21 15:53 MAKEDEV -> /sbin/MAKEDEV drwxr-xr-x 2 root root 100 Dec 21 10:53 mapper brw-r----- 1 root disk 9, 0 Dec 21 15:53 md0 crw-r----- 1 root kmem 1, 1 Dec 21 15:53 mem crw------- 1 root root 14, 0 Dec 21 15:53 mixer drwxr-xr-x 2 root root 60 Dec 21 15:53 net crw-rw-rw- 1 root root 1, 3 Dec 21 15:53 null crw-rw---- 1 root root 10, 144 Dec 21 15:53 nvram lrwxrwxrwx 1 root root 3 Dec 21 15:53 par0 -> lp0 crw-rw---- 1 root lp 99, 0 Dec 21 15:53 parport0 crw-rw---- 1 root lp 99, 1 Dec 21 15:53 parport1 crw-rw---- 1 root lp 99, 2 Dec 21 15:53 parport2 crw-rw---- 1 root lp 99, 3 Dec 21 15:53 parport3 crw-r----- 1 root kmem 1, 4 Dec 21 15:53 port crw------- 1 root root 108, 0 Dec 21 15:53 ppp crw-rw-rw- 1 root tty 5, 2 Dec 22 11:20 ptmx drwxr-xr-x 2 root root 0 Dec 21 10:53 pts lrwxrwxrwx 1 root root 4 Dec 21 15:53 ram -> ram1 brw-r----- 1 root disk 1, 0 Dec 21 10:53 ram0 brw-r----- 1 root disk 1, 1 Dec 21 10:53 ram1 brw-r----- 1 root disk 1, 10 Dec 21 10:53 ram10 brw-r----- 1 root disk 1, 11 Dec 21 10:53 ram11 brw-r----- 1 root disk 1, 12 Dec 21 10:53 ram12 brw-r----- 1 root disk 1, 13 Dec 21 10:53 ram13 brw-r----- 1 root disk 1, 14 Dec 21 10:53 ram14 brw-r----- 1 root disk 1, 15 Dec 21 10:53 ram15 brw-r----- 1 root disk 1, 2 Dec 21 10:53 ram2 brw-r----- 1 root disk 1, 3 Dec 21 10:53 ram3 brw-r----- 1 root disk 1, 4 Dec 21 10:53 ram4 brw-r----- 1 root disk 1, 5 Dec 21 10:53 ram5 brw-r----- 1 root disk 1, 6 Dec 21 10:53 ram6 brw-r----- 1 root disk 1, 7 Dec 21 10:53 ram7 brw-r----- 1 root disk 1, 8 Dec 21 10:53 ram8 brw-r----- 1 root disk 1, 9 Dec 21 10:53 ram9 lrwxrwxrwx 1 root root 4 Dec 21 15:53 ramdisk -> ram0 crw-rw-rw- 1 root root 1, 8 Dec 21 15:53 random brw------- 1 root root 253, 0 Dec 21 10:53 root crw-r--r-- 1 root root 10, 135 Dec 21 10:53 rtc brw-r----- 1 root disk 8, 0 Dec 21 10:53 sda brw-r----- 1 root disk 8, 1 Dec 21 15:53 sda1 brw-r----- 1 root disk 8, 2 Dec 21 10:53 sda2 crw------- 1 root root 14, 1 Dec 21 15:53 sequencer crw-rw---- 1 root root 14, 8 Dec 21 15:53 sequencer2 crw------- 1 root root 21, 0 Dec 21 15:53 sg0 drwxrwxrwt 3 root root 60 Dec 21 16:25 shm drwxr-xr-x 2 root root 220 Dec 21 15:53 snd lrwxrwxrwx 1 root root 15 Dec 21 15:53 stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Dec 21 15:53 stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Dec 21 15:53 stdout -> /proc/self/fd/1 crw------- 1 root root 4, 0 Dec 21 10:53 systty crw-rw-rw- 1 root tty 5, 0 Dec 21 15:53 tty crw-rw---- 1 root root 4, 0 Dec 21 10:53 tty0 crw------- 1 root root 4, 1 Dec 21 15:54 tty1 crw-rw---- 1 root tty 4, 10 Dec 21 10:53 tty10 crw-rw---- 1 root tty 4, 11 Dec 21 10:53 tty11 crw-rw---- 1 root tty 4, 12 Dec 21 10:53 tty12 crw-rw---- 1 root tty 4, 13 Dec 21 15:53 tty13 crw-rw---- 1 root tty 4, 14 Dec 21 15:53 tty14 crw-rw---- 1 root tty 4, 15 Dec 21 15:53 tty15 crw-rw---- 1 root tty 4, 16 Dec 21 15:53 tty16 crw-rw---- 1 root tty 4, 17 Dec 21 15:53 tty17 crw-rw---- 1 root tty 4, 18 Dec 21 15:53 tty18 crw-rw---- 1 root tty 4, 19 Dec 21 15:53 tty19 crw------- 1 root root 4, 2 Dec 21 15:54 tty2 crw-rw---- 1 root tty 4, 20 Dec 21 15:53 tty20 crw-rw---- 1 root tty 4, 21 Dec 21 15:53 tty21 crw-rw---- 1 root tty 4, 22 Dec 21 15:53 tty22 crw-rw---- 1 root tty 4, 23 Dec 21 15:53 tty23 crw-rw---- 1 root tty 4, 24 Dec 21 15:53 tty24 crw-rw---- 1 root tty 4, 25 Dec 21 15:53 tty25 crw-rw---- 1 root tty 4, 26 Dec 21 15:53 tty26 crw-rw---- 1 root tty 4, 27 Dec 21 15:53 tty27 crw-rw---- 1 root tty 4, 28 Dec 21 15:53 tty28 crw-rw---- 1 root tty 4, 29 Dec 21 15:53 tty29 crw------- 1 root root 4, 3 Dec 21 15:54 tty3 crw-rw---- 1 root tty 4, 30 Dec 21 15:53 tty30 crw-rw---- 1 root tty 4, 31 Dec 21 15:53 tty31 crw-rw---- 1 root tty 4, 32 Dec 21 15:53 tty32 crw-rw---- 1 root tty 4, 33 Dec 21 15:53 tty33 crw-rw---- 1 root tty 4, 34 Dec 21 15:53 tty34 crw-rw---- 1 root tty 4, 35 Dec 21 15:53 tty35 crw-rw---- 1 root tty 4, 36 Dec 21 15:53 tty36 crw-rw---- 1 root tty 4, 37 Dec 21 15:53 tty37 crw-rw---- 1 root tty 4, 38 Dec 21 15:53 tty38 crw-rw---- 1 root tty 4, 39 Dec 21 15:53 tty39 crw------- 1 root root 4, 4 Dec 21 15:54 tty4 crw-rw---- 1 root tty 4, 40 Dec 21 15:53 tty40 crw-rw---- 1 root tty 4, 41 Dec 21 15:53 tty41 crw-rw---- 1 root tty 4, 42 Dec 21 15:53 tty42 crw-rw---- 1 root tty 4, 43 Dec 21 15:53 tty43 crw-rw---- 1 root tty 4, 44 Dec 21 15:53 tty44 crw-rw---- 1 root tty 4, 45 Dec 21 15:53 tty45 crw-rw---- 1 root tty 4, 46 Dec 21 15:53 tty46 crw-rw---- 1 root tty 4, 47 Dec 21 15:53 tty47 crw-rw---- 1 root tty 4, 48 Dec 21 15:53 tty48 crw-rw---- 1 root tty 4, 49 Dec 21 15:53 tty49 crw------- 1 root root 4, 5 Dec 21 15:54 tty5 crw-rw---- 1 root tty 4, 50 Dec 21 15:53 tty50 crw-rw---- 1 root tty 4, 51 Dec 21 15:53 tty51 crw-rw---- 1 root tty 4, 52 Dec 21 15:53 tty52 crw-rw---- 1 root tty 4, 53 Dec 21 15:53 tty53 crw-rw---- 1 root tty 4, 54 Dec 21 15:53 tty54 crw-rw---- 1 root tty 4, 55 Dec 21 15:53 tty55 crw-rw---- 1 root tty 4, 56 Dec 21 15:53 tty56 crw-rw---- 1 root tty 4, 57 Dec 21 15:53 tty57 crw-rw---- 1 root tty 4, 58 Dec 21 15:53 tty58 crw-rw---- 1 root tty 4, 59 Dec 21 15:53 tty59 crw------- 1 root root 4, 6 Dec 21 15:54 tty6 crw-rw---- 1 root tty 4, 60 Dec 21 15:53 tty60 crw-rw---- 1 root tty 4, 61 Dec 21 15:53 tty61 crw-rw---- 1 root tty 4, 62 Dec 21 15:53 tty62 crw-rw---- 1 root tty 4, 63 Dec 21 15:53 tty63 crw-rw---- 1 root root 4, 7 Dec 21 10:53 tty7 crw-rw---- 1 root root 4, 8 Dec 21 15:53 tty8 crw-rw---- 1 root tty 4, 9 Dec 21 10:53 tty9 crw-rw---- 1 root uucp 4, 64 Dec 21 10:53 ttyS0 crw-rw---- 1 root uucp 4, 65 Dec 21 10:53 ttyS1 crw-rw---- 1 root uucp 4, 66 Dec 21 10:53 ttyS2 crw-rw---- 1 root uucp 4, 67 Dec 21 10:53 ttyS3 cr--r--r-- 1 root root 1, 9 Dec 21 15:53 urandom crw------- 1 vcsa tty 7, 0 Dec 21 15:53 vcs crw------- 1 vcsa tty 7, 1 Dec 21 15:54 vcs1 crw------- 1 vcsa tty 7, 2 Dec 21 15:54 vcs2 crw------- 1 vcsa tty 7, 3 Dec 21 15:54 vcs3 crw------- 1 vcsa tty 7, 4 Dec 21 15:54 vcs4 crw------- 1 vcsa tty 7, 5 Dec 21 15:54 vcs5 crw------- 1 vcsa tty 7, 6 Dec 21 15:54 vcs6 crw------- 1 vcsa tty 7, 7 Dec 21 15:54 vcs7 crw------- 1 vcsa tty 7, 8 Dec 21 15:53 vcs8 crw------- 1 vcsa tty 7, 128 Dec 21 15:53 vcsa crw------- 1 vcsa tty 7, 129 Dec 21 15:54 vcsa1 crw------- 1 vcsa tty 7, 130 Dec 21 15:54 vcsa2 crw------- 1 vcsa tty 7, 131 Dec 21 15:54 vcsa3 crw------- 1 vcsa tty 7, 132 Dec 21 15:54 vcsa4 crw------- 1 vcsa tty 7, 133 Dec 21 15:54 vcsa5 crw------- 1 vcsa tty 7, 134 Dec 21 15:54 vcsa6 crw------- 1 vcsa tty 7, 135 Dec 21 15:54 vcsa7 crw------- 1 vcsa tty 7, 136 Dec 21 15:53 vcsa8 drwx------ 2 root root 80 Dec 21 15:53 VolGroup00 lrwxrwxrwx 1 root root 4 Dec 21 15:53 X0R -> null crw-rw-rw- 1 root root 1, 5 Dec 21 15:53 zero [root@Linux dev]# dd if=/dev/hda of=bootsect.img bs=512c count=1 dd: opening `/dev/hda': No medium foundder befehl kopiert den bootsector der platte in ein img file? warum funktioniert das nicht? hat jemand fat32 und kann mir das file schicken? unter windows funktionert sowas nicht?
-
Unter Windows geht das mit "debug"
-
wie mit debug?
kann man unter windows mit tricks ein festplatten image manuell mounten?cu
-
hd(ab..) wäre natürlich für IDE-Festplatten.
In deinem Fall hängt da ein IDE-DVD-Laufwerk oder so dran.
Du hast wahrscheinlich ein SATA Gerät (oder SCSI), dann kannst du das mit sd(ab..) ansprechen.
Den mbr meiner SATA-Platte kann ich z.B. so in die Datei bootsect.img schreiben:dd if=/dev/sda of=bootsect.img bs=512c count=1
edit: wenn du den Bootsektor einer Partition willst dann stellst du halt einfach noch Zähler der Partition dahinter (hab ich im ersten Post von mir übersehen):
dd if=/dev/sda2 of=bootsect2.img bs=512c count=1
Versuch das mal.
Die Partitionstabelle kannst du unter Linux übrigens auch mit fdisk in hex ausgeben:
fdisk /dev/sda
dann x für expert modus und p um die Tabelle anzuzeigen (glaub ich, mit m kann man sich eine Übersicht der Befehle anzeigen lassen..).