Board logo

标题: 发一个反U免疫批处理 [打印本页]

作者: w1314ich     时间: 2007-11-4 19:35    标题: 发一个反U免疫批处理

本人大菜一个,批处理代码虽然极其简单,但我也很辛苦的研究了很久~~
以下代码可对一般的在磁盘根目录建立一个无法删除autorun.inf免疫方法起到反免疫的作用,希望有高手帮我精简一下,可能有点复杂了,谢谢~
@echo off
set AllDrive=c d e f g h i j k l m n o p q r s t u v w x y z
for %%a in (%AllDrive%) do (
attrib %%a:\autorun.inf -s -r -h
dir %%a:\autorun.inf /b >>c:\auto.txt
for /f "tokens=*" %%i in (c:\auto.txt) do (
   rd %%a:\autorun.inf\"%%i".\
   rd %%a:\autorun.inf
)

)
del c:\auto.txt
作者: RocheChild     时间: 2007-11-4 21:42
如果人家程序创建autorun.inf的时候,先去除你的系统属性,然后删除你的autorun.inf,再安装他的autorun.inf不行吗?
作者: afeichai     时间: 2007-11-5 23:03
好像是深山红叶的,具体的我忘记了。可以加NTFS权限的

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 Del /a /f /q %%a:\autorun.inf>nul 2>nul & echo Y|cacls "%%a:\autorun.inf" /T /C /P everyone:F>nul 2>nul & rd /s /q %%a:\autorun.inf\ >nul 2>nul  & md "%%a:\autorun.inf\U盘病毒免疫...\">nul 2>nul & attrib +s +h +r %%a:\autorun.inf >nul 2>nul& echo Y|cacls "%%a:\autorun.inf" /T /C /P everyone:N >nul 2>nul
作者: putao     时间: 2007-11-5 23:31    标题: 学习了



  Quote:
Originally posted by afeichai at 2007-11-5 11:03 PM:
好像是深山红叶的,具体的我忘记了。可以加NTFS权限的

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 Del /a /f /q %%a:\autorun.inf>nul 2>nul & echo ...

学到了~正在想此法呢~
作者: putao     时间: 2007-11-5 23:37    标题: 还有个问题!

不过好象U盘没法加ntfs权限呀
作者: bozhenguan     时间: 2007-11-8 10:21    标题: 貌似楼主写得太多了。。。。我这个试试

for /f "delims=驱动器:\" %%i in ('fsutil fsinfo drives^|find /v ""') do rd /s /q %%i:\autorun.inf

一句话全盘通杀~
作者: bozhenguan     时间: 2007-11-8 10:25    标题: 另附上我写的全盘免疫

for /f "delims=驱动器A:\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
        del /f /q /a: %%i:\autorun.inf
        rd /s /q %%i:\autorun.inf
        md %%i:\autorun.inf\系统修复工具!QQ276365857....\
)
作者: wert123     时间: 2007-11-8 15:10
@echo off
cls
echo          按 S 键删除Autorun.inf并进行免疫
echo.
echo          按 D 键删除免疫程序
echo.
echo          按其他任意键退出
echo.
echo.
SET Choice=
SET /P Choice=        请选择要进行的操作:  
IF /I '%Choice:~0,1%'=='s' GOTO setup
IF /I '%Choice:~0,1%'=='d' GOTO Delset
IF /I '%Choice:~0,1%'=='q' GOTO Exit
exit
:Setup
taskkill /im explorer.exe /f
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 @(
    if exist %%a: (
        rd %%a:\autorun.inf /s /q
        del %%a:\autorun.inf /f /q
        mkdir %%a:\autorun.inf
        mkdir %%a:\autorun.inf\"病毒免疫勿删除../"
        attrib +h +r +s %%a:\autorun.inf
        
    )
)
start explorer.exe
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 (
  if exist %%a:\nul (
    >1.vbs echo msgbox^ "%%a:免疫成功",64,"提示:"
    1.vbs
  )
)
del 1.vbs
echo.
echo.
echo                        按任意键退出...
pause>nul
exit

:delset
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 @(
    If Exist %%a: (      
        rd %%a:\autorun.inf /s /q
               
    )
)
echo.
echo.
echo                        操作完毕,按任意键退出...
pause>nul
exit
==============================================================
上面的这句话
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 (
  if exist %%a:\nul (
    >1.vbs echo msgbox^ "%%a:免疫成功",64,"提示:"
    1.vbs
  )
)
中的if exist %%a:\nul 怎么整出个nul,有nul就免疫成功,这里的nul是什么意思,不是空的意思么

[ Last edited by wert123 on 2007-11-8 at 03:12 PM ]
作者: wert123     时间: 2007-11-9 13:07
8楼有问题,抬哈
作者: kootoo     时间: 2007-11-9 22:40
不知道啊有错误
@echo off&setlocal EnableDelayedExpansion
color 8B
title U盘病毒免疫
echo -------------=======下面进行U盘病毒免疫=======-------------
echo     如果你的U盘装过其他U盘病毒免疫软件,则不必装这个.
echo     如果的注册表被禁用,任务管理器被禁用,隐藏文件看不见,你可尝试使用.
echo     确认使用请输入Y,否则关闭退出
set /p pass=
if "%pass%"=="y" (
for /f "skip=1 delims=\  tokens=1,2" %%i in ('fsutil fsinfo drives ^| find ":"') do ((for /f "delims= tokens=1" %%d in ('dir %%i /ah /b ^| find ".exe"') do del /f /q /ah "%%i\%%d" & attrib -s -h "%%i\%%~nd">nul) & %%i & del /q /ah autorun.* & md %%i\autorun.inf >nul & cd %%i\autorun.inf >nul & md g..\\ >nul & cd .. & attrib +s +h autorun.inf>nul)>nul
del /q /ah c:\autorun.* & md c:\autorun.inf >nul& cd c:\autorun.inf >nul& md g..\\ >nul& cd .. & attrib +s +h autorun.inf>nul
echo U盘病毒免疫完成!) else goto :eof
rem 修改注册表
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v nofolderoptions /t reg_dword /d 0 /f >nul
reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v noviewondrive /t reg_dword /d 0 /f >nul
reg Add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\NOHIDDEN /v CheckedValue /t reg_dword /d 2 /f >nul
reg Add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\NOHIDDEN /v DefaultValue /t reg_dword /d 2 /f >nul
reg Add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL /v CheckedValue /t reg_dword /d 1 /f >nul
reg Add HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL /v DefaultValue /t reg_dword /d 2 /f >nul
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\system /v DisableTaskMgr /t reg_dword /d 0 /f >nul
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\system /v DisableRegistryTools /t reg_dword /d 0 /f >nul
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer /v NoDrives /t reg_dword /d 0 /F >nul
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer /v NoDriveTypeAutoRun /t reg_dword /d 255 /F >nul
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer /v NoDrives /t reg_dword /d 0 /F >nul
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer /v NoDriveTypeAutoRun /t reg_dword /d 255 /F >nul
echo Writed by SAgE &pause