一切福田,不離方寸,從心而覓,感無不通。

C# 用HttpWebRequest模拟一个虚假的IP伪造ip

有人会说:IP验证是在TCP层完成的,不是HTTP层完成的,如果伪造IP的话可能连TCP的三次握手都完不成。我这里说的不是完全意义的伪造。如果你使用透明代理上网,那么在透明代理发送给服务器端的HTTP请求中会包含x-forward-for信息。例如:X-Forwarded-For: 162.150.10.16
那么我们只要在发给服务器端的http请求中加入X-Forwarded-For: 162.150.10.16信息即可。
例如下边一个请求:
GET http://www.ahjinzhai.gov.cn/sdyxnx/vote.php?id=1 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://www.ahjinzhai.gov.cn/sdyxnx/
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; TencentTraveler )
Host: www.ahjinzhai.gov.cn
Cookie: PHPSESSID=1847fc15020bc16b47ce250f457daab4
Cache-Control: no-cache
X-Forwarded-For: 162.150.10.16
Pragma: no-cache

 

from:https://www.cnblogs.com/sanler/p/7248952.html