exe专杀(应对病毒攻击的技术_cmd exe病毒专杀工具)

发布时间:2025-12-10 19:24:59 浏览次数:6

应对病毒攻击的技术_cmd exe病毒专杀工具-

应对病毒攻击的技术_cmd exe病毒专杀工具RavMon.exe是一个强制不显示系统的隐藏文件的病毒,顽固且有备份,涉及到很多操作。网络安全课上的学习研究成果。

RavMon.exe是一个强制不显示系统的隐藏文件的简单病毒,顽固且有备份,涉及到很多操作。

网络安全课上的学习研究成果

运行环境:Windows XP

病毒的特性:分别见两种方式的注释

处理该病毒可以直接写 bat

也可以将 bat改为C++(vb没学过就先不考虑了)

一、批处理

@echo offclsecho "杀毒软件正在运行"rem 强制结束 用户名为 当前用户的 svchost.exe这个进程taskkill /F /FI "username eq %username%" /IM svchost.exerem 删除启动项里的病毒开机自启reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v svchost /frem 还原病毒修改的注册表项reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL /v CheckedValue /t reg_dword /d 1 /frem 去掉源病毒文件的各项属性attrib %windir%\mdm.exe -r -h -sattrib %windir%\SVCHOST.exe -r -h -sattrib %windir%\SVCHOST.ini -r -h -srem 强制删除源病毒文件del %windir%\mdm.exedel %windir%\SVCHOST.exedel %windir%\SVCHOST.inirem 删除其它分区的病毒文件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 -hdel %%a:\%%b /q)))pause

是否还在为Ide开发工具频繁失效而烦恼,来吧关注以下公众号获取最新激活方式。亲测可用!

为防止网络爬虫,请关注公众号回复”口令”

激活idea 激活CLion DataGrip DataSpell dotCover dotMemory dotTrace GoLand PhpStorm PyCharm ReSharper ReShaC++ Rider RubyMine WebStorm 全家桶 刷新

【正版授权,激活自己账号】:Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】:官方授权 正版激活 自己使用,支持Jetbrains家族下所有IDE…

二、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");}

三、运行结果

①、批处理方式

②、C++方式(操作其实都一样,只不过C++在调试的时候多了很多输出)

需要做网站?需要网络推广?欢迎咨询客户经理 13272073477