Home Backend Development PHP Tutorial PHP 中简略的伪造IP刷票实现

PHP 中简略的伪造IP刷票实现

Jun 13, 2016 am 11:57 AM
address http ip remote server

PHP 中简单的伪造IP刷票实现

一般而言,我们的获取用户真实ip的代码大致是这样...

/** * 获取 远程访问者的IP地址 * * @return string */function real_ip_addr(){	static $remote_ip_address = null;	if (!$remote_ip_address){					$vars = array(			val($_SERVER,'HTTP_CLIENT_IP'),			val($_SERVER,'HTTP_X_FORWARDED_FOR'),			val($_SERVER,'REMOTE_ADDR'),		);		foreach ($vars as $var){			if (!empty($var)) {				$remote_ip_address = $var;				}			continue;		}		if (empty($remote_ip_address)) $remote_ip_address = 'unknown';	}	return $remote_ip_address;}
Copy after login

?

涉及到“客户端”IP的通常使用3个环境变量:$_SERVER['HTTP_CLIENT_IP'] 和$_SERVER['X_FORWARDED_FOR']还有$_SERVER['REMOTE_ADDR']实际上,这3个环境变量都有局限性。前两 个是可以随意伪造。只要在发送的http头里设置相应值就可以,任意字符都可以,而第3个环境变量,如果用户使用了匿名代理,那这个变量显示的就是代理 IP

?

伪造下:

?

:-)...

?

?

:-) 一个小思路

1 楼 vb2005xu 19 小时前  
http://www.webshell.cc/
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What does http status code 520 mean? What does http status code 520 mean? Oct 13, 2023 pm 03:11 PM

What does http status code 520 mean?

How to install, uninstall, and reset Windows server backup How to install, uninstall, and reset Windows server backup Mar 06, 2024 am 10:37 AM

How to install, uninstall, and reset Windows server backup

Understand common application scenarios of web page redirection and understand the HTTP 301 status code Understand common application scenarios of web page redirection and understand the HTTP 301 status code Feb 18, 2024 pm 08:41 PM

Understand common application scenarios of web page redirection and understand the HTTP 301 status code

Local IP address query Local IP address query Jan 05, 2024 pm 01:42 PM

Local IP address query

http request 415 error solution http request 415 error solution Nov 14, 2023 am 10:49 AM

http request 415 error solution

What does IP mean? What does IP mean? Jan 05, 2024 pm 01:34 PM

What does IP mean?

How to implement HTTP streaming using C++? How to implement HTTP streaming using C++? May 31, 2024 am 11:06 AM

How to implement HTTP streaming using C++?

Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience Feb 19, 2024 pm 02:36 PM

Windows Server 2025 preview version welcomes update, Microsoft improves Insiders testing experience

See all articles