Как вы получаете «сырой двоичный дамп» файла?

13595
Shashank Sabniveesu

Я пришел через это в вопросе - Что в мире файл .el8? , Мне любопытно, как @slhck определил, что данный файл указывает на программное обеспечение - eLecta

0
«eLecta» отображается в виде открытого текста в последней строке содержимого файла. Взяв эту небольшую часть информации и поиска указав на существующее программное обеспечение. Это, вероятно, не было технически более сложным, чем это, но возможность использовать имеющуюся информацию в своих интересах - очень важный навык сам по себе :-). Таким образом, «двоичный дамп» в этом случае должен указывать только на необработанное содержимое, которое, по словам автора, было показано в Vim. Daniel Andersson 10 лет назад 2
Получите любое из нескольких приложений "hex dump" или "hex browser". Я очень люблю (бесплатный) "Hex Editor Neo" с http://www.hhdsoftware.com/ (для Windows). Daniel R Hicks 10 лет назад 0

4 ответа на вопрос

4
grawity

My guess:

It's most likely that "raw binary dump" actually meant a hexdump – a listing that shows each byte in the file as hexadecimal numbers, instead of (or in addition to) the byte itself.

It usually looks like this:

... 00000a0: 6d65 3233 3a6d 6564 6961 7769 6b69 2d31 me23:mediawiki-1 00000b0: 2e31 352e 312e 7461 722e 677a 3132 3a70 .15.1.tar.gz12:p 00000c0: 6965 6365 206c 656e 6774 6869 3332 3736 iece lengthi3276 00000d0: 3865 363a 7069 6563 6573 3636 3230 3ae9 8e6:pieces6620:. 00000e0: b08a 7ef8 00f8 d8b4 a53e 15e3 6bd6 e2c4 ..~......>..k... 00000f0: a7e4 1aa6 c67f 7106 cd3e 1672 decc b5c7 ......q..>.r.... 0000100: 455c a86d 4751 379a f59f 3665 1e8c 128a E\.mGQ7...6e.... 0000110: dec4 e670 ca0f e960 353b 48fe 3dfb c455 ...p...`5;H.=..U 0000120: f940 e102 13d6 8385 1655 4642 3e83 060b .@.......UFB>... 0000130: 585f d353 2ef2 07ff d9e3 aeb6 7329 2192 X_.S........s)!. 0000140: e0a9 7d75 390f 3c16 def6 d806 469e af64 ..}u9.<.....F..d ... 

In which each line has a start position, 16 bytes in hex, and the same 16 bytes in "safe" form (that is, bytes between 0x20 and 0x7f shown directly, the rest replaced with .'s).

On Linux, xxd, hd, hexdump -C, or various incantations of od can be used. On Windows, a number of binary editors like hiew or HxD.

Я признаю, что использовал неправильный словарный запас там. Двоичный код был бы чем-то совершенно другим. slhck 10 лет назад 1
Я думаю, вы знаете, но чтобы быть ясным, похоже, что od не отображает двоичный файл barlop 10 лет назад 0
3
Hennes

The file was simply opened in a text editor. In this case in vi, which probably was a link to Vim. Regular ASCII characters were shown. Unprintable characters were replaced by the ^@ signs.

The goal of this was to see if the file had any magic numbers in it. In this case, the file did not have any, but it contained the path to the temporary directory where the recording was made. We lucked out because that contained the name of the program in the path.

A more advanced version would be to use a hex editor, or to configure vi[m] to show the data in a different format with xxd.

3
barlop

Чтобы ответить на вопрос, который задает тема вашего сообщения (как получить «сырой двоичный дамп» файла?):

Файл a.aимеет букву «а», за которой следует CR LF .

C:\Program Files\Vim\vim73 >type a.a a 

xxd -b(бинарный) не поддерживает -ps(простой), так что вы получите мусор ( 0000000:и a..)

C:\Program Files\Vim\vim73 >xxd -b a.a 0000000: 01100001 00001101 00001010 a.. 

Вот решение:

xxd -b a.a | sed -r "s/\d32.*//g" | sed "s/.*://" | sed "s/\d32//g" 

Производит

011000010000110100001010

Ниже работает.

Давайте посмотрим, как 0000000: 01100001 00001101 00001010 a..это составлено. Итак, большой разрыв - это куча пробелов.

C:\Program Files\Vim\vim73 >xxd -b a.a | od -tx1 0000000 30 30 30 30 30 30 30 3a 20 30 31 31 30 30 30 30 0000020 31 20 30 30 30 30 31 31 30 31 20 30 30 30 30 31 0000040 30 31 30 20 20 20 20 20 20 20 20 20 20 20 20 20 0000060 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0000100 61 2e 2e 0d 0a 0000105 

Я удалил длинную последовательность пробелов и все, что следует за ними. Так что это там:

C:\Program Files\Vim\vim73 >xxd -b a.a | sed -r "s/\d32.*//g" 0000000: 01100001 00001101 00001010 

Удалите от 0 до двоеточия включительно и удалите все остальные пробелы:

C:\Program Files\Vim\vim73 xxd -b a.a | sed -r "s/\d32.*//g" | sed "s/.*://" 01100001 00001101 00001010  C:\Program Files\Vim\vim73 >xxd -b a.a | sed -r "s/\d32.*//g" | sed "s/.*://" | sed "s/\d32//g" 011000010000110100001010 

И вот есть решение

C:\Program Files\Vim\vim73 >xxd -b a.a | sed -r "s/\d32.*//g" | sed "s/.*://" | sed "s/\d32//g" 011000010000110100001010 

xxd доступен в Vim 7.x, а sed доступен в GnuWin32 .

2
Jublo

@slhck looked at the question, containing a vi dump. Quoting part of that here:

^@^@^@^@^@^@^@^@ò½^@^@;C:\eLecta\Server\TempRecordings\U734806R4970S3962792726.el8¢s³wÕs³w^@^@^@^@è(D

On Windows, get a binary dump with HxD. Or you might just try to open the file in Notepad. Similar applies to *nix systems.