PHP 常用伪协议

admin 2023年12月15日00:58:02评论11 views字数 859阅读2分51秒阅读模式

php://stdin php://stdout php://sterr php://input php://output php://filter

从控制台读取输入

<?php
$f = fopen('php://stdin','r');
while(!feof($f)){
	echo 'output:'.fgets($f);
}
?>

http://cn-sec.com/wp-content/uploads/2023/12/20231214161653-72.jpg

输出 类似于 echo

<?php
$f = fopen('php://stdout','w');
fwrite($f,'test');
fclose($f);
?>

http://cn-sec.com/wp-content/uploads/2023/12/20231214161653-93.jpg

和 php://stdout 一样

读取 POST 数据 作为 php 代码执行

<?php
echo file_get_contents('php://input');
?>

http://cn-sec.com/wp-content/uploads/2023/12/20231214161653-31.jpg

输出

<?php
$f = fopen('php://output','w');
fwrite($f,'test');
fclose($f)
?>

http://cn-sec.com/wp-content/uploads/2023/12/20231214161654-87.jpg

php 元封装器 类似于 readfile() file_get_contents()

读取文件内容

这个在 ctf 中用的比较多

http://cn-sec.com/wp-content/uploads/2023/12/20231214161654-33.jpg

常用过滤器

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

http://cn-sec.com/wp-content/uploads/2023/12/20231214161654-83.jpg

tolower

http://cn-sec.com/wp-content/uploads/2023/12/20231214161654-60.jpg

- By:X1r0z[exp10it.cn]

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年12月15日00:58:02
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   PHP 常用伪协议https://cn-sec.com/archives/2301373.html

发表评论

匿名网友 填写信息