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