資源簡介
這是一個網絡嗅探器源代碼,可以利用winpcap進行數據包的抓取和分析,還可以進行數據包的重組,甚至還有文檔,感興趣的人可以學習一下的

代碼片段和文件信息
//?ARPGram.cpp:?implementation?of?the?ARPGram?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“snifferpro.h“
#include?“ARPGram.h“
#ifdef?_DEBUG
#undef?THIS_FILE
static?char?THIS_FILE[]=__FILE__;
#define?new?DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
ARPGram::ARPGram()
{
}
ARPGram::ARPGram(const?unsigned?char?*bufunsigned?int?buflen)
{
unsigned?char?*pos=(unsigned?char?*)buf;
hdwaddrtype=(*pos)*0x100+(*(pos+1));
pos+=2;
prtaddrtype=(*pos)*0x100+(*(pos+1));
pos+=2;
hdwaddrlen=(*pos);
pos++;
prtaddrlen=(*pos);
pos++;
operation=(*pos)*0x100+(*(pos+1));
pos+=2;
for(int?i=0;i<6;i++){
srchdwaddr[i]=BYTE(*pos);
pos++;
}
srcprtaddr=(*pos)*0x1000000+(*(pos+1))*0x10000+(*(pos+2))*0x100+(*(pos+3));
pos+=4;
for(i=0;i<6;i++){
desthdwaddr[i]=BYTE(*pos);
pos++;
}
destprtaddr=(*pos)*0x1000000+(*(pos+1))*0x10000+(*(pos+2))*0x100+(*(pos+3));
}
ARPGram::~ARPGram()
{
}
CString?ARPGram::GetSrcHdwAddr()
{
CString?str;
str.Format(“%02X:%02X:%02X:%02X:%02X:%02X“srchdwaddr[0]srchdwaddr[1]srchdwaddr[2]srchdwaddr[3]srchdwaddr[4]srchdwaddr[5]);
return?str;
}
CString?ARPGram::GetSrcPrtAddr()
{
CString?str;
unsigned?char?*p;
p=(unsigned?char?*)&srcprtaddr;
str.Format(“%003u.%003u.%003u.%003u“p[3]p[2]p[1]p[0]);
return?str;
}
CString?ARPGram::GetDestHdwAddr()
{
CString?str;
str.Format(“%02X:%02X:%02X:%02X:%02X:%02X“desthdwaddr[0]desthdwaddr[1]desthdwaddr[2]desthdwaddr[3]desthdwaddr[4]desthdwaddr[5]);
return?str;
}
CString?ARPGram::GetDestPrtAddr()
{
CString?str;
unsigned?char?*p;
p=(unsigned?char?*)&destprtaddr;
str.Format(“%003u.%003u.%003u.%003u“p[3]p[2]p[1]p[0]);
return?str;
}
CString?ARPGram::GetOperation()
{
CString?str;
switch(this->operation){
case?1:
str.Format(“ARP?Request“);
break;
case?2:
str.Format(“ARP?Reply“);
break;
default:
str.Format(““);
}
return?str;
}
CString?ARPGram::GetPrtType()
{
CString?str;
switch(prtaddrtype){
case?0x0800:
str.Format(“IP“);
break;
default:
str.Format(““);
}
return?str;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2362??2003-04-12?10:04??SnifferPro\ARPGram.cpp
?????文件???????1026??2003-04-11?14:53??SnifferPro\ARPGram.h
?????文件???????6007??2003-04-12?19:32??SnifferPro\ContentView.cpp
?????文件???????1725??2003-04-07?12:50??SnifferPro\ContentView.h
?????文件???????6208??2003-04-15?16:46??SnifferPro\DlgAdp.cpp
?????文件???????1622??2003-04-09?21:19??SnifferPro\DlgAdp.h
?????文件???????5675??2003-04-17?00:17??SnifferPro\DlgFlt.cpp
?????文件???????1940??2003-04-06?16:22??SnifferPro\DlgFlt.h
?????文件???????1161??2003-04-07?00:38??SnifferPro\DlgRea.cpp
?????文件???????1236??2003-04-07?00:38??SnifferPro\DlgRea.h
?????文件???????1839??2003-04-12?09:56??SnifferPro\EtherHead.cpp
?????文件????????808??2003-04-18?10:23??SnifferPro\EtherHead.h
?????文件???????5355??2003-04-10?12:46??SnifferPro\ICMPGram.cpp
?????文件???????1041??2003-04-14?16:36??SnifferPro\ICMPGram.h
?????文件???????3590??2003-04-13?00:02??SnifferPro\IPGram.cpp
?????文件???????1337??2003-04-14?16:57??SnifferPro\IPGram.h
?????文件??????17779??2003-04-20?22:08??SnifferPro\MainFrm.cpp
?????文件???????3687??2003-04-15?21:25??SnifferPro\MainFrm.h
?????文件???????6673??2003-04-15?21:22??SnifferPro\MulPackView.cpp
?????文件???????2221??2003-04-15?21:21??SnifferPro\MulPackView.h
?????文件???????2699??2003-04-15?00:29??SnifferPro\MyListCtrl.cpp
?????文件???????1242??2003-04-13?11:55??SnifferPro\MyListCtrl.h
?????文件???????2390??2003-04-14?14:52??SnifferPro\ProgBar.cpp
?????文件????????784??2003-04-14?14:47??SnifferPro\ProgBar.h
?????文件???????2381??2003-04-12?10:05??SnifferPro\RARPGram.cpp
?????文件???????1046??2003-04-14?16:39??SnifferPro\RARPGram.h
?????文件???????4407??2003-03-30?23:26??SnifferPro\ReadMe.txt
?????文件???????1078??2000-11-20?22:09??SnifferPro\res\addmc++websvc.ico
?????文件???????2238??2001-12-15?12:41??SnifferPro\res\FirstSteps.ico
?????文件???????1078??2003-04-01?00:24??SnifferPro\res\ico00001.ico
............此處省略50個文件信息
評論
共有 條評論