Board logo

标题: [安全相关] autorun病毒清理批处理版 [打印本页]

作者: 天黑不睡    时间: 2008-3-13 09:08     标题: autorun病毒清理批处理版

新手上路哈,申明一点,这个脚本不是偶写的,但是偶觉得挺有用的,所以就拿出来和大家一起分享
如果有改良版,大家可以贴回复里哈
代码如下:
  1. @Echo Off
  2. color 2f
  3. title  Autorun 病毒清除工具-By Phexon
  4. Rem 杀进程
  5. taskkill /F /IM SocksA.exe /IM SVOHOST.exe /IM AdobeR.exe /IM ravmone.exe /IM wincfgs.exe /IM doc.exe /IM rose.exe /IM sxs.exe /IM autorun.exe /IM KB20060111.exe /IM tel.xls.exe>nul 2>nul
  6. :clearauto
  7. cls
  8. Echo.
  9. Echo    Autorun 病毒清除工具
  10. Echo.
  11. Echo.   
  12. Echo.
  13. Echo.
  14. Echo  本程序运行后自动清除每个盘符下面的Autorun病毒
  15. Echo  本程序原理是基于读取每个盘符下的Autorun.inf相关字段
  16. Echo.
  17. Echo  [1] 仅仅删除所有盘符下的 Autorun 病毒
  18. Echo  [2] 删除所有盘符下的 Autorun 病毒并且建立同名免疫目录(推荐!)
  19. Echo  [3] 禁用系统的 Autorun 机制以避免 Autorun 病毒的再次感染
  20. Echo  [4] 取消所有盘符的 Autorun 病毒免疫
  21. Echo  [5] 删除并免疫指定盘符的 Autorun 病毒
  22. Echo  [6] 取消免疫指定盘符
  23. Echo  [7] 恢复相关注册表项默认值
  24. Echo  [0] 退出
  25. Echo.
  26. Set /p clearslt= 请输入您的选择(1/2/3/4/5/6/7/0):
  27. If "%clearslt%"=="" Goto clearauto
  28. If "%clearslt%"=="1" Goto clearauto1
  29. If "%clearslt%"=="2" Goto clearauto2
  30. If "%clearslt%"=="3" Goto clearauto3
  31. If "%clearslt%"=="4" Goto clearauto4
  32. If "%clearslt%"=="5" Goto clearauto5
  33. If "%clearslt%"=="6" Goto clearauto6
  34. If "%clearslt%"=="7" Goto clearauto7
  35. If "%clearslt%"=="0" Exit
  36. :clearauto1
  37. taskkill /F /IM SocksA.exe /IM SVOHOST.exe /IM AdobeR.exe /IM ravmone.exe /IM wincfgs.exe /IM doc.exe /IM rose.exe /IM sxs.exe /IM autorun.exe /IM KB20060111.exe /IM tel.xls.exe>nul 2>nul
  38. For %%a 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 (
  39. fsutil fsinfo drivetype %%a: |find /i "固定驱动器" && (
  40.   For /f "tokens=2 delims==" %%b In (%%a:\autorun.inf) Do Del /a /f /q "%%a:\%%b" >nul 2>nul
  41.   Del /a /f /q %%a:\autorun.inf >nul 2>nul
  42.   ) >nul 2>nul
  43. fsutil fsinfo drivetype %%a: |find /i "可移动驱动器" && (
  44.   For /f "tokens=2 delims==" %%b In (%%a:\autorun.inf) Do Del /a /f /q "%%a:\%%b" >nul 2>nul
  45.   Del /a /f /q %%a:\autorun.inf >nul 2>nul
  46.   ) >nul 2>nul
  47. )
  48. cls
  49. Echo  Autorun 病毒清除完毕,任意键返回……
  50. pause>nul
  51. Goto clearauto
  52. :clearauto2
  53. taskkill /F /IM SocksA.exe /IM SVOHOST.exe /IM AdobeR.exe /IM ravmone.exe /IM wincfgs.exe /IM doc.exe /IM rose.exe /IM sxs.exe /IM autorun.exe /IM KB20060111.exe /IM tel.xls.exe>nul 2>nul
  54. For %%a 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 (
  55. fsutil fsinfo drivetype %%a: |find /i "固定驱动器" && (
  56.   For /f "tokens=2 delims==" %%b In (%%a:\autorun.inf) Do Del /a /f /q "%%a:\%%b" & md "%%a:\%%b\免疫目录不要删除!...\" & attrib +s +h +r "%%a:\%%b" & Echo Y|cacls "%%a:\%%b" /T /C /P everyone:N >nul 2>nul
  57.   Del /a /f /q %%a:\autorun.inf & md "%%a:\autorun.inf\免疫目录不要删除!...\" & attrib +s +h +r %%a:\autorun.inf & Echo Y|cacls "%%a:\autorun.inf" /T /C /P everyone:N >nul 2>nul
  58.   ) >nul 2>nul
  59. fsutil fsinfo drivetype %%a: |find /i "可移动驱动器" && (
  60.   For /f "tokens=2 delims==" %%b In (%%a:\autorun.inf) Do Del /a /f /q "%%a:\%%b" & md "%%a:\%%b\免疫目录不要删除!...\" & attrib +s +h +r "%%a:\%%b" & Echo Y|cacls "%%a:\%%b" /T /C /P everyone:N >nul 2>nul
  61.   Del /a /f /q %%a:\autorun.inf & md "%%a:\autorun.inf\免疫目录不要删除!...\" & attrib +s +h +r %%a:\autorun.inf & Echo Y|cacls "%%a:\autorun.inf" /T /C /P everyone:N >nul 2>nul
  62.   ) >nul 2>nul
  63. )
  64. cls
  65. Echo  Autorun 病毒清除并免疫完毕,任意键返回……
  66. pause>nul
  67. Goto clearauto
  68. :clearauto3
  69. cls
  70. Echo.
  71. Echo  正在停止相关服务……
  72. Echo.
  73. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer" /v NoDriveTypeAutoRun /t REG_DWORD /d 0x000000ff /f >nul 2>nul
  74. reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer" /v NoDriveTypeAutoRun /t REG_DWORD /d 0x000000ff /f >nul 2>nul
  75. net stop ShellHWDetection >nul 2>nul
  76. sc config ShellHWDetection start= disabled >nul 2>nul
  77. Rem 添加防止从回收站或仿回收站的目录中直接运行可执行文件的策略
  78. Set REGPATH=HKLM\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers\0\Paths
  79. Set SFLAG=/v SaferFlags /t REG_DWORD /d 0x00000000 /f
  80. Set IDATA=/f /v ItemData /d "?:\Recyc?
  81. reg add %REGPATH%\{00ffa5bf-abe7-4901-aacf-4f58aa31217a} %SFLAG%>nul
  82. reg add %REGPATH%\{00ffa5bf-abe7-4901-aacf-4f58aa31217a} %IDATA%\*\*\*\*.*">nul
  83. reg add %REGPATH%\{41fe7eed-c47a-46f6-840a-240796fd03cf} %SFLAG%>nul
  84. reg add %REGPATH%\{41fe7eed-c47a-46f6-840a-240796fd03cf} %IDATA%\*\*\*.*">nul
  85. reg add %REGPATH%\{4e93c91c-a40e-462e-9b89-3b0832d222d9} %SFLAG%>nul
  86. reg add %REGPATH%\{4e93c91c-a40e-462e-9b89-3b0832d222d9} %IDATA%\*.*">nul
  87. reg add %REGPATH%\{5bfc100b-d3fb-450e-88ec-6819ab56a9ff} %SFLAG%>nul
  88. reg add %REGPATH%\{5bfc100b-d3fb-450e-88ec-6819ab56a9ff} %IDATA%\*\*\*\*.*">nul
  89. reg add %REGPATH%\{5c5e2bcd-7057-43f4-830c-e4361d2afadd} %SFLAG%>nul
  90. reg add %REGPATH%\{5c5e2bcd-7057-43f4-830c-e4361d2afadd} %IDATA%\*.*">nul
  91. reg add %REGPATH%\{5f8ff865-0638-4c6e-98de-923e7bc6b330} %SFLAG%>nul
  92. reg add %REGPATH%\{5f8ff865-0638-4c6e-98de-923e7bc6b330} %IDATA%\*\*\*.*">nul
  93. reg add %REGPATH%\{649c1429-0e79-453c-abe9-b5682e035ae7} %SFLAG%>nul
  94. reg add %REGPATH%\{649c1429-0e79-453c-abe9-b5682e035ae7} %IDATA%\*\*.*">nul
  95. reg add %REGPATH%\{718f54b2-c669-4d7b-aeff-18d69f100034} %SFLAG%>nul
  96. reg add %REGPATH%\{718f54b2-c669-4d7b-aeff-18d69f100034} %IDATA%\*\*.*">nul
  97. reg add %REGPATH%\{8385d9d2-80c9-4ac1-a100-ed3e62863d97} %SFLAG%>nul
  98. reg add %REGPATH%\{8385d9d2-80c9-4ac1-a100-ed3e62863d97} %IDATA%\*.*">nul
  99. reg add %REGPATH%\{af2a4fcf-441c-421e-9663-52cd3502cfd7} %SFLAG%>nul
  100. reg add %REGPATH%\{af2a4fcf-441c-421e-9663-52cd3502cfd7} %IDATA%\*\*\*.*">nul
  101. reg add %REGPATH%\{b997f4b2-c037-4e97-b051-31f5d86df802} %SFLAG%>nul
  102. reg add %REGPATH%\{b997f4b2-c037-4e97-b051-31f5d86df802} %IDATA%\*\*.*">nul
  103. reg add %REGPATH%\{d4e7b6ff-d76f-407f-b8bb-ea0835f5babc} %SFLAG%>nul
  104. reg add %REGPATH%\{d4e7b6ff-d76f-407f-b8bb-ea0835f5babc} /f /v ItemData /d "RECYC*.*">nul
  105. Rem 清除喜欢利用回收站的移动磁盘自动运行病毒
  106. For %%a 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 (
  107. For %%b In (exe pif com) Do (
  108.   Echo Y|cacls "%%a:\Recycler\*.%%b" /C /T /P everyone:F>nul 2>nul&Echo Y|cacls "%%a:\Recycled\*.%%b" /C /T /P everyone:F>nul 2>nul&Echo Y|cacls "%%a:\Recycled\Recycled\*.%%b" /C /T /P everyone:F>nul 2>nul
  109.   Del /A /F /S /Q "%%a:\Recycler\*.%%b">nul 2>nul&Del /A /F /S /Q "%%a:\Recycled\*.%%b">nul 2>nul&Del /A /F /S /Q "%%a:\Recycled\Recycled\*.%%b">nul 2>nul
  110.   )
  111. )>nul 2>nul
  112. Echo.
  113. Echo  相关服务已停止并禁用,任意键返回……
  114. pause >nul
  115. Goto clearauto
  116. :clearauto4
  117. For %%a 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 (
  118. fsutil fsinfo drivetype %%a: |find /i "固定驱动器" && (
  119.   cacls "%%a:\autorun.inf" /T /C /P everyone:F&Del /a /f /q "%%a:\autorun.inf" & rd /s /q "%%a:\autorun.inf">nul 2>nul
  120.   )>nul 2>nul
  121. fsutil fsinfo drivetype %%a: |find /i "可移动驱动器" && (
  122.   cacls "%%a:\autorun.inf" /T /C /P everyone:F&Del /a /f /q "%%a:\autorun.inf" & rd /s /q "%%a:\autorun.inf">nul 2>nul
  123.   )>nul 2>nul
  124. )
  125. cls
  126. Echo.
  127. Echo  已经解除全部盘符的免疫,任意键返回……
  128. pause>nul
  129. Goto clearauto
