loading ...
loading...

2007-08-25 | 预防U盘中autorun病毒的批处理程序

分享
标签: u盘  autorun  QQ  计算机  批处理 

最近在本群看到有很多中autorun病毒而无法双击打开驱动器的案例,好多都是由于不小心双击或者右击打开了带病毒的U盘(现在右击也不一定安全了)引起,于是抽时间用批处理写了个小程序,防止双击或右键打开引起中毒的情况

用法:把虚线以下内容(不包括虚线)复制到记事本里保存,然后把后缀由.txt改成.bat即可。一般可把程序放在桌面上,有U盘插入时双击此程序可安全进入U盘(如果有病毒将清理病毒,清理病毒时桌面暂时消失纯属正常现象,几秒钟后即可自动恢复,请勿惊慌!)

 

如果发现BUG,请联系我!
出自:
http://group.xiaonei.com/GetThread.do?id=309588690&parentpage=0&curpage=0&label=&tribeId=2013628097

请注意:如果要执行此程序,请把存储下面程序复制到新记事本中,文件后缀名改为:.bat 即可!
-----------------------------------------------------------------------------------------

@echo off
setlocal enabledelayedexpansion
title 安全进入U盘   by叶脉书签
color fc
mode con:cols=40 lines=8
set flag=0
:findremovable
set a=0
for %%i in (d e f g h i j k l m n) do if exist %%i:\nul (
fsutil fsinfo drivetype %%i: | findstr "可移动驱动器" >nul 2>nul && (
set /a a=a+1
set u!a!=%%i:)
)
if !a! equ 0 (echo 未检测到可移动磁盘! && pause>nul
exit)
if !a! equ 1 (call :detectauto !u%a%!) else goto showchoice
exit


:showchoice
echo.
for /l %%i in (1,1,!a!) do echo                 %%i.  !u%%i!盘
echo.
set /p selection=        选择所要进入的可移动磁盘
call :detectauto !u%selection%!


:detectauto
if exist %1\autorun.inf (
if not exist %1\autorun.inf\nul (
call :killautorun %1 && set flag=1
) else start %1 && exit
) else start %1 && exit


:killautorun
if exist %1\*.exe (
for /f "usebackq" %%i in (`dir %1\*.exe /b /a-d`) do (
find "%%i" %1\autorun.inf >nul 2>nul && (
attrib -h -s -r -a %1\%%i
del /q /f %1\%%i
)
)
)

if exist %1\*.exe (
if exist %1\*.vbs (
for /f "usebackq" %%i in (`dir %1\*.vbs /b /a-d`) do (
for /f "usebackq" %%j in (`dir %1\*.exe /b /a-d`) do (
find "%%j" %1\%%i >nul 2>nul && (
attrib -h -s -r -a %1\%%j
del /q /f %1\%%j
)
)
)
)
)

if exist %1\*.vbs (
for /f "usebackq" %%i in (`dir %1\*.vbs /b /a-d`) do (
find "%%i" %1\autorun.inf >nul 2>nul && (
attrib -h -s -r -a %1\%%i
del /q /f %1\%%i
)
)
)

if exist %1\*.pif (
for /f "usebackq" %%i in (`dir %1\*.pif /b /a-d`) do (
find "%%i" %1\autorun.inf >nul 2>nul && (
attrib -h -s -r -a %1\%%i
del /q /f %1\%%i
)
)
)

::以下内容针对拒绝访问的vbs,reg,bat等文件
if exist %1\*.vbs (
for /f "usebackq" %%i in (`dir %1\*.vbs /b /a-d`) do (
type %1\%%i || (
attrib -h -s -r -a %1\%%i
del /q /f %1\%%i
)
)
)

if exist %1\*.reg (
for /f "usebackq" %%i in (`dir %1\*.reg /b /a-d`) do (
type %1\%%i || (
attrib -h -s -r -a %1\%%i
del /q /f %1\%%i
)
)
)

if exist %1\*.bat (
for /f "usebackq" %%i in (`dir %1\*.bat /b /a-d`) do (
type %1\%%i || (
attrib -h -s -r -a %1\%%i
del /q /f %1\%%i
)
)
)


attrib -s -a -r -h    %1\autorun.inf
del /q /f %1\autorun.inf>nul
if not exist %1\autorun.inf (
tskill explorer
cls
echo 发现病毒,且已清除,可能留有残余,请查看!!!
ping -n 5 127.0.0.1>nul
goto findremovable
) else echo 病毒未清除,请用杀毒软件查杀

分享 分享 |  评论 (1) |  阅读 (?)  |  固定链接 |  类别 (系统故障处理) |  发表于 14:15
搜狐博客温馨提示:警惕博客留言诈骗, 搜狐博客管理员的正确地址为http://admin.blog.sohu.com, 其他都是冒牌。搜狐博客官方不会要求参加活动的各位博友缴纳任何的手续费用。请勿轻信留言、评论中的中奖信息,更不要拨打陌生电话及向陌生帐户汇款,谨防受骗!识别更多网络骗术,请 点击查看详情
正在读取评论信息...
您还未登录,只能匿名发表评论。或者您可以 登录 后发表。
 
  一个单亲妈妈的心愿:治好7岁儿子的白血病
表  情:
加载中...
回复通知: 同时用小纸条通知对方该回复