PHP 常用伪协议
Contents
php://stdin php://stdout php://sterr php://input php://output php://filter
php://stdin
从控制台读取输入
<?php
$f = fopen('php://stdin','r');
while(!feof($f)){
echo 'output:'.fgets($f);
}
?>
php://stdout
输出 类似于 echo
<?php
$f = fopen('php://stdout','w');
fwrite($f,'test');
fclose($f);
?>
php://stderr
和 php://stdout 一样
php://input
读取 POST 数据 作为 php 代码执行
<?php
echo file_get_contents('php://input');
?>
php://output
输出
<?php
$f = fopen('php://output','w');
fwrite($f,'test');
fclose($f)
?>
php://filter
php 元封装器 类似于 readfile() file_get_contents()
读取文件内容
这个在 ctf 中用的比较多
常用过滤器
string.rot13
string.toupper
string.tolower
string.strip_tags
convert.base64-encode
convert.base64-decode
convert.quoted-printable-encode
convert.quoted-printable-decode
代码
<?php
echo file_get_contents($_GET['file']);
?>
base64 encode
tolower