RavMon.exe es un virus simple que obliga a que no se muestren los archivos ocultos del sistema.Es obstinado y respaldado, e involucra muchas operaciones.
Resultados de aprendizaje e investigación en clases de seguridad cibernética
Entorno operativo: Windows XP
Las características del virus: ver las notas de los dos métodos respectivamente
Para lidiar con el virus, puede escribir directamente bat
También puede cambiar bat a C ++ (no lo considere si no ha aprendido vb)
1. Procesamiento por lotes
@echo off
cls
echo "杀毒软件正在运行"
rem 强制结束 用户名为 当前用户的 svchost.exe这个进程
taskkill /F /FI "username eq %username%" /IM svchost.exe
rem 删除启动项里的病毒开机自启
reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v svchost /f
rem 还原病毒修改的注册表项
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL /v CheckedValue /t reg_dword /d 1 /f
rem 去掉源病毒文件的各项属性
attrib %windir%\mdm.exe -r -h -s
attrib %windir%\SVCHOST.exe -r -h -s
attrib %windir%\SVCHOST.ini -r -h -s
rem 强制删除源病毒文件
del %windir%\mdm.exe
del %windir%\SVCHOST.exe
del %windir%\SVCHOST.ini
rem 删除其它分区的病毒文件
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 (
for %%b in (RavMon.exe,AutoRun.inf) do (
if exist %%a:\%%b (
attrib %%a:\%%b -s -r -h
del %%a:\%%b /q
)
)
)
pause
Dos, C++
#include<cstdlib> //system()
#include<iostream>
#include<cstring>
#include<windows.h> //SetFileAttributes() 设置文件属性
#include<io.h> //access()
using namespace std;
int main() {
cout << "--------------------Anti-virus software is running--------------------" << endl;
//进程处理复杂,而且 目前找不到“获取进程的用户名的方法”,遂用命令行代替
system("taskkill /F /FI \"username eq %username%\" /IM svchost.exe");
//-------------------任务一:删除病毒注册表开机自启项-------------------
//system("reg delete HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run /v svchost /f");
HKEY hKEY;//一个句柄
//RegOpenKeyEx() 打开指定的注册表项。
//如果函数成功,则返回值为 ERROR_SUCCESS
if (ERROR_SUCCESS ==
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_SET_VALUE,
&hKEY)) {
// 删除 Run 子键下键值 SVCHOST
if (ERROR_SUCCESS == RegDeleteValue(hKEY, "SVCHOST")) {
printf("删除键值 SVCHOST 成功\n");
}
}
RegCloseKey(hKEY);
//-------------------任务二:修改文件夹注册表CheckedValue显示项-------------------
//system("reg add HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\Folder\\Hidden\\SHOWALL /v CheckedValue /t reg_dword /d 1 /f");
char value[4] = {01, 00, 00, 00};//要赋予注册表CheckedValue的二进制值
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced\\Folder\\Hidden\\SHOWALL",
0, KEY_SET_VALUE, &hKEY)) {
if (ERROR_SUCCESS == RegSetValueEx(hKEY, "CheckedValue", 0, REG_DWORD, (BYTE *) value, 4)) {
printf("修改键值 CheckedValue 成功\n");
}
}
RegCloseKey(hKEY);
//-------------------任务三:解除病毒“只读”、“隐藏”、“系统”的文件属性,并删除C:\Windows下的病毒文件-------------------
// system("attrib C:\\Windows\\mdm.exe -r -h -s");
// system("attrib C:\\Windows\\SVCHOST.exe -r -h -s");
// system("attrib C:\\Windows\\SVCHOST.ini -r -h -s");
const char *file1 = "C:\\Windows\\MDM.EXE";
const char *file2 = "C:\\Windows\\SVCHOST.exe";
const char *file3 = "C:\\Windows\\SVCHOST.ini";
//“只读”、“隐藏”、“系统”、“存档”为文件的四种基本属性。
// FILE_ATTRIBUTE_NORMAL属性 设定为一般 (取消前四种属性)
SetFileAttributes(file1, FILE_ATTRIBUTE_NORMAL);
SetFileAttributes(file2, FILE_ATTRIBUTE_NORMAL);
SetFileAttributes(file3, FILE_ATTRIBUTE_NORMAL);
// system("del %windir%\\mdm.exe");
// system("del %windir%\\SVCHOST.exe");
// system("del %windir%\\SVCHOST.ini");
if (remove(file1) == 0) { //如果成功返回 0,失败返回“EOF”( -1)
cout << "删除" << file1 << "成功!" << endl;
} else {
cout << "删除病毒备份" << file1 << "失败" << endl;
}
if (remove(file2) == 0) {
cout << "删除" << file2 << "成功!" << endl;
} else {
cout << "删除病毒备份" << file2 << "失败" << endl;
}
if (remove(file3) == 0) {
cout << "删除" << file3 << "成功!" << endl;
} else {
cout << "删除病毒备份" << file3 << "失败" << endl;
}
//-------------------任务四:删除病毒在每个盘根目录下的备份-------------------
// system("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 (for %%b in (RavMon.exe,AutoRun.inf) do (if exist %%a:\\%%b (attrib %%a:\\%%b -s -r -h)))");
// system("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 (for %%b in (RavMon.exe,AutoRun.inf) do (if exist %%a:\\%%b (del %%a:\\%%b /q)))");
string file4 = "C:\\RavMon.exe";
string file5 = "C:\\AutoRun.inf";
for (char c = 'C'; c <= 'Z'; ++c) {//0是a, 2是c, 25是z
const string s = string(1, c); //string( size_type length, char ch ); 即length个ch
file4.replace(0, 1, s);//循环 替换盘符
file5.replace(0, 1, s);
//cout<<file4<<" "<<file5<<endl;
if (access(file4.c_str(), 0) == 0) { //判断 RavMon.exe 是否存在
SetFileAttributes(file4.c_str(), FILE_ATTRIBUTE_NORMAL);//设置文件属性
remove(file4.c_str());
cout << "删除" << file4 << "成功!" << endl;
}
if (access(file5.c_str(), 0) == 0) { //判断 AutoRun.inf 是否存在
SetFileAttributes(file5.c_str(), FILE_ATTRIBUTE_NORMAL);//设置文件属性
remove(file5.c_str());
cout << "删除" << file5 << "成功!" << endl;
}
}
cout << endl << "按回车结束" << endl;
system("pause");
}
3. Ejecución de resultados
①, modo por lotes
②, método C++ (la operación es en realidad la misma, pero C++ tiene muchos más resultados al depurar)