<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://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://jackxiang.com/post//</link>
<title><![CDATA[PHP用CURL伪造IP和来源]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Wed, 03 Apr 2013 04:08:37 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	<br/>今天群里一个朋友在问这个问题。<br/><br/>查了下，CURL确实很强悍的可以伪造IP和来源。<br/><br/>1.php 请求 2.php 。<br/>1.php代码：<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, &quot;http://localhost/2.php&quot;);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(&#039;X-FORWARDED-FOR:8.8.8.8&#039;, &#039;CLIENT-IP:8.8.8.8&#039;));&nbsp;&nbsp;//构造IP
curl_setopt($ch, CURLOPT_REFERER, &quot;http://www.gosoa.com.cn/ &quot;);&nbsp;&nbsp; //构造来路
curl_setopt($ch, CURLOPT_HEADER, 1);
$out = curl_exec($ch);
curl_close($ch);
</textarea><br/>2.php代码如下：<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
function getClientIp() &#123;
&nbsp;&nbsp;&nbsp;&nbsp;if (!empty($_SERVER[&quot;HTTP_CLIENT_IP&quot;]))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip = $_SERVER[&quot;HTTP_CLIENT_IP&quot;];
&nbsp;&nbsp;&nbsp;&nbsp;else if (!empty($_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;]))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip = $_SERVER[&quot;HTTP_X_FORWARDED_FOR&quot;];
&nbsp;&nbsp;&nbsp;&nbsp;else if (!empty($_SERVER[&quot;REMOTE_ADDR&quot;]))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip = $_SERVER[&quot;REMOTE_ADDR&quot;];
&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ip = &quot;err&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;return $ip;
&#125;

echo &quot;IP: &quot; . getClientIp() . &quot;&quot;;
echo &quot;referer: &quot; . $_SERVER[&quot;HTTP_REFERER&quot;];

echo &quot;IP: &quot; . getClientIp() . &quot;&quot;;
echo &quot;referer: &quot; . $_SERVER[&quot;HTTP_REFERER&quot;];
</textarea><br/>伪造成功，这是不是给“刷票”的朋友提供了很好的换IP的方案！！<br/>哈哈。<br/><br/>结果：<br/>HTTP/1.1 200 OK Date: Wed, 03 Apr 2013 06:20:42 GMT Server: Apache/2.2.22 (Win32) PHP/5.3.13 X-Powered-By: PHP/5.3.13 Content-Length: 44 Content-Type: text/html <br/>IP: 8.8.8.8<br/>referer: http://www.gosoa.com.cn/<br/><br/>来自：http://www.gosoa.com.cn/php%E7%94%A8curl%E4%BC%AA%E9%80%A0ip%E5%92%8C%E6%9D%A5%E6%BA%90
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] PHP用CURL伪造IP和来源]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>