파일에 텍스트 또는 텍스트가 긴 경우 binmake 도구를 사용하면 텍스트 형식으로 일부 이진 데이터를 설명하고 이진 파일을 생성하거나 표준 출력으로 출력 할 수 있습니다. 엔디안 및 숫자 형식을 변경하고 주석을 허용합니다.
기본 형식은 16 진수이지만 이에 국한되지는 않습니다.
먼저 얻고 binmake 컴파일 : 당신은 파이프가 stdin
및 stdout
를 사용 할 수
$ git clone https://github.com/dadadel/binmake
$ cd binmake
$ make
:
$ echo '32 decimal 32 61 %x20 %x61' | ./binmake | hexdump -C
00000000 32 20 3d 20 61 |2 = a|
00000005
또는 파일을 사용합니다.
# an exemple of file description of binary data to generate
# set endianess to big-endian
big-endian
# default number is hexadecimal
00112233
# man can explicit a number type: %b means binary number
%b0100110111100000
# change endianess to little-endian
little-endian
# if no explicit, use default
44556677
# bytes are not concerned by endianess
88 99 aa bb
# change default to decimal
decimal
# following number is now decimal
# strings are delimited by " or '
"this is some raw string"
# explicit hexa number starts with %x
%xff
바이너리 파일을 file.bin
생성 : 편집 @Humpparitari에 대한
$ ./binmake file.txt file.bin
$ hexdump file.bin -C
00000000 00 11 22 33 4d e0 77 66 55 44 88 99 aa bb 7b 74 |.."3M.wfUD....{t|
00000010 68 69 73 20 69 73 20 73 6f 6d 65 20 72 61 77 20 |his is some raw |
00000020 73 74 72 69 6e 67 ff |string.|
00000027
덕분에 따라서 텍스트 파일
file.txt
을 만들! – 1010