Archive for the ‘工作’ Category

1、关于%windir%\SoftwareDistribution\Download目录下Windows Update自动下载的补丁的重利用批处理

@echo off
set opt=/passive /norestart /overwriteoem /nobackup
for /d %%d in (*) do call :_upit %%d
echo.
echo !!!ATTENTION!!!: All update done! Press any key to reboot…
pause >nul
shutdown -r -f -t 0
goto :eof

:_upit
echo Patching %1…
if exist %1\update\update.exe start /wait %1\update\update.exe %opt%
echo %1 done!
echo.
goto :eof

 

2、根据超级巡警导出补丁列表文件PatchList.txt的内容自动运行相应补丁的批处理

2.1 PatchList.txt范例:

Windows系统漏洞和Office办公软件漏洞信息:

安全公告:
补丁名称:KB952287
补丁地址:http://download.microsoft.com/download/9/1/a/91a29784-b75d-4c65-b218-4c9daed3de54/WindowsXP-KB952287-x86-CHS.exe

安全公告:MS08-073
补丁名称:KB958215
补丁地址:http://qh.dlservice.microsoft.com/download/B/1/2/B122E96E-9D99-4BA4-85A7-B14A24B740FA/WindowsXP-KB958215-x86-CHS.exe

安全公告:MS08-076
补丁名称:KB954600
补丁地址:http://qh.dlservice.microsoft.com/download/D/3/B/D3BFC468-0B8F-4B57-A137-55F4443E18F1/WindowsXP-KB954600-x86-CHS.exe

安全公告:MS08-076
补丁名称:KB952069
补丁地址:http://qh.dlservice.microsoft.com/download/6/C/D/6CDF486F-8E20-4138-9804-84A7DF1FD83B/WindowsXP-WindowsMedia-KB952069-x86-CHS.exe

安全公告:MS08-078
补丁名称:KB960714
补丁地址:http://qh.dlservice.microsoft.com/download/6/B/F/6BFE902B-39A0-422E-B4F7-90147AD0921E/WindowsXP-KB960714-x86-CHS.exe

第三方应用程序漏洞信息:

应用程序名:Flash Player
出品公司:Adobe
下载地址:http://cy.sucop.com/other/FlashPlayerUpdate.exe

应用程序名:千千静听
出品公司:千千静听公司
下载地址:http://wwwct.ttplayer.com/download/ttpsetup.exe

应用程序名:Adobe Reader
出品公司:Adobe
下载地址:http://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.0/chs/AdbeRdr90_zh_CN.exe

 

2.2 GetFileList.cmd: 从PatchList.txt文件中提取补丁文件名

@echo off
for /f "usebackq tokens=2,3,4,5,6,7,8,9,10,11,12 delims=/" %%a in (`type PatchList.txt ^| find "://"`) do call :_check %%a %%b %%c %%d %%e %%f %%g %%h %%i %%j %%k
set tmpvar=
set lastvar=

goto :eof

:_check
set tmpvar=
set lastvar=

:_loop
set tmpvar=%1
if not defined tmpvar echo %lastvar%
if not defined tmpvar goto :eof
set lastvar=%tmpvar%
shift
goto _loop

 

2.3 Go.cmd : 根据2.2中提取的文件名打补丁的批处理

@echo off
if not "%1"=="" goto _man

:_auto
for /f %%i in (’dir /b/od *.exe’) do call :_update %%i
goto _all_done

:_man
if not exist %1 goto _auto
for /f %%i in (%1) do call :_update %%i
goto _all_done

:_update
if not exist %1 echo !!!File %1 not exist!!! && goto :eof
echo Running %1 …
set filename=%1
set _wait=/wait
if /i not "%filename:~0,3%"=="win" set _wait=
start %_wait% %1 /quiet /passive /norestart /overwriteoem /nobackup
echo %1 done!
echo.
goto :eof

:_all_done
echo 补丁全部打完,按任意键重新启动计算机…
pause >nul
shutdown -r -f -t 0
goto :eof