資源簡介
華中科技大學2018計算機網絡安全實驗源碼,實現了數據包抓取分析以及arp攻擊實現中間人攻擊。

代碼片段和文件信息
#include?“arpcheatdialog.h“
#include?“ui_arpcheatdialog.h“
#include?
#include?
#include?
ArpCheatDialog::ArpCheatDialog(QWidget?*parent)?:
????QDialog(parent)
????ui(new?Ui::ArpCheatDialog)
{
????ui->setupUi(this);
????this->setWindowtitle(“Arp?Cheat“);
????this->setWindowIcon(QIcon(“:/cybereye.jpg“));
????this->interface_index?=?netDeviceNum;
????adhandle?=?NULL;
????alldevs?=?NULL;
????arpcheatthread?=?NULL;
????sendpktthread?=?NULL;
????ui->targetIp->setPlaceholderText(tr(“Enter?Target?IP?address“));//?背景提示文字
????ui->targetIp->setstyleSheet(“border-radius:?3px“);?//?設置圓角
????ui->targetMac->setPlaceholderText(tr(“Enter?Target?MAC?address“));//?背景提示文字
????ui->targetMac->setstyleSheet(“border-radius:?3px“);?//?設置圓角
????ui->gateIp->setPlaceholderText(tr(“Enter?Gate?IP?address“));//背景提示文字
????ui->gateIp->setstyleSheet(“border-radius:?3px“);?//?設置圓角
????ui->gateMac->setPlaceholderText(tr(“Enter?Gate?MAC?address“));//背景提示文字
????ui->gateMac->setstyleSheet(“border-radius:?3px“);?//?設置圓角
????ui->stopBtn->setEnabled(false);
}
ArpCheatDialog::~ArpCheatDialog()
{
????delete?ui;
}
void?ArpCheatDialog::on_startBtn_clicked()
{
????ui->startBtn->setEnabled(false);
????ui->stopBtn->setEnabled(true);
????ui->textBrowser->clear();
????initDev(interface_index);
????//獲取當前網卡MAC地址
????selfmac?=?GetSelfMac(dev->name?+?8); //+8以去掉“rpcap://“
????destip?=?ui->targetIp->text();
????destmac?=?ui->targetMac->text();
????gateip?=?ui->gateIp->text();
????gatemac?=?ui->gateMac->text();
????if(!(destip?!=?NULL?&&?destmac?!=?NULL?&&?gateip?!=?NULL?&&?gatemac?!=?NULL)){
????????QMessageBox::warning(this?“Cheating?Error“?tr(“請輸入完整信息,MAC地址可以通過arp緩存表獲得“)?QMessageBox::Ok);
????????return;
????}
????if(arpcheatthread?!=?NULL){
????????delete?arpcheatthread;
????????arpcheatthread?=?NULL;
????}
????arpcheatthread?=?new?ArpCheatThread();
????connect(this?SIGNAL(setCheatInfo(pcap_t*?u_char*u_longu_char*u_longu_char*))?arpcheatthread?SLOT(getCheatInfo(pcap_t*?u_char*u_longu_char*u_longu_char*)));
????connect(arpcheatthread?SIGNAL(sendLogMsg(QString))?this?SLOT(slotUpdateEdit(QString)));
????//對輸入IP進行轉換
????const?char?*destipStr;
????QByteArray?ba?=?destip.toLatin1();
????destipStr?=?ba.data();
????deli_destip?=?inet_addr(destipStr);
????if(deli_destip?==?INADDR_NONE){
????????QMessageBox::warning(this?“Cheat?Error“?tr(“目標IP為無效輸入!“)?QMessageBox::Ok);
????????return;
????}
????const?char?*gateipStr;
????ba?=?gateip.toLatin1();
????gateipStr?=?ba.data();
????deli_gateip?=?inet_addr(gateipStr);
????if(deli_gateip?==?INADDR_NONE){
????????QMessageBox::warning(this?“Cheat?Error“?tr(“網關IP為無效輸入!“)?QMessageBox::Ok);
????????return;
????}
????//對輸入MAC地址進行轉換
????const?char?*destMacStr;
????ba?=?destmac.toLatin1();
????destMacStr?=?ba.data();
????deli_destmac?=?(u_char?*)malloc(6?*?sizeof(u_char));????????//注意釋放malloc內存
????transMac(destMacStr?deli_destmac);
?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-07-04?12:02??Sniffer-Master\
?????文件????????1538??2018-05-10?09:50??Sniffer-Master\Sniffer-Master.pro
?????文件???????23821??2018-07-02?17:03??Sniffer-Master\Sniffer-Master.pro.user
?????文件???????23216??2013-02-24?21:47??Sniffer-Master\aboutqt.png
?????文件????????8209??2018-05-10?12:23??Sniffer-Master\arpcheatdialog.cpp
?????文件????????1842??2018-05-10?11:50??Sniffer-Master\arpcheatdialog.h
?????文件????????3357??2018-05-08?23:10??Sniffer-Master\arpcheatdialog.ui
?????文件????????2575??2018-05-10?11:57??Sniffer-Master\arpcheatthread.cpp
?????文件????????1039??2018-05-10?11:58??Sniffer-Master\arpcheatthread.h
?????文件????????1096??2018-05-09?10:35??Sniffer-Master\arphead.h
?????文件????????4804??2018-05-06?19:32??Sniffer-Master\capthread.cpp
?????文件?????????845??2018-05-10?11:58??Sniffer-Master\capthread.h
?????文件???????20083??2013-02-24?21:47??Sniffer-Master\cheat.png
?????文件???????61822??2018-05-09?15:02??Sniffer-Master\cybereye.jpg
?????文件???????26589??2013-02-24?21:47??Sniffer-Master\end.png
?????文件??????130994??2018-05-09?14:52??Sniffer-Master\icon.jpg
?????文件?????????183??2018-05-02?09:52??Sniffer-Master\main.cpp
?????文件???????39009??2018-05-09?15:04??Sniffer-Master\mainwindow.cpp
?????文件????????1922??2018-05-09?12:46??Sniffer-Master\mainwindow.h
?????文件????????9034??2018-05-05?22:06??Sniffer-Master\mainwindow.ui
?????文件???????17637??2013-02-24?21:47??Sniffer-Master\open.png
?????文件????????4255??2018-05-09?11:37??Sniffer-Master\protocol.h
?????文件?????????322??2018-05-09?15:03??Sniffer-Master\rs.qrc
?????文件???????20151??2013-02-24?21:47??Sniffer-Master\save.png
?????文件????????1763??2018-05-10?11:37??Sniffer-Master\sendpktthread.cpp
?????文件?????????903??2018-05-10?11:07??Sniffer-Master\sendpktthread.h
?????文件????????6864??2018-05-06?18:09??Sniffer-Master\utilities.cpp
?????文件?????????766??2018-05-06?16:47??Sniffer-Master\utilities.h
- 上一篇:單片機實現電子琴帶protues仿真
- 下一篇:文獻檢索實驗報告—計算機程序設計
評論
共有 條評論