|
|
 |
 |
|
|
 |
|
sniffer技术原理及应用(1)
|
|
|
|
编辑:华夏媒体 作者:未知 来源:网络 时间:2006-07-29 总浏览量:1535 |
|
文字大小:[ 大 中 小 ]
文字颜色: 双击滚屏/单击停止 |
|
[上一页] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [下一页]
|
computers connected to the internet " 我们并不知道这项专利的价值,也不知道他是否能用在包过滤上。详情请参阅:http://www.
uspto.gov/patft/index.html www.pcausa.com
============================================ drvipflt具体解析,就是上面所提到的吧(2-3就是说的这东东)。 假定大家对驱动框架已经有了一定的理解。IRP分配程序如下: NTSTATUS DrvDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { ... switch (irpStack->MajorFunction) { ... case IRP_MJ_DEVICE_CONTROL: ioControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;
switch (ioControlCode) { // ioctl code to start filtering //这里可以从用户模式程序发送这样的请求。 //直接用DeviceIoControl这个函数,就像下面这样调用就可
以了吧,我想。
//DeviceIoControl(drivehandle,START_IP_HOOK,NULL,0,NULL,0,&bytereturned,NU
LL) case START_IP_HOOK: { //这个应该是最主要的函数了。 SetFilterFunction(cbFilterFunction);
break; }
// ioctl to stop filtering case STOP_IP_HOOK: { SetFilterFunction(NULL); break; }
// ioctl to add a filter rule case ADD_FILTER: { if(inputBufferLength == sizeof(IPFilter)) { IPFilter *nf;
nf = (IPFilter *)ioBuffer; AddFilterToList(nf); }
break; }
// ioctl to free filter rule list case CLEAR_FILTER: { ClearFilterList();
break; }
default: Irp->IoStatus.Status =
STATUS_INVALID_PARAMETER;
break; }
break; ... } SetFilterFunction(cbFilterFunction)可能是最重要的一个程序了。具体如下: 实际上这个做法相当在系统中注册了一个回调函数。 NTSTATUS SetFilterFunction(PacketFilterExtensionPtr filterFunction) { NTSTATUS status = STATUS_SUCCESS, waitStatus=STATUS_SUCCESS; UNICODE_STRING filterName; PDEVICE_OBJECT ipDeviceObject=NULL; PFILE_OBJECT ipFileObject=NULL;
|
|
[上一页] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [下一页]
|
|
|
打印 收藏 关闭 至顶部 |
|
 |
|