Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grep php文件,以显示是否有任何匹配的某些关键字_Grep - Fatal编程技术网

Grep php文件,以显示是否有任何匹配的某些关键字

Grep php文件,以显示是否有任何匹配的某些关键字,grep,Grep,好的,所以我正在尝试查找服务器上的恶意代码,但进展不快: 这就是我所拥有的 <?php $command = "grep --file=list.txt ./*"; $output = shell_exec($command); echo "$output"; echo "Grep job over."; ?> 如果有人能解释出哪里出了问题,我将不胜感激这些*.log文件是否与脚本位于同一目录中?您不需要在正则表达式中转义双引号。我刚刚在路由文件夹中添加了一个.log文件,与gra

好的,所以我正在尝试查找服务器上的恶意代码,但进展不快:

这就是我所拥有的

<?php
$command = "grep --file=list.txt ./*";
$output = shell_exec($command);
echo "$output";
echo "Grep job over.";
?>

如果有人能解释出哪里出了问题,我将不胜感激

这些*.log文件是否与脚本位于同一目录中?您不需要在正则表达式中转义双引号。我刚刚在路由文件夹中添加了一个.log文件,与grabfile.php位于同一文件夹中我在route Folder中添加了grabfile.php、list.txt和.log。现在添加了。/*而不是.log,但仍然不起作用?请尝试使用绝对路径名。我不确定从Web服务器运行PHP脚本时工作目录是什么。
eval(base64_decode(
gzinflate(base64_decode(
cwd = @getcwd();
chr((ord(
substr(md5(strrev(
chr(ord(
cwd[strlen(\$cwd)
ini_get('safe_mode');
=\"\x62\"
\"+ r + \"&r=\" + document.referrer;\"
if(strtoupper(substr(PHP_OS, 0, 3) ) == \"WIN\")
window.top.location.href=\"http://
@ini_get(\"disable_functions\")
){if(@copy(
eval(\$___(\$__));
copy(\"endless.html\"
system(\"wget
symlink(\"/\",\"sym/root\");
@copy(\$_FILES['file']['tmp_name']
error_reporting(0);if(
x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74
hacked"