Create Binary files in UNIX

后端 未结 5 1874
-上瘾入骨i
-上瘾入骨i 2021-02-06 00:39

This question was out there for a while and I thought I should offer some bonus points if I can get it to work.

What did I do…

Recently at work, I wrote a par

5条回答
  •  既然无缘
    2021-02-06 01:28

    You can use xxd to convert to and from binary files / hexdumps quite simply.

    data to hex

    echo  Hello | xxd -p 
    48656c6c6f0a
    

    hex to data

    echo 48656c6c6f0a | xxd -r -p
    Hello
    

    or

    echo 48 65 6c 6c 6f 0a | xxd -r -p
    Hello
    

    The -p is postscript mode which allows for a more freeform input

    This is the output from xxd -r -p text where text is the data you give above

    ==▒sGTP▒▒U<▒I▒▒▒΁/▒▒3▒▒▒▒▒▒▒▒▒bTY`84▒
                                         Xbp`▒▒▒▒▒▒▒|▒L▒@@(▒▒U8▒+#POC01
    :▒ިv▒b▒▒▒▒TY`84Ud▒▒▒▒>▒▒▒▒▒▒▒!▒
    blackberrynet▒/▒▒!
    M
    ▒▒!
    N
    ▒▒#Oripassword▒▒΁/▒▒΁/▒▒Xbp`▒@@(▒▒U8▒IvPOC01
    :qU▒b▒▒▒▒▒▒TY`84U▒▒▒*:▒▒!
    ▒k▒▒▒#O Welcmme!
    ▒!
    M
    

提交回复
热议问题