阅读:4895回复:10
windows下编程怎么样把网卡设成混杂模式啊。
windows下编程怎么样把网卡设成混杂模式啊。
|
|
最新喜欢:bsd43 |
论坛版主
|
沙发#
发布于:2004-01-09 12:18
哈哈,兄弟,那边也有一个发了N次这个问题了,怎么没有高手来回答啊,WIN倒是有工具可以设,但是你自己的代码可能用不上。靠天靠地不如靠自己:),你用的NIC的片子的DATASHEET找得到不,查查,你试试设置它的控制寄存器,可能就一位就好
|
|
板凳#
发布于:2004-01-09 13:34
是啊。郁闷的啊。
linux下就很容易设 不知道这个windows搞什么鬼 |
|
论坛版主
|
地板#
发布于:2004-01-09 21:29
?LINUX有专门的API设这个?LINUX底下你直接操作NIC的寄存器不?为什么不试试直接操作呢?
|
|
地下室#
发布于:2004-01-11 17:35
linux 下有一个结构啊/。
nic是什么东东啊。 请指教。 |
|
论坛版主
|
5楼#
发布于:2004-01-12 17:31
NETWORK INTERFACE CARD
那就是有专门的API可以提供这个功能了:),刚才看到KERNEL讨论区那边有一个贴子说他可以设成混杂模式了,那位兄弟叫pzqxidian,不过他的是无线网卡,也就是MAC控制器不一样,原理一样的,你找他请教请教吧:),祝兄弟新年快乐! |
|
6楼#
发布于:2004-01-14 08:47
谢谢,,,也祝你新年快乐。
我已找到了方法。 我在试呢.嘿嘿。。。 |
|
7楼#
发布于:2004-03-30 17:43
装个winpcap就可以了。
|
|
8楼#
发布于:2004-04-14 11:09
使用Winsock 2.0 API函数: WSAIoctl
The Windows Sockets WSAIoctl function controls the mode of a socket. int WSAIoctl( SOCKET s, DWORD dwIoControlCode, LPVOID lpvInBuffer, DWORD cbInBuffer, LPVOID lpvOutBuffer, DWORD cbOutBuffer, LPDWORD lpcbBytesReturned, LPWSAOVERLAPPED lpOverlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); SIO_RCVALL Enables a socket to receive all IP packets on the network. The socket handle passed to the WSAIoctl function must be of AF_INET address family, SOCK_RAW socket type, and IPPROTO_IP protocol. The socket also must be bound to an explicit local interface, which means that you cannot bind to INADDR_ANY. Once the socket is bound and the ioctl set, calls to the WSARecv or recv functions return IP datagrams passing through the given interface. Note that you must supply a sufficiently large buffer. Setting this ioctl requires Administrator privilege on the local machine. SIO_RCVALL is available in Windows 2000 and later versions of Windows. 使用方法: iErrorCode=WSAIoctl(SockRaw,SIO_RCVALL,&dwBufferInLen,sizeof(dwBufferInLen), &dwBufferLen,sizeof(dwBufferLen),&dwBytesReturned,NULL,NULL); 记得需要要定义(platform SDK中有MsTcpIp.h头文件),不然会出现错误: SIO_RCVALL : undeclared identifier 定义如下: // Copyright (c) Microsoft Corporation. All rights reserved. #if _MSC_VER > 1000 #pragma once #endif /* Argument structure for SIO_KEEPALIVE_VALS */ struct tcp_keepalive { u_long onoff; u_long keepalivetime; u_long keepaliveinterval; }; // New WSAIoctl Options #define SIO_RCVALL _WSAIOW(IOC_VENDOR,1) #define SIO_RCVALL_MCAST _WSAIOW(IOC_VENDOR,2) #define SIO_RCVALL_IGMPMCAST _WSAIOW(IOC_VENDOR,3) #define SIO_KEEPALIVE_VALS _WSAIOW(IOC_VENDOR,4) #define SIO_ABSORB_RTRALERT _WSAIOW(IOC_VENDOR,5) #define SIO_UCAST_IF _WSAIOW(IOC_VENDOR,6) #define SIO_LIMIT_BROADCASTS _WSAIOW(IOC_VENDOR,7) #define SIO_INDEX_BIND _WSAIOW(IOC_VENDOR,8) #define SIO_INDEX_MCASTIF _WSAIOW(IOC_VENDOR,9) #define SIO_INDEX_ADD_MCAST _WSAIOW(IOC_VENDOR,10) #define SIO_INDEX_DEL_MCAST _WSAIOW(IOC_VENDOR,11) // Values for use with SIO_RCVALL* options #define RCVALL_OFF 0 #define RCVALL_ON 1 #define RCVALL_SOCKETLEVELONLY 2 更详细请查 MSDN!!!!!!!!! |
|
|
9楼#
发布于:2004-05-12 09:50
标准bsd网络函数都支持,一个标志位就可以了
|
|
10楼#
发布于:2004-05-13 09:12
win2000以上都支持raw socket,但只能获取IP层的数据,不能获取Ethernet层的数据
还有可以用Winpcap,很方便的切换到混杂模式 http://winpcap.polito.it/ 还有DDK的sample中有个混杂模式的例子 |
|
|