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);
}
?>
|
![](https://img.exp10it.io/2018/02/12/1518416933.jpg)
php://stdout
输出 类似于 echo
1
2
3
4
5
|
<?php
$f = fopen('php://stdout','w');
fwrite($f,'test');
fclose($f);
?>
|
![](https://img.exp10it.io/2018/02/12/1518417021.jpg)
php://stderr
和 php://stdout 一样
读取 POST 数据 作为 php 代码执行
1
2
3
|
<?php
echo file_get_contents('php://input');
?>
|
![](https://img.exp10it.io/2018/02/12/1518417157.jpg)
php://output
输出
1
2
3
4
5
|
<?php
$f = fopen('php://output','w');
fwrite($f,'test');
fclose($f)
?>
|
![](https://img.exp10it.io/2018/02/12/1518417229.jpg)
php://filter
php 元封装器 类似于 readfile() file_get_contents()
读取文件内容
这个在 ctf 中用的比较多
![](https://img.exp10it.io/2018/02/12/1518417286.jpg)
常用过滤器
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
![](https://img.exp10it.io/2018/02/12/1518417373.jpg)
tolower
![](https://img.exp10it.io/2018/02/12/1518417564.jpg)