• 注册
当前位置:1313e > php >正文

PHP利用执行操作符;模拟shell命令

$out = `ls -la`;
echo '
'.$out.'
';

输出结果:

total 10
drwxrwxrwx 1 root root 4096 Apr  7 15:42 .
drwxrwxrwx 1 root root 4096 Apr  7 14:48 ..
-rwxrwxrwx 1 root root  174 Apr  7 14:52 .buildpath
-rwxrwxrwx 1 root root  514 Apr  7 14:52 .project
drwxrwxrwx 1 root root    0 Apr  7 14:52 .settings
-rwxrwxrwx 1 root root  236 Apr  8 23:29 index.php


利用PHP的操作符 查询nginx 是否启动

$out = `ps -ef|grep nginx`;
echo '
'.$out.'
';
root      2536     1  0 22:05 ?        00:00:00 nginx: master process nginx
www       2565  2536  0 22:08 ?        00:00:00 nginx: worker process
www       3312  2624  0 23:32 ?        00:00:00 sh -c ps -ef|grep nginx
www       3314  3312  0 23:32 ?        00:00:00 grep nginx

也就是说;php可以执行任何shell脚本!

转载于:https://www.cnblogs.com/wanglijun/p/8748884.html

本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 162202241@qq.com 举报,一经查实,本站将立刻删除。

最新评论

欢迎您发表评论:

请登录之后再进行评论

登录