阅读:1047回复:0
ipfilter数据包不全的问题
我做了一个Ipfilter的驱动程序,我想拦截受邮件时收到的所有数据包,并把他显示出来。但是,我发现不能拦所有的数据包,下面是我拦截的代码:
*********************************************************** *********************************************************** *********************************************************** if( iph->ipProtocol == 6 ) { tcph=(TCPHeader *)Packet; port = ntohs( tcph->sourcePort ); cbSize = PacketLength - sizeof(TCPHeader); if( port == 110 ) { dprintf("recv [[*%d*]] bytes pop3 data from IP:[[*%x*]]<-->Port:[[*%d*]]", cbSize, iph->ipSource, port); pBuffer = (PCHAR)ExAllocatePool( NonPagedPool, cbSize + 1 ); RtlCopyMemory( pBuffer, Packet + sizeof(TCPHeader), cbSize); pBuffer[ cbSize ] = '\0'; dprintf( "%s", pBuffer ); ExFreePool( pBuffer ); } } *********************************************************** *********************************************************** *********************************************************** 拦截时的情景: 我在cmd下的操作如下: +OK POP3 ready +OK +OK authorization succeeded (eyou mta) +OK 1 500 2 500 . -ERR unimplemented (eyou mta) +OK Received: (eyou send program); Wed, 03 Mar 2004 21:37:09 +0800 Message-ID: <278321029.56488@mail.sdu.edu.cn> Received: from 211.87.213.78 by mail.sdu.edu.cn with HTTP; Wed, 03 Mar 2004 21:3 7:09 +0800 X-WebMAIL-MUA: [211.87.213.78] From: "相建亭" <x_j_ting@mail.sdu.edu.cn> To: x_j_ting@mail.sdu.edu.cn Date: Wed, 03 Mar 2004 21:37:09 +0800 Return-Path: "相建亭" <x_j_ting@mail.sdu.edu.cn> Reply-To: "相建亭" <x_j_ting@mail.sdu.edu.cn> Subject: AAAAAAAAAAAA Content-Type: text/plain BBBBBBBBBBBBBB . *********************************************************** *********************************************************** *********************************************************** 在dbgview下的输出如下: 00000000 0.00000000 recv [[*4*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000001 0.00001620 ] 00000002 0.00174994 recv [[*16*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000003 0.00176950 +OK POP3 ready 00000004 10.12698709 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000005 10.31700118 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000006 10.42714395 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000007 10.52707593 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000008 10.71719227 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000009 11.07712656 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000010 11.29699305 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000011 11.47729502 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000012 11.58708383 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000013 11.86754406 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000014 11.96717264 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000015 12.06726833 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000016 12.19428615 recv [[*6*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000017 12.19430263 +OK 00000018 13.45732852 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000019 13.58725676 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000020 13.80725288 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000021 13.94760926 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000022 14.12736842 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000023 14.44750073 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000024 14.54718575 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000025 14.64715767 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000026 14.74747712 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000027 14.84726299 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000028 14.85236504 recv [[*40*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000029 14.85237565 +OK authorization succeeded (eyou mta) 00000030 16.15737643 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000031 16.36716398 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000032 16.46742030 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000033 16.57728426 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000034 16.63061814 recv [[*6*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000035 16.63063546 +OK 00000036 16.82950012 recv [[*17*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000037 16.82951716 1 500 00000038 16.82952275 2 500 00000039 16.82952833 . 00000040 18.31722328 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000041 18.47759226 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000042 18.58724335 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000043 18.93734623 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000044 19.53748060 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000045 20.53744373 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000046 20.88742200 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000047 21.04736803 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000048 21.18696706 recv [[*18*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000049 21.18698494 -ERR unimplemented 00000050 21.34351042 recv [[*13*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000051 21.34352690 (eyou mta) 00000052 22.60859523 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000053 22.75765216 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000054 22.89756463 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000055 23.70776705 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000056 24.01739914 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000057 24.28756392 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000058 24.56396888 recv [[*6*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000059 24.56398593 +OK 00000060 24.75474760 recv [[*88*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000061 24.75476604 Received: (eyou send program); Wed, 03 Mar 2004 21:37:09 +0800 00000062 24.75477191 Message-ID: <278321029.5 00000063 144.57162544 recv [[*25*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000064 144.57164332 -ERR timeout (eyou mta) 00000065 144.57170478 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] 00000066 144.57307060 recv [[*0*]] bytes pop3 data from IP:[[*80fc2ca*]]<-->Port:[[*110*]] *********************************************************** *********************************************************** *********************************************************** *********************************************************** 请大家为我分析一下怎么回事啊?谢谢了。 |
|