As title, the hexdump command is
$ hexdump -C -v files.bin
Write a simple tool is helpfull for the binary dump in the program...
1 #include
2 #include
3
4 #define BUF_SIZE 1024
5
6 int main(void)
7 {
8 int r;
9 unsigned char buf[BUF_SIZE];
10
11 int seed = 0;
12
13 while (1)
14 {
15 int i, j;
16
17 r = fread(buf, 1, BUF_SIZE, stdin);
18 if (0 == r)
19 {
20 break;
21 }
22
23 i = 0;
24
25 for (i = 0; i < r; i += 0x10, seed += 0x10)
26 {
27
28 printf("%08x ", seed);
29
30 j = i;
31 for (j = i; j < i + 0x10; j++)
32 {
33 if (0 == (j % 8))
34 {
35 printf(" ");
36 }
37 printf("%02x ", buf[j]);
38 }
39
40 j = i;
41 for (j = i; j < i + 0x10; j++)
42 {
43 if (0 == (j % 8))
44 {
45 printf(" ");
46 }
47 if ((buf[j] >= ' ') && (buf[j] <= '~'))
48 {
49 printf("%c", buf[j]);
50 }
51 else
52 {
53 printf(".");
54 }
55 }
56 printf("\n");
57 }
58 }
59
60 return 0;
61 }
62
The result is...
$ gcc -Wall ddc.c -o ddc
$
$ ./ddc < s.jpg
00000000 ff d8 ff e0 00 10 4a 46 49 46 00 01 01 00 00 01 ......JF IF......
00000010 00 01 00 00 ff db 00 43 00 08 06 06 07 06 05 08 .......C ........
00000020 07 07 07 09 09 08 0a 0c 14 0d 0c 0b 0b 0c 19 12 ........ ........
00000030 13 0f 14 1d 1a 1f 1e 1d 1a 1c 1c 20 24 2e 27 20 ........ ... $.'
00000040 22 2c 23 1c 1c 28 37 29 2c 30 31 34 34 34 1f 27 ",#..(7) ,01444.'
00000050 39 3d 38 32 3c 2e 33 34 32 ff c0 00 0b 08 00 08 9=82<.34 2.......
00000060 00 08 01 01 11 00 ff c4 00 1f 00 00 01 05 01 01 ........ ........
00000070 01 01 01 01 00 00 00 00 00 00 00 00 01 02 03 04 ........ ........
00000080 05 06 07 08 09 0a 0b ff c4 00 b5 10 00 02 01 03 ........ ........
00000090 03 02 04 03 05 05 04 04 00 00 01 7d 01 02 03 00 ........ ...}....
000000a0 04 11 05 12 21 31 41 06 13 51 61 07 22 71 14 32 ....!1A. .Qa."q.2
000000b0 81 91 a1 08 23 42 b1 c1 15 52 d1 f0 24 33 62 72 ....#B.. .R..$3br
000000c0 82 09 0a 16 17 18 19 1a 25 26 27 28 29 2a 34 35 ........ %&'()*45
000000d0 36 37 38 39 3a 43 44 45 46 47 48 49 4a 53 54 55 6789:CDE FGHIJSTU
000000e0 56 57 58 59 5a 63 64 65 66 67 68 69 6a 73 74 75 VWXYZcde fghijstu
000000f0 76 77 78 79 7a 83 84 85 86 87 88 89 8a 92 93 94 vwxyz... ........
00000100 95 96 97 98 99 9a a2 a3 a4 a5 a6 a7 a8 a9 aa b2 ........ ........
00000110 b3 b4 b5 b6 b7 b8 b9 ba c2 c3 c4 c5 c6 c7 c8 c9 ........ ........
00000120 ca d2 d3 d4 d5 d6 d7 d8 d9 da e1 e2 e3 e4 e5 e6 ........ ........
00000130 e7 e8 e9 ea f1 f2 f3 f4 f5 f6 f7 f8 f9 fa ff da ........ ........
00000140 00 08 01 01 00 00 3f 00 f0 ba ff d9 18 07 24 00 ......?. ......$.
$
No comments:
Post a Comment