标题: 第一个批处理```请你们检查..
[打印本页]
作者: Eblis
时间: 2007-1-13 22:17
标题: 第一个批处理```请你们检查..
应朋友的要求帮忙写一个删除host自动播放病毒的批处理..沉默一晚..把论坛翻了一遍..写完了..总觉得有些杂..很多地方应该可以减少的...请各位帮忙检查一下..
Quote: |
@echo off
echo 此程序用于删除右键自动播放的svchost.exe病毒
echo 请稍等.....正在删除病毒文件
::首先结束病毒进程
:taskkill
tasklist >tasklist.txt
findstr /i "temp1.exe temp2.exe" tasklist.txt &&taskkill /f /im temp1.exe /im temp2.exe >nul 2>nul
del tasklist.txt
::删除病毒启动注册表和盘符自动播放
:delreg
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "load" /f >nul 2>nul
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "load" /t REG_SZ /d "" /f >nul 2>nul
reg export "hkcu\software\microsoft\windows\currentversion\explorer\mountpoints2" delreg.reg >nul 2>nul
find /i "autorun" delreg.reg >temp.txt
for /f "skip=2 tokens=8 delims=\" %%a in (temp.txt) do reg delete HKCU\software\microsoft\windows\currentversion\explorer\mountpoints2\%%a\AUTORUN /f
del delreg.reg
del temp.txt
::删除病毒文件
:del
for %%l in (%systemroot% %systemroot%\system32) do (
for %%m in (autorun.inf host.exe copy.exe temp1.exe temp2.exe) do (
attrib %%l\%%m -r -s >nul 2>nul
del %%l\%%m /f /s /a :h >nul 2>nul
)
)
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
%%i: >nul 2>nul||if errorlevel=1 goto ok
for %%j in (autorun.inf host.exe copy.exe folder.exe) do (
attrib %%i:\%%j -r -s >nul 2>nul
del %%i:\%%j /f /s /a :h >nul 2>nul
)
)
:ok
@echo 删除完成...按任意键退出
pause >nul
goto :eof |
|
──────────────── 版务记录 ────────────────
执行:namejm
原标题:第一个批处理```请你们检查..
说明:因标题过于模糊,不便于论坛的搜索和管理,请在三日内修改标题。
提示:修改标题请在当前帖的右下脚点 编辑,
修改完毕之后按 编辑帖子 即可。
处罚:因刚脱离论坛新人阶段不久,暂时不予处罚;若三日之后尚未修改标题,将扣除
2点积分,以示惩罚,并由版主强制修改标题。请点击这里阅读论坛发帖规定,
以避免在今后的讨论中违规发帖。
──────────────── 版务记录 ────────────────
[
Last edited by namejm on 2007-1-14 at 09:38 PM ]
作者: boluor
时间: 2007-1-13 22:50
"findstr /i "temp1.exe temp2.exe" tasklist.txt"很必要吗?
作者: ccwan
时间: 2007-1-13 23:20
提一小点吧,用del删除文件不必非要先去除属性,/a 参数就够用了。
作者: vkill
时间: 2007-1-14 03:05
楼主改改,用tasklist|find更好点
作者: Eblis
时间: 2007-1-14 11:25
谢谢楼上几位的提醒....
确实没必要先查看进程里是否有进程..直接结束就算没有也没什么..
也没有必要去除属性...
现已改好..如果还有问题..或者可以简化的请提出..
Thank you
Quote: |
@echo off
echo 此程序用于删除右键自动播放的svchost.exe病毒
echo 请稍等.....正在删除病毒文件
::首先结束病毒进程
taskkill /f /im temp1.exe /im temp2.exe >nul 2>nul
::删除病毒启动注册表和盘符自动播放
:delreg
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v
"load" /f >nul 2>nul
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" /v "load"
/t REG_SZ /d "" /f >nul 2>nul
reg export "hkcu\software\microsoft\windows\currentversion\explorer\mountpoints2"
delreg.reg >nul 2>nul
find /i "autorun" delreg.reg >temp.txt
for /f "skip=2 tokens=8 delims=\" %%a in (temp.txt) do reg delete
HKCU\software\microsoft\windows\currentversion\explorer\mountpoints2\%%a\AUTORUN /f
del delreg.reg
del temp.txt
::删除病毒文件
:del
for %%l in (%systemroot% %systemroot%\system32) do (
for %%m in (autorun.inf host.exe copy.exe temp1.exe temp2.exe) do
del %%l\%%m /f /a >nul 2>nul
)
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
%%i: >nul 2>nul||if errorlevel=1 goto ok
for %%j in (autorun.inf host.exe copy.exe folder.exe) do
del %%i:\%%j /f /a >nul 2>nul
)
:ok
@echo 删除完成...按任意键退出
pause >nul
goto :eof |
|
作者: PPdos
时间: 2007-1-14 16:15
支持 鼓励!FOR /R
作者: ytfsse
时间: 2007-1-15 10:16
不错呀
作者: xiaohacker
时间: 2007-1-15 10:20
标题: yuhaomiao
好东西!现在这个病毒很是猖狂!下载一个很是值得!谢谢!