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

📄 arpscandlg.cpp

📁 一个基于VC++开发的网络安全扫描程序!!!能够有效地发现网络安全漏洞
💻 CPP
字号:
// ArpScanDlg.cpp : implementation file
//

#include "stdafx.h"
#include "BeastScaner.h"
#include "ArpScanDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CArpScanDlg dialog
IMPLEMENT_DYNAMIC(CArpScanDlg, CDialog)

CArpScanDlg::CArpScanDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CArpScanDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CArpScanDlg)
	strHostName = _T("");
	strHostMAc = _T("");
	dwTimeOutValue = 2;
	strLocalIp = _T("");
	strNetMask = _T("");
	strDefaultGateway = _T("");
	//}}AFX_DATA_INIT

	dwLocalIP=0;
	dwNetMask=0;
    dwDefaultGateway=0;
}

CArpScanDlg::~CArpScanDlg()
{
}

void CArpScanDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CArpScanDlg)
	DDX_Text(pDX, IDC_EDIT3, strHostName);
	DDV_MaxChars(pDX, strHostName, 256);
	DDX_Text(pDX, IDC_EDIT1, strHostMAc);
	DDX_Text(pDX, IDC_EDIT4, dwTimeOutValue);
	DDV_MinMaxDWord(pDX, dwTimeOutValue, 1, 5);
	DDX_Text(pDX, IDC_EDIT2, strLocalIp);
	DDX_Text(pDX, IDC_EDIT5, strNetMask);
	DDX_Text(pDX, IDC_EDIT6, strDefaultGateway);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CArpScanDlg, CDialog)
	//{{AFX_MSG_MAP(CArpScanDlg)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedSlowScan)
	ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedFastScan)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CArpScanDlg message handlers

void CArpScanDlg::OnBnClickedSlowScan() 
{
	// TODO: Add your control notification handler code here
	this->theThreadParament.dwOriginalIP=(this->dwLocalIP&0xFFFFFF00)+1;
	this->theThreadParament.dwLastIP=(this->dwLocalIP&0xFFFFFF00)+254;
	pMainWindow->SendMessage(WM_BEGIN_SCAN,ARP_SCAN,(LPARAM)&(this->theThreadParament));
}

void CArpScanDlg::OnBnClickedFastScan() 
{
	// TODO: Add your control notification handler code here
	this->UpdateData();
	this->theThreadParament.dwOriginalIP=(this->dwLocalIP&0xFFFFFF00)+1;
	this->theThreadParament.dwLastIP=(this->dwLocalIP&0xFFFFFF00)+254;
	this->theThreadParament.dwHostIP=this->dwLocalIP;
	memcpy(this->theThreadParament.HostMac,this->bLocalMac,6);
	this->theThreadParament.dwTimeOut=this->dwTimeOutValue;
	pMainWindow->SendMessage(WM_BEGIN_SCAN,ARP_FAST_SCAN,(LPARAM)&(this->theThreadParament));	
}

BOOL CArpScanDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	UCHAR *p=(UCHAR *)&(this->dwLocalIP);
	memset(&(this->theThreadParament),0,sizeof(this->theThreadParament));
	this->strLocalIp.Format("%d.%d.%d.%d",p[3],p[2],p[1],p[0]);
	p=(UCHAR *)&(this->dwNetMask);
	this->strNetMask.Format("%d.%d.%d.%d",p[3],p[2],p[1],p[0]);
	p=(UCHAR *)&(this->dwDefaultGateway);
	this->strDefaultGateway.Format("%d.%d.%d.%d",p[3],p[2],p[1],p[0]);
	this->strHostMAc.Format("%.2X-%.2X-%.2X-%.2X-%.2X-%.2X",this->bLocalMac[0],this->bLocalMac[1],this->bLocalMac[2],this->bLocalMac[3],this->bLocalMac[4],this->bLocalMac[5]);
	
	this->UpdateData(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CArpScanDlg::OnOK()
{
	// TODO: 在此添加专用代码和/或调用基类
	this->OnBnClickedSlowScan();
	//CDialog::OnOK();
}

⌨️ 快捷键说明

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