📄 tetedlg.cpp
字号:
// teteDlg.cpp : implementation file
//
#include "stdafx.h"
#include "tete.h"
#include "teteDlg.h"
#include "stdlib.h"
#include "String.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTeteDlg dialog
CTeteDlg::CTeteDlg(CWnd* pParent /*=NULL*/)
: CDialog(CTeteDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CTeteDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CTeteDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CTeteDlg)
// DDX_Control(pDX, IDC_PIC, m_ok);
DDX_Control(pDX, IDC_IPADDRESS, m_IP);
DDX_Control(pDX, IDC_BUTTON1, m_button);
DDX_Control(pDX, IDC_TAB1, m_tab);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CTeteDlg, CDialog)
//{{AFX_MSG_MAP(CTeteDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_RADIO1, OnSimView)
ON_BN_CLICKED(IDC_RADIO2, OnAtrView)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
ON_BN_CLICKED(IDC_BUTTON7, OnAttack)
ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON6, OnMenuopen)
ON_COMMAND(ID_MENUITEM32774, OnOpen)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
ON_COMMAND(ID_MENUITEM32775, OnCopyDir)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTeteDlg message handlers
BOOL CTeteDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
//设置环境变量WorkSpace
//得到当前地址
char path[255];
GetCurrentDirectory(255,path);
strcpy(workspace,path);
char cmd[255];
strcpy(cmd,path);
strcat(cmd,"\\install.bat ");
// strcat(cmd,path);
//四种攻击方式默认选择0即重新启动
Atrmode=0;
//创建进程
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_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("初始化成功!");
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
//显示控制
CheckDlgButton(IDC_RADIO1, BST_CHECKED); //默认选择按钮1
//根据ini文件配置tab标签
TabInit();
flag = false;
sel = 0;
number = 0;
//按纽标志初始化
m_buttonID[0] = IDC_BUTTON1;
m_buttonID[1] = IDC_BUTTON2;
m_buttonID[2] = IDC_BUTTON3;
m_buttonID[3] = IDC_BUTTON4;
m_buttonID[4] = IDC_BUTTON5;
//文本框初始化
m_staticID[0] = IDC_STATIC1;
m_staticID[1] = IDC_STATIC2;
m_staticID[2] = IDC_STATIC3;
m_staticID[3] = IDC_STATIC4;
m_staticID[4] = IDC_STATIC5;
CString Name_else[] = {"Name1","Name2","Name3","Name4","Name5","Name6"};
for(int i=0;i<6;i++)
Name[i] = Name_else[i];
CWnd *pwnd;
Init();
m_tab.ShowWindow(TRUE);
// NetButtonShow(); //初始化的时候默认的显示对应在目录扫描下面的显示
OnButtonShow(0);
pwnd = GetDlgItem(IDC_BUTTON6);
pwnd->ShowWindow(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
void CTeteDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CTeteDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CTeteDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
//动态显示Tab标签项
void CTeteDlg::TabInit()
{
CString Folder[] = { "Folder1", "Folder2", "Folder3", "Folder4", "Folder5","Folder6"};
CString ini; //记录文件夹的数目
GetPrivateProfileString("amount","Amount","0",ini.GetBuffer(MAX_PATH),MAX_PATH,".\\Tool\\Tool.ini");
count_tab = atol(ini);
for(int i=0;i<count_tab;i++)
{
GetPrivateProfileString("folder",Folder[i],"0",ini.GetBuffer(MAX_PATH),MAX_PATH,".\\Tool\\Tool.ini");
m_tab.InsertItem( i, _T(ini) );
Folder_tab[i] = ini;
}
}
void CTeteDlg::ButtonInit()
{
CWnd *pwnd;
for(int i=0;i<5;i++)
{
pwnd = GetDlgItem(m_buttonID[i]);
pwnd->ShowWindow(FALSE);
}
for(i=0;i<5;i++)
{
pwnd = GetDlgItem(m_staticID[i]);
pwnd->ShowWindow(FALSE);
}
}
//显示扫描目录下面的工具
void CTeteDlg::DoorButtonShow()
{
ButtonInit();
MessageBox("还没有写,要先配置好ini文件");
}
void CTeteDlg::TroButtonShow()
{
ButtonInit();
MessageBox("还没有写,要先配置好ini文件");
}
void CTeteDlg::snifferButtonShow()
{
ButtonInit();
MessageBox("还没有写,要先配置好ini文件");
}
void CTeteDlg::DOSButtonShow()
{
ButtonInit();
MessageBox("还没有写,要先配置好ini文件");
}
void CTeteDlg::OnSimView()
{
// TODO: Add your control notification handler code here
view = 0;
SimView();
if(flag)
{
OnButtonShow(sel);
flag = false;
}
}
void CTeteDlg::OnAtrView()
{
// TODO: Add your control notification handler code here
view = 1;
AtrView();
CheckDlgButton(IDC_RADIO3, BST_CHECKED);
CheckDlgButton(IDC_RADIO4, BST_UNCHECKED);
CheckDlgButton(IDC_RADIO5, BST_UNCHECKED);
CheckDlgButton(IDC_RADIO6, BST_UNCHECKED);
flag = true;
}
void CTeteDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
sel = m_tab.GetCurSel();
OnButtonShow(sel);
*pResult = 0;
}
void CTeteDlg::OnButtonShow(int sel)
{
ButtonInit();
char path[255] = ".\\Tool\\";
char *temp = Folder_tab[sel].GetBuffer(MAX_PATH);
strcat(path,temp);
strcat(path,"\\");
strcat(path,temp);
strcat(path,".ini");
CWnd *pwnd;
CString ini; //记录文件夹的数目
GetPrivateProfileString("amount","Amount","0",ini.GetBuffer(MAX_PATH),MAX_PATH,path);
int count = atol(ini);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -