SRENG分析及P教程(纯手工防毒法)

SRENG分析及P教程(纯手工防毒法)
2008年08月15日 星期五 16:26
首先,学会SRENG日志分析是必然的,下面用我的日志做为范例:
正常的注册表启动项目一般是如下:
启动项目
注册表
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
    <ctfmon.exe><C:\WINDOWS\system32\ctfmon.exe> [(Verified)Microsoft Windows Publisher]
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows]
    <load><> [N/A]
    <run><> [N/A]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
    <shell><Explorer.exe> [(Verified)Microsoft Windows Component Publisher]
    <Userinit><C:\WINDOWS\system32\userinit.exe,> [(Verified)Microsoft Windows Publisher]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows]
    <AppInit_DLLs><> [N/A]
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
    <UIHost><logonui.exe> [(Verified)Microsoft Windows Publisher]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\<{12d0ed0d-0ee0-4f90-8827-78cefb8f4988}]
    <IE7 Uninstall Stub><C:\WINDOWS\system32\ieudinit.exe> [(Verified)Microsoft Windows Component Publisher]
病毒一般的加载如下位置
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
    <upxdnd><C:\WINDOWS\upxdnd.exe> []
    <cmdbcs><C:\WINDOWS\cmdbcs.exe> []
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Windows]
    <AppInit_DLLs><okmhczy.dll> [N/A]                                               AppInit_DLLs被插入程序达到加载的目的
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon]
    <shell><Explorer.exe> [Microsoft Windows Component Publisher]                   这边的效果是桌面程序被替换的表现
    <Userinit><C:\WINDOWS\system32\userinit.exe,> [Microsoft Windows Publisher]     userinit.exe被机器够替换的表现
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellExecuteHooks]
    <{3A57CAD1-412F-9547-713F-9641FA3FC7A3}><C:\WINDOWS\system32\okmhczy.dll> []
    <{8A1247C1-53DA-FF43-ABD3-345F323A48D8}><C:\WINDOWS\system32\avwghmn.dll> []
下面的IFEO劫持指向系统正常文件svchost.exe,很阴险的劫持
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\avp.exe]
    <IFEO[avp.exe]><svchost.exe> [(Verified)Microsoft Windows Publisher]          
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\CCenter.exe]
    <IFEO[CCenter.exe]><svchost.exe> [(Verified)Microsoft Windows Publisher]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\ccEvtMgr.exe]
    <IFEO[ccEvtMgr.exe]><svchost.exe> [(Verified)Microsoft Windows Publisher]
服务和驱动等就不细说了,只要看到有[N/A] 标记的一般便确定为可疑,剔除来后再百度下,就知道了.

