📄 tetedlg.cpp
字号:
CString exeName;
for(int i=0;i<count;i++)
{
exeName.Format("%d",i);
GetPrivateProfileString(exeName,"Name","0",ini.GetBuffer(MAX_PATH),MAX_PATH,path);
pwnd = GetDlgItem(m_buttonID[i]);
pwnd->SetWindowText(ini);
pwnd->ShowWindow(TRUE);
GetPrivateProfileString(exeName,"Description","0",ini.GetBuffer(MAX_PATH),MAX_PATH,path);
pwnd = GetDlgItem(m_staticID[i]);
pwnd->SetWindowText(ini);
pwnd->ShowWindow(TRUE);
}
}
void CTeteDlg::AtrView()
{
Init();
CWnd *pwnd;
int m_radioID[4]; //攻击方式选择
m_radioID[0] = IDC_RADIO3;
m_radioID[1] = IDC_RADIO4;
m_radioID[2] = IDC_RADIO5;
m_radioID[3] = IDC_RADIO6;
pwnd = GetDlgItem(IDC_STATIC);
pwnd->ShowWindow(TRUE);
pwnd = GetDlgItem(IDC_IPADDRESS);
pwnd->ShowWindow(TRUE);
pwnd = GetDlgItem(IDC_COM1);
pwnd->ShowWindow(TRUE);
pwnd = GetDlgItem(IDC_COM2);
pwnd->ShowWindow(TRUE);
pwnd = GetDlgItem(IDC_BUTTON7);
pwnd->ShowWindow(TRUE);
for(int i=0;i<4;i++)
{
pwnd = GetDlgItem(m_radioID[i]);
pwnd->ShowWindow(TRUE);
}
}
void CTeteDlg::SimView()
{
int i=0;
CWnd *pwnd;
Init();
m_tab.ShowWindow(TRUE);
}
void CTeteDlg::Init()
{
int i;
for(i=0;i<5;i++)
all[i] = m_buttonID[i];
all[5] = IDC_BUTTON7;
for(i=6;i<11;i++)
all[i]=m_staticID[i-6];
all[11] = IDC_STATIC;
all[12] = IDC_IPADDRESS;
all[13] = IDC_TAB1;
all[14] = IDC_COM1;
all[15] = IDC_COM2;
all[16] = IDC_RADIO3;
all[17] = IDC_RADIO4;
all[18] = IDC_RADIO5;
all[19] = IDC_RADIO6;
CWnd *pwnd;
for(i=0;i<20;i++)
{
pwnd = GetDlgItem(all[i]);
pwnd->ShowWindow(FALSE);
}
}
//选择攻击
//首先从控件中得到目的IP地址
//然后开辟新的进程拷贝攻击文件
//运行攻击程序
void CTeteDlg::OnAttack()
{
unsigned char IPvar[4];
char temp[4];
char cmd[255];
char *IP;
int i;
IP=(char *)malloc(sizeof(char)*16);
m_IP.GetAddress(IPvar[0],IPvar[1],IPvar[2],IPvar[3]);
itoa(IPvar[0],temp,10);
strcpy(IP,temp);
for(i=1;i<4;i++)
{
strcat(IP,".");
itoa(IPvar[i],temp,10);
strcat(IP,temp);
}
bool NeedWindow = false;
switch(Atrmode)
{
case 0:strcpy(cmd,"\\Attack\\reboot.bat");
break;
case 1:strcpy(cmd,"\\Attack\\poweroff.bat");
break;
case 2:strcpy(cmd,"\\Attack\\telecontrol.bat");
break;
case 3:strcpy(cmd,"\\Attack\\backdoor.bat");NeedWindow = true;
break;
default:strcpy(cmd,"\\Attack\\reboot.bat");
}
Attack(cmd,IP,workspace,NeedWindow);
}
void CTeteDlg::Attack(char* cmd,char *ip,char* path,bool CreateWindow)
{
char command[256];
strcpy(command,path);
strcat(command,cmd);
strcat(command," ");
strcat(command,ip);
strcat(command," ");
strcat(command,path);
//创建进程
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
command, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
CreateWindow==true?CREATE_NEW_CONSOLE:CREATE_NO_WINDOW, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
MessageBox("攻击失败!");
}
else
{
MessageBox("攻击成功!请稍候10秒钟……");
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
void CTeteDlg::OnRadio3()
{
Atrmode=0;// TODO: Add your control notification handler code here
}
void CTeteDlg::OnRadio4()
{
Atrmode=1;// TODO: Add your control notification handler code here
}
void CTeteDlg::OnRadio5()
{
Atrmode=2;// TODO: Add your control notification handler code here
}
void CTeteDlg::OnRadio6()
{
Atrmode=3;// TODO: Add your control notification handler code here
}
void CTeteDlg::OnButton1()
{
// TODO: Add your control notification handler code here
CMenu mymenu;
CPoint point;
GetCursorPos(&point);
mymenu.LoadMenu(IDR_MENU1);
mymenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON |TPM_LEFTALIGN ,point.x,point.y,this);
number = 0;
}
void CTeteDlg::OnMenuopen()
{
char path[255];
GetCurrentDirectory(255,path);
char cmd[255];
strcpy(cmd,path);
strcat(cmd,"\\help\\radmin.exe");
// strcat(cmd,path);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
cmd, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
CREATE_NEW_CONSOLE, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
MessageBox("打开失败");
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
void CTeteDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void CTeteDlg::DisplayPic()
{
/* CRect ret;
CString FileName = ".\\Pic\\winxp.bmp";
HBITMAP okmap=(HBITMAP)LoadImage(AfxGetInstanceHandle(),FileName,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION); //得到载入的图象信息
GetDlgItem(IDC_BUTTON1)->GetWindowRect(&ret); //得到按纽的坐标信息
ScreenToClient(&ret);
GetDlgItem(IDC_BUTTONP)ICSetBitmap(okmap);
GetDlgItem(IDC_PIC)->MoveWindow(ret);
*/
}
void CTeteDlg::OnOpen()
{
char path[255] = ".\\Tool\\";
char *temp = Folder_tab[sel].GetBuffer(MAX_PATH);
strcat(path,temp);
strcat(path,"\\");
strcat(path,temp);
strcat(path,".ini");
char exe[255];
CString exeName;
exeName.Format("%d",number);
GetPrivateProfileString(exeName,"Exe","0",exe,255,path);
strcpy(path,".\\Tool");
strcat(path,exe);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
path, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
CREATE_NEW_CONSOLE, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
MessageBox("打开失败");
}
// Wait until child process exits.
// WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
void CTeteDlg::OnButton2()
{
// TODO: Add your control notification handler code here
CMenu mymenu;
CPoint point;
GetCursorPos(&point);
mymenu.LoadMenu(IDR_MENU1);
mymenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON |TPM_LEFTALIGN ,point.x,point.y,this);
number = 1;
}
void CTeteDlg::OnButton3()
{
CMenu mymenu;
CPoint point;
GetCursorPos(&point);
mymenu.LoadMenu(IDR_MENU1);
mymenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON |TPM_LEFTALIGN ,point.x,point.y,this);
number = 2;
}
void CTeteDlg::OnButton4()
{
// TODO: Add your control notification handler code here
CMenu mymenu;
CPoint point;
GetCursorPos(&point);
mymenu.LoadMenu(IDR_MENU1);
mymenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON |TPM_LEFTALIGN ,point.x,point.y,this);
number = 3;
}
void CTeteDlg::OnButton5()
{
// TODO: Add your control notification handler code here
CMenu mymenu;
CPoint point;
GetCursorPos(&point);
mymenu.LoadMenu(IDR_MENU1);
mymenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTBUTTON |TPM_LEFTALIGN ,point.x,point.y,this);
number = 4;
}
void CTeteDlg::OnCopyDir()
{
char dir[255];
GetCurrentDirectory(255,dir);
char path[255] = ".\\Tool\\";
char *temp = Folder_tab[sel].GetBuffer(MAX_PATH);
strcat(path,temp);
strcat(path,"\\");
strcat(path,temp);
strcat(path,".ini");
char exe[255];
CString exeName;
exeName.Format("%d",number);
GetPrivateProfileString(exeName,"Exe","0",exe,255,path);
strcpy(path,"\\Tool");
strcat(path,exe);
strcat(dir,path);
MessageBox(dir,NULL,MB_OK); //显示路径
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -