<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[[个人原创]Linux vim 查看16进制之:%!xxd，XXd hexdump 查看16进制的方法，配合vi使用更棒]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Wed, 20 Oct 2010 03:23:52 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	<div class="code">&#91;~/shell&#93;# xxd -g 1 concat.sh </div><br/>-g 1,2：1和2的区别就是：1 2分别是：66&nbsp;&nbsp;6669&nbsp;&nbsp;明白了吧，呵呵！<br/>主要用途：可以用来查看PHP在windows下的utf8记事本编码的bom，会导致session，cookie，输出图片出现异常的bom，大名鼎鼎啊，ef bb bf 就是utf-8 bom，如果接收者收到以EF BB BF开头的字节流，就知道这是UTF-8编码了。<br/>如，注意efbb这个就是bom啦：<br/><br/><div class="code">&#91;~/shell&#93;# hexdump bom.txt -C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><br/>00000000&nbsp;&nbsp;ef bb bf 64 66 64 66 64&nbsp;&nbsp;0a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124;...dfdfd.&#124;<br/><br/>---------------------------------------------------------------------------------------------------------------------------------------------<br/><br/><div class="code">&#91;~/shell&#93;# xxd -g 2 bom.txt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><br/>0000000: efbb bf64 6664 6664 0a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...dfdfd.<br/>---------------------------------------------------------------------------------------------------------------------------------------------<br/>---------------------------------------------------------------------------------------------------------------------------------------------<br/><br/>vi在linux下查看16进制文件的方法。<br/>xxd <br/>Creates a hex dump of the given file; it can also do the<br/>reverse, so it can be used for binary patching <br/>用法很简单：<br/>在vi的命令状态下<br/>:%!xxd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ——将当前文本转换为16进制格式。(实践OK，但在windows下还是wxHexEditor界面打开好用)<br/>:%!xxd -r&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;——将当前文件转换回文本格式。<br/>于是乎：<br/>将当前文本转换为16进制格式,Vi命令行模式，输入：<br/><div class="code">:%!xxd </div><br/>将当前文件转换回文本格式,Vi命令行模式，输入：<br/><div class="code">:%!xxd -r</div><br/>哈哈，就在这一转16进制后又转回来的时候，你就发现bom，露出了原型，0000000: efbb bfef bbbf 6466 6466 640a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;......dfdfd.到转回来后出现&lt;feff&gt;dfdfd，哈哈哈哈，原形毕露了吧！<br/>&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;&#124;<br/><br/><br/>[~/shell]# xxd -g 1 test.sh&nbsp;&nbsp;<br/>0000000: 66 69 6c 65 6e 61 6d 65 3d 24 31 0a 73 74 72 69&nbsp;&nbsp;filename=$1.stri<br/>0000010: 6e 67 31 3d 65 78 69 73 74 0a 73 74 72 69 6e 67&nbsp;&nbsp;ng1=exist.string<br/>0000020: 32 3d 78 69 0a 63 6f 6d 6d 61 6e 64 3d 22 63 61&nbsp;&nbsp;2=xi.command=&quot;ca<br/>0000030: 74 20 24 66 69 6c 65 6e 61 6d 65 20 7c 20 67 72&nbsp;&nbsp;t $filename &#124; gr<br/>0000040: 65 70 20 24 73 74 72 69 6e 67 31 20 7c 20 67 72&nbsp;&nbsp;ep $string1 &#124; gr<br/>0000050: 65 70 20 24 73 74 72 69 6e 67 32 22 0a 65 76 61&nbsp;&nbsp;ep $string2&quot;.eva<br/>0000060: 6c 20 24 63 6f 6d 6d 61 6e 64 0a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l $command.<br/><br/>---------------------------------------------------------------------------------------------------------------------------------------------<br/><div class="code">&#91;~/shell&#93;# xxd -g 2 test.sh&nbsp;&nbsp; </div><br/>0000000: 6669 6c65 6e61 6d65 3d24 310a 7374 7269&nbsp;&nbsp;filename=$1.stri<br/>0000010: 6e67 313d 6578 6973 740a 7374 7269 6e67&nbsp;&nbsp;ng1=exist.string<br/>0000020: 323d 7869 0a63 6f6d 6d61 6e64 3d22 6361&nbsp;&nbsp;2=xi.command=&quot;ca<br/>0000030: 7420 2466 696c 656e 616d 6520 7c20 6772&nbsp;&nbsp;t $filename &#124; gr<br/>0000040: 6570 2024 7374 7269 6e67 3120 7c20 6772&nbsp;&nbsp;ep $string1 &#124; gr<br/>0000050: 6570 2024 7374 7269 6e67 3222 0a65 7661&nbsp;&nbsp;ep $string2&quot;.eva<br/>0000060: 6c20 2463 6f6d 6d61 6e64 0a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l $command.<br/><br/>---------------------------------------------------------------------------------------------------------------------------------------------<br/>当然你也可以这样：<br/><div class="code">&#91;~/shell&#93;# hexdump test.sh -C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div><br/>00000000&nbsp;&nbsp;66 69 6c 65 6e 61 6d 65&nbsp;&nbsp;3d 24 31 0a 73 74 72 69&nbsp;&nbsp;&#124;filename=$1.stri&#124;<br/>00000010&nbsp;&nbsp;6e 67 31 3d 65 78 69 73&nbsp;&nbsp;74 0a 73 74 72 69 6e 67&nbsp;&nbsp;&#124;ng1=exist.string&#124;<br/>00000020&nbsp;&nbsp;32 3d 78 69 0a 63 6f 6d&nbsp;&nbsp;6d 61 6e 64 3d 22 63 61&nbsp;&nbsp;&#124;2=xi.command=&quot;ca&#124;<br/>00000030&nbsp;&nbsp;74 20 24 66 69 6c 65 6e&nbsp;&nbsp;61 6d 65 20 7c 20 67 72&nbsp;&nbsp;&#124;t $filename &#124; gr&#124;<br/>00000040&nbsp;&nbsp;65 70 20 24 73 74 72 69&nbsp;&nbsp;6e 67 31 20 7c 20 67 72&nbsp;&nbsp;&#124;ep $string1 &#124; gr&#124;<br/>00000050&nbsp;&nbsp;65 70 20 24 73 74 72 69&nbsp;&nbsp;6e 67 32 22 0a 65 76 61&nbsp;&nbsp;&#124;ep $string2&quot;.eva&#124;<br/>00000060&nbsp;&nbsp;6c 20 24 63 6f 6d 6d 61&nbsp;&nbsp;6e 64 0a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#124;l $command.&#124;<br/>0000006b
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [个人原创]Linux vim 查看16进制之:%!xxd，XXd hexdump 查看16进制的方法，配合vi使用更棒]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>