由于模版网站程序漏洞,导致同一套程序制作的网站被批量挂马,所有网站首页index.html被篡改。由于网站本身首页index.php在访问的时候会检测是否存在index.html,如果不存在就会自动生成。
所以,采取通过代码特征码批量删除index.html。
@echo off
set webroot=E:\wwwroot
for /f "usebackq tokens=1 delims=" %%a in (`dir /b %webroot%`) do call :Del_Index %%a
rem 筛选出index.html
:Del_Index
set DirName=%1%
if exist %webroot%\%DirName%\web\index.html (call :screen)
goto :eof
rem 删除带有""<!-- 页面头部【start】 -->"的index.html文件
:screen
find "<!-- 椤甸潰澶撮儴銆恠tart銆?-->" %webroot%\%DirName%\web\index.html
if %errorlevel%==0 (del %webroot%\%DirName%\web\index.html)
goto :eof
直接检索 “<!– 页面头部【start】 –>” 发现没有检索到任何文件,经查发现是编码问题,
通过编码转换,改成了 检索"<!– 椤甸潰澶撮儴銆恠tart銆?–>" ,测试成功。
未经允许不得转载:天府数据港官方信息博客 » BAT批量删除首页生成文件index.html
客官点个赞呗! (0)