【正文】
as if a man that negotiates between two pr。 beaucoup de bruit, peu de fruit: much bruit, little fruit Yet certainly there is use of this quality, in civil affairs. Where there is an opinion, and fame to be created, either of virtue, or greatness, these men are good trumpeters. Again, as Titus Livius noteth, in the case of Antiochus, and the Aetolians。 for all bravery stands upon parisons. They must needs be violent, to make good their own vaunts. Neithe r can they be secret, and therefore not effectual。 but we have a wild journey, also which is national and modern, and that is the journey to Amack on the night of the New Year. All indifferent poets and poetesses, musicians, newspaper writers, and artistic notabilities, I mean those who are no good, ride in the New Year39。t know what that is! The journey of the witches on broomsticks is well enough known that journey is taken on St. John39。s eve I was reading the book, and had lost myself in it so pletely, that I fot my usual New Year39。 the fly sat upon the axletree of the chariot wheel, and said. What a dust do I raise? So are there some vain persons, that whatsoever goeths indeed! They could tell us something worth hearing, if they only knew how to talk. It39。 除非另有科研合同和其他法律文書的制約,本論文的科研成果屬于成都信息工程學(xué)院。 ( 4)學(xué)校可允許學(xué)位論文被查閱或借閱。 ( 2)學(xué)??梢圆捎糜坝?、縮印或其他復(fù)制方式保存學(xué)位論文。除非另有說明,本文的工作是原始性工作。在此向他表示我最衷心的感謝! 在論文完成過程中,本人還得到了張仕斌老師和陳偉同學(xué)的熱心幫助,本人向他們表示深深的謝意! 最后向在百忙之中評審本文的各位專家、老師表示衷心的感謝! 作者簡介: 姓 名:鄭 莉 性別:女 出生年月: 1985 年 1 月 民族: 漢 Email: 聲 明 本論文的工作是 2021 年 2 月至 2021 年 6 月在成都信息工程學(xué)院 系完成的。 [8] 孫晶艷 .面向校園網(wǎng)的網(wǎng) 絡(luò)監(jiān)聽技術(shù)研究 [D].黑龍江:哈爾濱工業(yè)大學(xué) [碩士論文 ],2021。 [6] 劉勝斐 .多 Agent 分布式入侵檢測系統(tǒng)中通信機制和數(shù)據(jù)分析方法研究 [D].江蘇:南開大學(xué) [碩士論文 ], 2021。 [4] 劉志祥 . Linux系統(tǒng)安全性研究及其新型 Sniffer設(shè)計與實現(xiàn) [D]. 南昌:南昌大學(xué) [碩士論文 ], 2021。 [2] 鄭莉,董淵 .C++語言程序設(shè)計(第二版) [M].北京:清華大學(xué)出版社, 2021。 通過對該課題的研究,讓我對嗅探技術(shù)有了進一步的了解,對其兩面性在網(wǎng)絡(luò)中產(chǎn)生的影響有了更深的認識,為了打破以上局限性,還需要結(jié)合已學(xué)知識對網(wǎng)絡(luò)嗅探技術(shù)方面的知識作進一步的學(xué)習(xí)。設(shè)計完成后經(jīng)測試能實現(xiàn)預(yù)期要求的功能。由圖 47 可以觀察到捕獲模塊能夠?qū)崿F(xiàn)將網(wǎng)絡(luò)接口設(shè)置為混雜模式,同時捕獲局域網(wǎng)內(nèi)的數(shù)據(jù)包,在這里還可以觀察到網(wǎng)絡(luò)狀態(tài)及網(wǎng)絡(luò)數(shù)據(jù)的流動情況,供網(wǎng)絡(luò)分析之用。 } m_ctrList 是與列表控件 關(guān)聯(lián)的一個變量,列表控件用于顯示對數(shù)據(jù)包的分析結(jié)果。 (index,5,LVIF_TEXT,s5, 0, 0, 0,0)。 (index,3,LVIF_TEXT,s3, 0, 0, 0,0)。 (index,1,LVIF_TEXT,s1, 0, 0, 0,0)。 ... 數(shù)據(jù)的顯示 在完成了數(shù)據(jù)包的捕獲、分析后,我們使用 AddData 函數(shù),調(diào)用列表控件變量使分析結(jié)果顯 示在界面的列表中,結(jié)果輸出代碼如下: void CIpmonDlg::AddData(CString s0,CString s1, CString s2, CString s3, CString s4, CString s5, CString s6) { int index。 (%d,totallen)。 } } if(pIpHeaderproto == IPPROTO_ICMP) (type:%d code:%d data:%s,pICMPHeadType,pICMPHeadCode,pdata)。 totallen = UDP_HEAD_LEN。 (%d,destport)。 destport = ntohs(pUDPHeadDestPort)。 } case IPPROTO_UDP: { pUDPHead=(struct UDPPacketHead *)(buf+HdrLen)。 totallen = HdrLen。 HdrLen *= 4。 (%d,destport)。 destport = ntohs(pTCPHeadDestPort)。 } case IPPROTO_TCP: { pTCPHead=(struct TCPPacketHead *)(buf+HdrLen)。 totallen = ICMP_HEAD_LEN。 strDestPort = 。 switch(pIpHeaderproto)//分析包的類型 { case IPPROTO_ICMP: { pICMPHead=(structICMPPacketHead*)(buf+HdrLen)。 totallen = ntohs(pIpHeadertotal_len)。0xf。 strProto = get_proto_name( pIpHeaderproto )。 strcpy( szDest , pDest ) 。//得到源 IP地址 = pIpHeaderdestIP 。 pSource = i_ntoa( ina ) 。 WORD iLen = ntohs(pIpHeadertotal_len) 。 } else if( *buf ) { bufwork = buf 。 sprintf( szErr , Error recv() = %ld , dwErr ) 。 如圖46 所示: 圖 46 數(shù)據(jù)包解析的簡單流程 圖 46所示為 數(shù)據(jù)包的解析模塊 ,該模塊對捕獲的數(shù)據(jù)包進行拆包分析, 根據(jù)不同的協(xié)議類型 分析其 IP地址,數(shù)據(jù)包大小,端口號等,具體代碼實現(xiàn)如下: UINT threadFunc ( LPVOID p ) { ... iRet = recv( pDlgm_s , buf , sizeof( buf ) , 0 ) 。//接收數(shù)據(jù) ...... 數(shù)據(jù)包 的解析 數(shù)據(jù)包被捕獲后 然后就可以根據(jù)前面對 IP 數(shù)據(jù)段頭、 TCP 數(shù)據(jù)段頭的結(jié)構(gòu)描述而對捕獲的數(shù)據(jù)包進行分析 。 } memset( buf , 0 , sizeof(buf) ) 。 pDlg(TRUE) 。msg , 0 , WM_CLOSE,WM_CLOSE,PM_NOREMOVE ) ) { closesocket( pDlgm_s ) 。 pDlgm_threadID = GetCurrentThreadId() 。 PeekMessage(amp。 struct UDPPacketHead *pUDPHead。 struct TCPPacketHead *pTCPHead。 int HdrLen, totallen。 char szSource [16] , szDest[16] , szErr [ 50 ]。 IPHEADER *pIpHeader 。 DWORD dwErr 。 MSG msg 。 前面的工作基本上都是對原始套接字進行設(shè)置,在將原始套接字設(shè)置完畢,使其能按預(yù)期目的工作時,就可以通過 recv()函數(shù)從網(wǎng)卡接收數(shù)據(jù)了,接收到的原始數(shù)據(jù)包存放在緩存 區(qū) 中 ,具體的實現(xiàn) 代碼如下: UINT threadFunc ( LPVOID p ) { CIpmonDlg *pDlg = static_castCIpmonDlg *(p) 。dwBufferLen, sizeof(dwBufferLen), amp。 設(shè)置 SOCK_RAW 為 SIO_RCVALL,以便接收所有的 IP 包: WSAIoctl( m_s, SIO_RCVALL , amp。 使用 pHost = gethostbyname(szHostName)獲取本地 IP 地址 把原始套接字 m_s 綁定到本地網(wǎng)卡地址上,具體格式如下: bind(m_s,(PSOCKADDR)amp。 return 。 AfxMessageBox( szErr ) 。 else { dwErr = WSAGetLastError() 。dwBufferLen, sizeof(dwBufferLen), amp。 } if(SOCKET_ERROR!=WSAIoctl(m_s,SIO_RCVALL , amp。 closesocket( m_s ) 。 sprintf( szErr , Error bind() = %ld , dwErr ) 。 //socket(本機 )地址 if (bind(m_s,(PSOCKADDR)amp。 //inter 協(xié)議簇 = htons(7000)。 return 。 AfxMessageBox( szErr ) 。rcvtimeo , sizeof(rcvtimeo) ) == SOCKET_ERROR)//設(shè)置工作模式 { dwErr = WSAGetLastError() 。 } int rcvtimeo = 5000 。 closesocket( m_s ) 。 sprintf( szErr , Error socket() = %ld , dwErr ) 。 m_s = socket( AF_INET , SOCK_RAW , IPPROTO_IP ) 。 DWORD dwBufferInLen= 1 。 } return 。 SetDlgItemText(IDC_LOOKUP,開始捕獲 !)。 if( 0 == m_threadID ) { SetDlgItemText(IDC_LOOKUP,停止捕獲 ! )。//獲取主機名 m_iphostsource = m_ipsource 。 SOCKADDR_IN sa。 在捕獲數(shù)據(jù)包前,首先對原始套接字進行設(shè)置,代碼如下: void CIpmonDlg::OnLookUp() { char szErr [ 50 ] , szHostName[MAX_PATH]。 //32 位目的 IP 地址 }IPHEADER; 數(shù)據(jù)包捕獲 程序設(shè)計 根據(jù)前面的設(shè)計思路, 本文在 windows 平臺下實現(xiàn)了一個嗅探器程序,開發(fā)工具使用 v