How to split one binary file.

a.bin

 

Split a.bin to c.bin d.bin at 32 bytes postion.

dd if=a.bin of=c.bin ibs=32 count=1

Now, we got c.bin 

dd if=a.bin of=d.bin ibs=32 skip=1

Now, we got d.bin

 

So, if you want to insert one file into another, you can use this method.

 

For example,

a.bin is 0x1024 bytes data. you want to insert b.bin (length=0x30) into a.bin offset 0x100 (256).

you can use below scripts:

dd if=a.bin of=c.bin ibs=256 count=1 && dd if=a.bin of=d.bin ibs=256 skip=1 && cat /dev/null >> a.bin && cat c.bin >> a.bin && cat b.bin >> a.bin && cat d.bin >> a.bin

Please have a try.

 

posted @ 2017-11-28 21:59  JustRelax  阅读(118)  评论(0编辑  收藏  举报