下面来讲没有工具怎么手动处理病毒
手动处理病毒包括,使用工具和纯手工制作工具杀毒,鉴于工具使用教程很多,我自己也不精通,所以就不说了,我下面列出用P处理自己编写工具杀毒
@echo off & setlocal EnableDelayedExpansion   
rem -----------------修复系统时间模块-----------------
FOR /F "eol=; tokens=1,2,3 delims=- " %%i in ('date /t') do (
   date 2008-%%j-%%k
)
rem -----------------批量查杀病毒进程模块-----------------
for %%d in (病毒1.exe,病毒2.exe) do ntsd -c q -pn %%d /f
rem -----------------批量去除病毒属性模块-----------------其中list.txt为需要去除属性的病毒列表--需要提供详细路径!
for /f "usebackq delims=*" %%i in (list.txt) do attrib -s -h -r "%%i"
rem -----------------批量删除病毒文件模块-----------------其中list.txt为需要删除的病毒列表--需要提供详细路径!
for /f "usebackq delims=*" %%i in (list.txt) do del /f /q /a "%%i"
rem -----------------批量免疫病毒文件模块-----------------其中list.txt为需要免疫的病毒列表--需要提供详细路径!
for /f "usebackq delims=*" %%i in (list.txt) do md "%%i"
rem -----------------list.txt文件示例-----------------
C:\WINDOWS\system32\病毒1.exe
C:\WINDOWS\病毒2.exe
%TEMP%\病毒3.exe
rem -----------------批量注销病毒DLL模块-----------------其中list.txt为需要注销的病毒DLL--需要提供详细路径!
for /f "usebackq delims=*" %%i in (list.txt) do regsvr32 /u "%%i"
rem -----------------批量去处属性并删除病毒DLL模块-----------------其中list.txt为需要删除的病毒DLL--需要提供详细路径!
for /f "usebackq delims=*" %%i in (list.txt) do attrib -h -s -r "%UserSelection%" & del "%UserSelection%" /q
rem -----------------去除每个盘下的AUTORUN.INF及病毒的属性并删除-----------------
for %%f in (autorun.inf,病毒.exe) do for /D %%d 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 %%d:\%%f attrib -s -h -r %%d:\%%f
for %%f in (autorun.inf,病毒.exe) do for /D %%d 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 %%d:\%%f del %%d:\%%f /q
rem -----------------解锁注册表模块-----------------
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v DisableRegistryTools /t reg_dword /d 00000000 /f
rem -----------------停止病毒的服务模块-----------------
net stop 病毒服务名称
rem -----------------删除病毒的服务模块-----------------
sc delete 病毒服务名称
rem -----------------删除病毒的启动项模块-----------------
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v 病毒 /f
rem -----------------显示隐藏文件模块-----------------
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL" /v CheckedValue /d 1 /f
rem -----------------关闭自动播放模块-----------------
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /v NoDriveTypeAutoRun /t reg_dword /d 000000FF /f
rem -----------------恢复安全模式屏幕模块-----------------
reg add "HKLM\SYSTEM\ControlSet001\Control\SafeBoot\Minimal\{4D36E967-E325-11CE-BFC1-08002BE10318}" /ve /d DiskDrive /f
reg add "HKLM\SYSTEM\ControlSet001\Control\SafeBoot\Network\{4D36E967-E325-11CE-BFC1-08002BE10318}" /ve /d DiskDrive /f
reg add "HKLM\SYSTEM\ControlSet003\Control\SafeBoot\Minimal\{4D36E967-E325-11CE-BFC1-08002BE10318}" /ve /d DiskDrive /f
reg add "HKLM\SYSTEM\ControlSet003\Control\SafeBoot\Network\{4D36E967-E325-11CE-BFC1-08002BE10318}" /ve /d DiskDrive /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E967-E325-11CE-BFC1-08002BE10318}" /ve /d DiskDrive /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E967-E325-11CE-BFC1-08002BE10318}" /ve /d DiskDrive /f
rem -----------------修复无法打开的盘符模块-----------------
for /d %%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 if exist %%i: chkdsk %%i: /f /x
rem -----------------屏蔽恶意网站模块-----------------
echo 127.0.0.1      localhost>>C:\WINDOWS\system32\drivers\etc\hosts
echo 127.0.0.1      [url]www.xxx.com[/url]或IP地址>>C:\WINDOWS\system32\drivers\etc\hosts
rem -----------------免疫C盘AUTORUN.INF模块-----------------
C:             
md Autorun.inf & cd Autorun.inf & md a...
rem -----------------用IEFO劫持对付病毒模块-----------------
病毒1.exe >>ifeo.ini
病毒2.exe >>ifeo.ini
set route=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
for /f %%i in (ifeo.ini) do (
    reg add "%route%\%%i" /v Debugger /t REG_SZ /d C:\windows\system32\svchost.exe /f >nul 2>nul
)
rem -----------------清除病毒添加的IEFO劫持模块-----------------
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options">xylz.dat
for /f "tokens=* delims= skip=4" %%j in (xylz.dat) do (
   reg delete "%%j" /v debugger /f 1>nul 2>nul
)
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Your Image File Name Here without a path" /v Debugger /d "ntsd -d" /f
rem -----------------修复userinit.exe(对付机器狗)模块-----------------
if exist C:\WINDOWS\system32\dllcache\userinit.exe attrib +r +s C:\WINDOWS\system32\dllcache\userinit.exe
copy /y C:\WINDOWS\system32\dllcache\userinit.exe C:\WINDOWS\system32\userinit.exe
rem -----------------快速刷新系统模块-----------------
taskkill /F /im explorer.exe & start explorer.exe
rem -----------------重新启动系统模块-----------------
shutdown -r -t 10 -c "清理病毒完毕!请保存好手头的工作,系统即将重新启动!"
rem -----------------病毒专杀BAT模板源码终止-----------------
以上程序,可以复制到记事本保存为.CMD运行.上面的应该很简单,大家都可以看懂,所以就不多说了,可以自己DIY针对自己所中病毒来套用.
当然,光靠我们手动查杀实在是太麻烦了,我们必须要防御为主
首先,我们要防御好端口,系统端口的连接外面的第一道关卡,我们必须把好第一道关卡,才能减少中招的几率
蠕虫一般都喜欢攻击端口来获取主机信息,我们需要用到IPSECCMD.EXE,一个很实用的端口屏蔽工具.可以到微软官方下载到.
然后配合上一句简单的代码,其中tcpudp.txt,就是写需要屏蔽的端口,可以在CMD下依次输入,或者直接保存为任意.CMD运行
for /f "usebackq delims=*" %%i in (tcpudp.txt) do ipseccmd -w REG -p "HFUT_SECU" -r "Block TCP/%%i" -f *+0:%%i:TCP -n BLOCK -x >nul
for /f "usebackq delims=*" %%i in (tcpudp.txt) do ipseccmd -w REG -p "HFUT_SECU" -r "Block UDP/%%i" -f *+0:%%i:UDP -n BLOCK -x >nul
除以上之外,我们还需要设置下TCPIP的服务,用下面的代码保存为任意.CMD运行.也可以直接用REG导入.
(echo Windows Registry Editor Version 5.00
echo.
echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters]
echo "EnableSecurityFilters"=dword:00000001
echo.
echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces\{F3BBAABC-03A5-4584-A7A0-0251FA38B8B1}]
echo "TCPAllowedPorts"=hex(07):32,00,31,00,00,00,38,00,30,00,00,00,34,00,30,00,30,\
echo   00,30,00,00,00,00,00
echo.
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
echo "EnableSecurityFilters"=dword:00000001
echo.
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{F3BBAABC-03A5-4584-A7A0-0251FA38B8B1}]
echo "TCPAllowedPorts"=hex(07):32,00,31,00,00,00,38,00,30,00,00,00,34,00,30,00,30,\
echo   00,30,00,00,00,00,00
echo. )>>%temp%\ipfilter.reg
regedit /s %temp%\ipfilter.reg & del %temp%\ipfilter.reg
当然,光屏蔽端口只是做了一小部分,我们还需要将系统存在隐患的东西尽力解决,一般需要删除默认共享,关闭自动播放功能,显示隐藏文件,显示隐藏拓展名等
先说删除默认共享,任旧给出CMD脚本,用下面的代码保存为任意.CMD运行.
@echo off & setlocal EnableDelayedExpansion
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 (
        net share %%a$ /delete>nul 2>nul && echo 成功删除名为 %%a$ 的默认共享 || echo 名为 %%a$ 的默认共享不存在
    )
)
net share admin$ /delete>nul 2>nul && echo 成功删除名为 admin$ 的默认共享 || echo 名为 admin$ 的默认共享不存在
echo Windows Registry Editor Version 5.00 >%systemroot%\delshare.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters]>>%systemroot%\delshare.reg
echo "AutoShareWks"=dword:00000000>>%systemroot%\delshare.reg
echo "AutoShareServer"=dword:00000000>>%systemroot%\delshare.reg
regedit /s %systemroot%\delshare.reg & del /F /Q %systemroot%\delshare.reg
关闭自动播放功能
@echo off & setlocal EnableDelayedExpansion
echo Windows Registry Editor Version 5.00 >%systemroot%\autorun.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer]>>%systemroot%\autorun.reg
echo "NoDriveTypeAutoRun"=dword:000000ff>>%systemroot%\autorun.reg
regedit /s %systemroot%\autorun.reg & del /F /Q %systemroot%\autorun.reg
显示隐藏文件 (REG版本是不是很麻烦啊.呵呵)
@echo off & setlocal EnableDelayedExpansion
echo Windows Registry Editor Version 5.00>SHOWALL.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL]>>SHOWALL.reg
echo "CheckedValue"=->>SHOWALL.reg
echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL]>>SHOWALL.reg
echo "CheckedValue"=dword:00000001>>SHOWALL.reg
regedit /s SHOWALL.reg & DEL /F /Q SHOWALL.reg
显示隐藏拓展名,最近流行的文件夹图标病毒之所以会流行就是没几个人看出那家伙的后缀为EXE(CMD版本简单吧)
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v HideFileExt /t reg_dword /d 00000000 /f
修复了系统操作漏洞,我们还需要防御IE浏览器中招
常见的浏览器劫持一般是通过修改HKCU\Software\Microsoft\Internet Explorer\Main\Start Page 的 about:blank 值来实现
我们一般将IE设置为中高安全即可过滤掉一些危险的脚本.通常的网页挂马,如果你访问挂马网页的话,硬盘指示灯长亮,且硬盘有长时间读写
那么可以肯定你已经中招.
别慌,我们这时候应该断网,右键IE属性--删除COOKISE/删除文件,所有脱机文件--确定
开始--运行--键入%TEMP%--删除里面能删除的,或者用下面的P搞定.
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %windir%\*.bak
del /f /q %systemdrive%\recycled*.*
rd /s /q %windir%\temp & md %windir%temp
rd /s /q %temp% & md %temp%
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
rd /s /q "%userprofile%\Local Settings\Tempporary Interent Files"
执行以上P后上网的COOKIES和网页缓存全被清理,病毒一般下载到缓存或TEMP文件,被你这么一搞就完了.
我们还需要把系统还原关了,右键我的电脑--属性--系统还原,在所有驱动器上关闭系统还原,打勾,确定.
常见的正常进程我们也需要了解,以便查看是否有可疑进程运行,正常的一般列出如下:
csrss.exe
explorer.exe
lsass.exe
smss.exe
services.exe
svchost.exe
winlogon.exe
System
System Idle Process
Wscript.exe
cmd.exe
alg.exe
ctfmon.exe
conime.exe
spoolsv.exe
NOTEPAD.EXE
tasklist.exe
wmiprvse.exe
iexplore.exe
winamp.exe
winrar.exe
QQ.exe
TM.exe
ping.exe
为了防止病毒进程运行,我们可以将以上进程写入到Process.ini文件中,然后用下面的一个P处理来使之生效
@echo off & Setlocal EnableDelayedExpansion
:start
cls
color 0A
title 进程杀手--by 古风山寨
tasklist >>list.txt & start list.txt
MsgBox "亲爱的朋友,请先配置process.ini需要保留的进程,list.txt为目前系统进程.", 64, "友情提示--by 古风山寨" > end.vbs
start end.vbs & start "process.ini" & del end.vbs /q
echo     按任意键开始杀进程!        
pause 1>nul 2>nul
for /f "tokens=1 delims=," %%a in ('tasklist /nh /FO CSV') do (
    for /f "delims=" %%b in (Process.ini) do (
        set /a flag+=1
        if /i not %%a=="%%b" set /a num+=1
    )
    if !flag! equ !num! ntsd -c q -pn %%a
    set /a flag=num=0
)
del /f /q list.txt
echo     进程查杀完毕!按任意键退出本程序!       
pause 1>nul 2>nul
以上是个范例,如果我们要它在后台监视,并隔5秒扫描的话,可以改成下面的效果
@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
for /f "tokens=1 delims=," %%a in ('tasklist /nh /FO CSV') do (
    for /f "delims=" %%b in (Process.ini) do (
        set /a flag+=1
        if /i not %%a=="%%b" set /a num+=1
    )
    if !flag! equ !num! ntsd -c q -pn %%a
    set /a flag=num=0
)
ping -n 5 127.1.0.0 2>nul 1>nul
goto begin
我想有了这一系列的安全操作后,再加个进程杀手,病毒应该无法轻易侵入我们的系统了吧,改天有空再整理吧,就写到这了.
 
 
 
[url]http://hi.baidu.com/deak17/blog/item/f27616228cd074a24723e866.html[/url]

你可能感兴趣的:(职场,休闲,SRENG,纯手工防毒法)