ssh命令用于搜索文件内部 [英] ssh command for searching inside files

查看:134
本文介绍了ssh命令用于搜索文件内部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个星期前,我的两个网站已被利用,可能来自一个ftp暴力破解攻击,破坏我的许多网站文件。
我发现他们通常在js或php文件中插入以下代码:

 
[与此无关的特洛伊代码被删除问题。]

我想通过ssh登录并运行grep命令搜索所有文件并仅为具有此代码的输出提供输出包括。



任何帮助?

解决方案

找到所有包含指定字符串的文件:

  find / path / -name* .ext-exec grep -l刺 {} \; 


Some weeks ago 2 of my sites have been exploited probably from an ftp bruteforce attack corrupting lots of my websites files. I found out that they usually insert the following code in js or php files:

[Trojan code removed as irrelevant to this question.]

I want to login via ssh and run a grep command searching all files and giving output only for the ones that have this code included.

Any help?

解决方案

I use this command to find all files that contain a specified string:

find /path/ -name "*.ext" -exec grep -l "sting" {} \;

这篇关于ssh命令用于搜索文件内部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