一个二进制文件与十六进制字符串互转小程序
##usage
~\Desktop>python bin2hex.py -h
usage: bin2hex.py [-h] [-b | -s OUTFILE] filename
convert to binary or strings.
positional arguments:
filename the file convert to binary or strings.
optional arguments:
-h, --help show this help message and exit
-b convert to binary,default is bin 2 hex
-s OUTFILE convert to hex string,save in the outfile, default is a.out
~\Desktop>python bin2hex.py vc6.lnk > test.t
~\Desktop>type test.t
4c0000000114020000000000c0000000000000468f00000020000000408232e760c6d201408232e7
60c6d201006d727e9fc8c4012f300400000000000500000000000000000000000000000043021400
1f50e04fd020ea3a6910a2d808002b30309d19002f433a5c00000000000000000000000000000000
0000008800310000000000a64a8460110050524f4752417e310000700008000400efbeee3a851aa6
4a84602a0000003c000000000001000000000000000000460000000000500072006f006700720061
006d002000460069006c0065007300000040007300680065006c006c00330032002e0064006c006c
002c002d0032003100370038003100000018004c00310000000000a64a8f60100056435f5f7e3100
00360008000400efbea64a8460a64a8f602a000000398b000000000a000000000000000000000000
0056002e00450058004500000018000000610000001c000000010000001c0000002d000000000000
0060000000110000000300000049be02881000000000433a5c50726f6772616d2046696c65735c56
432b2b5c436f6d6d6f6e5c4d5344657639385c42696e5c4d534445562e4558450000160079006f00
75007200660065006e0067002700730020007600630036002000650064006900740069006f006e00
38002e002ea00000000
~\Desktop>python bin2hex.py -s test.out test.t
test