资源简介

基于winpcap综合网络数据包扫描程序源代码。 http://hi.baidu.com/yanzi52351

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “.\arpfastscan.h“
#include “DataAndConst.h“

class Arp_Packet
{
public:
void set_arp_option(unsigned short usOpetion)
{
this->arppac->theArpHead.usOpetion=htons(usOpetion);
}
void fill_arp_source_ip(u_long sour)
{
this->arppac->theArpHead.dwSourecIP=htonl(sour);
}

void fill_arp_dest_ip(u_long dest)
{
this->arppac->theArpHead.dwDestIP=htonl(dest);
}

void fill_arp_dest_mac(void * dest)
{
memcpy((void*)(this->arppac->theArpHead.DestMac)(const void* )dest6);
}
void fill_arp_source_mac(void * source)
{
memcpy((void*)(this->arppac->theArpHead.SourceMac)(const void* )source6);
}
void fill_eth_source(void * source)
{
memcpy((void*) (this->arppac->theEthernetHead.bSourceMac)(const void*)source6);
}
void fill_eth_dest(void * dest)
{
memcpy((void*)(this->arppac->theEthernetHead.bDestMac)(const void*)dest6);
}
ArpPacket *arppac;

Arp_Packet()//默认包长度60
{
//buf=new unsigned char[60];
this->arppac=(ArpPacket *)buf;
for (int i=0;i<18;i++)
{
this->arppac->theArpHead.Padding[i]=0;
}
this->arppac->theEthernetHead.usEthernetType=htons(0x0806);
this->arppac->theArpHead.usHardWareType=htons(0x1);
this->arppac->theArpHead.usProtocolType=htons(0x0800);
this->arppac->theArpHead.ucMacLength=6;
this->arppac->theArpHead.ucProtocolLength=4;

}

~Arp_Packet()
{
//delete (this->buf);
}


void choose_eth_type(unsigned short type=0x0806)//默认值为0x0806
{
this->arppac->theEthernetHead.usEthernetType=htons(type);
}
void set_arp_hardware_type(u_short t=1)//默认值为1
{
this->arppac->theArpHead.usHardWareType=htons(t);
}
void set_arp_protocol_type(u_short t=0x0800)//默认值为0800
{
this->arppac->theArpHead.usProtocolType=htons(t);
}
void set_arp_hardware_len(unsigned char l=6)//默认值为6
{
this->arppac->theArpHead.ucMacLength=6;
}
void set_arp_protocol_len(unsigned char l=4)//默认值为4
{
this->arppac->theArpHead.ucProtocolLength=l;
}
private:
unsigned char buf[60];
};

DWORD WINAPI ArpFastSend(LPVOID pParament)
{
ThreadSyn cSynEntry;
pcap_if_t *pSelectDev;
ThreadParament * pThreadParament=(ThreadParament *)pParament;
pSelectDev=pThreadParament->SelectDev;
pcap_t *fp;
char error[256];
char bDestMac[6];
memset(bDestMac0xff6);
Arp_Packet thePacket;
thePacket.fill_arp_dest_mac(bDestMac);
thePacket.fill_arp_source_mac(pThreadParament->HostMac);
thePacket.fill_eth_dest(bDestMac);
thePacket.fill_eth_source(pThreadParament->HostMac);
thePacket.set_arp_option(1);
if((fp = pcap_open_live(pSelectDev->name 65536 1 1000 error) ) == NULL)
{
return 0;
}
for(DWORD dwIP=pThreadParament->dwOriginalIP;dwIP<=pThreadParament->dwLastIP&&!bStop;dwIP++)
{
thePacket.fill_arp_dest_ip(dwIP);
thePacket.fill_arp_source_ip(pThreadParament->dwHostIP);
Sleep(1);
pcap_sendpacket(fp(u_char *)(thePacket.arppac)60);
while(bPause)
{
Sleep(100);
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5095  2007-06-27 11:24  综合扫描程序\Code\ArpFastScan.cpp

     文件         60  2007-01-10 15:36  综合扫描程序\Code\ArpFastScan.h

     文件       2959  2007-01-12 13:45  综合扫描程序\Code\ArpScanDlg.cpp

     文件        842  2007-01-12 13:43  综合扫描程序\Code\ArpScanDlg.h

     文件        904  2007-01-13 22:27  综合扫描程序\Code\ArpSlowScan.cpp

     文件         44  2007-01-08 23:05  综合扫描程序\Code\ArpSlowScan.h

     文件      89008  2007-01-21 15:51  综合扫描程序\Code\BeastScaner.aps

     文件       1611  2007-01-07 20:28  综合扫描程序\Code\BeastScaner.cpp

     文件        467  2007-01-07 20:28  综合扫描程序\Code\BeastScaner.h

     文件    1018880  2007-06-27 12:32  综合扫描程序\Code\BeastScaner.ncb

     文件        911  2007-01-07 20:28  综合扫描程序\Code\BeastScaner.sln

     文件       9728  2007-06-27 12:32  综合扫描程序\Code\BeastScaner.suo

     文件       7240  2007-01-13 22:00  综合扫描程序\Code\BeastScaner.vcproj

     文件      17182  2007-01-13 22:05  综合扫描程序\Code\BeastScanerDlg.cpp

     文件       2111  2007-01-13 22:02  综合扫描程序\Code\BeastScanerDlg.h

     文件       1682  2007-01-10 15:34  综合扫描程序\Code\Choose.cpp

     文件        563  2007-01-10 14:50  综合扫描程序\Code\Choose.h

     文件       1581  2007-01-13 09:02  综合扫描程序\Code\DataAndConst.cpp

     文件       3416  2007-01-13 22:27  综合扫描程序\Code\DataAndConst.h

     文件       9798  2007-01-15 09:39  综合扫描程序\Code\IcmpAdvencedScan.cpp

     文件        153  2007-01-13 08:54  综合扫描程序\Code\IcmpAdvencedScan.h

     文件       3324  2007-01-20 11:52  综合扫描程序\Code\IcmpNormalScan.cpp

     文件         49  2007-01-09 08:02  综合扫描程序\Code\IcmpNormalScan.h

     文件       2940  2007-01-13 08:53  综合扫描程序\Code\IcmpScanDlg.cpp

     文件        840  2007-01-11 09:39  综合扫描程序\Code\IcmpScanDlg.h

     文件       3259  2007-01-09 12:35  综合扫描程序\Code\PortScanDlg.cpp

     文件       1015  2007-01-09 12:34  综合扫描程序\Code\PortScanDlg.h

     文件       2805  2007-01-07 20:28  综合扫描程序\Code\ReadMe.txt

     文件       2101  2007-01-21 15:47  综合扫描程序\Code\resource.h

     文件       1837  2007-01-13 22:02  综合扫描程序\Code\ScanHandler.cpp

............此处省略31个文件信息

评论

共有 条评论