复制代码

作者: 天黑不睡    时间: 2008-3-13 09:09

  1. :clearauto5
  2. cls
  3. Echo.
  4. Set /p pf=  请输入盘符,如"F:"(不包括引号)
  5. Echo   即将免疫%pf%盘……|find /i ":"||Set pf=%pf%:&&Echo   即将免疫%pf%盘……
  6. taskkill /F /IM SocksA.exe /IM SVOHOST.exe /IM AdobeR.exe /IM ravmone.exe /IM wincfgs.exe /IM doc.exe /IM rose.exe /IM sxs.exe /IM autorun.exe /IM KB20060111.exe /IM tel.xls.exe>nul 2>nul
  7. fsutil fsinfo drivetype %pf% |find /i "固定驱动器" && (
  8. For /f "tokens=2 delims==" %%a In (%pf%\autorun.inf) Do Del /a /f /q "%pf%\%%a" & md "%pf%\%%a\免疫目录不要删除!...\" & attrib +s +h +r "%pf%\%%a" & Echo Y|cacls "%pf%\%%a" /T /C /P everyone:N >nul 2>nul
  9. Del /a /f /q %pf%\autorun.inf & md "%pf%\autorun.inf\免疫目录不要删除!...\" & attrib +s +h +r %pf%\autorun.inf & Echo Y|cacls "%pf%\autorun.inf" /T /C /P everyone:N >nul 2>nul
  10. Goto DoneclearAuto
  11. ) >nul 2>nul
  12. fsutil fsinfo drivetype %pf% |find /i "可移动驱动器" && (
  13. For /f "tokens=2 delims==" %%a In (%pf%\autorun.inf) Do Del /a /f /q "%pf%\%%a" & md "%pf%\%%a\免疫目录不要删除!...\" & attrib +s +h +r "%pf%\%%a" & Echo Y|cacls "%pf%\%%a" /T /C /P everyone:N >nul 2>nul
  14. Del /a /f /q %pf%\autorun.inf & md "%pf%\autorun.inf\免疫目录不要删除!...\" & attrib +s +h +r %pf%\autorun.inf & Echo Y|cacls "%pf%\autorun.inf" /T /C /P everyone:N >nul 2>nul
  15. Goto DoneclearAuto
  16. ) >nul 2>nul
  17. Echo.
  18. Echo  您所输入的盘符不存在或者是只读设备,
  19. Echo  请重新输入
  20. Goto clearauto5
  21. :DoneclearAuto
  22. cls
  23. Echo.
  24. Echo  指定的磁盘 %pf% 已经成功进行了 Autorun 病毒的清除及免疫
  25. Echo.
  26. Echo  [1] 继续免疫其他磁盘
  27. Echo  [0] 返回主菜单
  28. Set /p choice=  请输入您的选择(1/0):
  29. If %choice%="" Goto DoneclearAuto
  30. If %choice%="1" Goto clearauto5
  31. If %choice%="0" Goto clearauto
  32. :clearauto6
  33. cls
  34. Echo.
  35. Set /p pf=  请输入盘符,如"F:"(不包括引号)
  36. Echo   即将取消免疫%pf%盘……|find /i ":"||Set pf=%pf%:&&Echo   即将取消免疫%pf%盘……
  37. fsutil fsinfo drivetype %pf% |find /i "固定驱动器" && (
  38. cacls "%pf%\autorun.inf" /T /C /P everyone:F&Del /a /f /q "%pf%\autorun.inf" & rd /s /q "%pf%\autorun.inf">nul 2>nul
  39. Goto DoneUnauto
  40. )>nul 2>nul
  41. fsutil fsinfo drivetype %pf% |find /i "可移动驱动器" && (
  42. cacls "%pf%\autorun.inf" /T /C /P everyone:F&Del /a /f /q "%pf%\autorun.inf" & rd /s /q "%pf%\autorun.inf">nul 2>nul
  43. Goto DoneUnauto
  44. )>nul 2>nul
  45. Echo.
  46. Echo  您所输入的盘符不存在或者是只读设备,
  47. Echo  请重新输入
  48. Goto clearauto6
  49. :DoneUnauto
  50. cls
  51. Echo.
  52. Echo  指定的磁盘 %pf% 已经成功解除了 Autorun 病毒免疫
  53. Echo.
  54. Echo  [1] 继续解除免疫其他磁盘
  55. Echo  [0] 返回主菜单
  56. Set choice=
  57. Set /p choice=  请输入您的选择(1/0):
  58. If %choice%="" Goto DoneUnauto
  59. If %choice%="1" Goto clearauto6
  60. If %choice%="0" Goto clearauto
  61. :clearauto7
  62. cls
  63. Rem 防止在资源管理器中彻底隐藏文件、禁止文件等
  64. reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL" /v CheckedValue /t REG_DWORD /d 0x00000001 /f>nul 2>nul
  65. reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2" /f>nul 2>nul
  66. reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" /f>nul 2>nul
  67. reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v DisallowRun /f>nul 2>nul
  68. Rem 防止转移启动组位置
  69. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Startup /d "%USERPROFILE%\「开始」菜单\程序\启动" /f>nul 2>nul
  70. reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Common Startup" /d "%ALLUSERSPROFILE%\「开始」菜单\程序\启动" /f>nul 2>nul
  71. Echo.
  72. Echo  相关注册表恢复完毕,任意键返回……
  73. pause>nul
  74. Goto clearauto
复制代码

作者: lsq    时间: 2008-3-13 12:53

感谢LZ分享,支持一下
作者: youxi01    时间: 2008-3-13 13:54

太多,太杂
结构不是太清晰
不过还是赞一个
能写出这么长的代码,那功夫自是也不错
作者: 随风    时间: 2008-3-13 16:13

代码太长时,请用[ code] 和 [/code] 标记把代码部分首尾括起来,以便他人复制;
作者: 363028206    时间: 2008-3-19 10:35

给你一个很简单的方法:
1,点开始-〉运行
2,输入cmd然后回车
3,切换到u盘所在得盘符或是中了autorun.inf得病毒盘符下。
例如:你的u盘得盘符是i盘,那么就输入i:回车
4,然后依次进行如下操作:
attrib -s -h -r autorun.inf回车
del autorun.inf回车
好了,u盘拔下来重新插一次就发现问题没有了!!
作者: ai20110304    时间: 2016-7-30 16:25

不错哦。顶




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2