如何将机器的网卡设成混杂模式??(50分)

  • 主题发起人 主题发起人 maginnn
  • 开始时间 开始时间
M

maginnn

Unregistered / Unconfirmed
GUEST, unregistred user!
如何将机器的网卡设成混杂模式??
有delphi程序更好!!
 
Const
NDIS_PACKET_TYPE_DIRECTED =$0001;
NDIS_PACKET_TYPE_MULTICAST =$0002;
NDIS_PACKET_TYPE_ALL_MULTICAST =$0004;
NDIS_PACKET_TYPE_BROADCAST =$0008;
NDIS_PACKET_TYPE_SOURCE_ROUTING =$0010;
NDIS_PACKET_TYPE_PROMISCUOUS =$0020;
NDIS_PACKET_TYPE_SMT =$0040;
NDIS_PACKET_TYPE_MAC_FRAME =$8000;
NDIS_PACKET_TYPE_FUNCTIONAL =$4000;
NDIS_PACKET_TYPE_ALL_FUNCTIONAL =$2000;
NDIS_PACKET_TYPE_GROUP =$1000;

function SetOid(hVxD:THandle; ulOid,ulLength,data:ULong):PBYTE;
var
cbin,cbRet,a:DWord;
ioctl:ULong;
pOidData:PPACKET_OID_DATA;
begin
cbIn := sizeof(PACKET_OID_DATA) + ulLength;
pOidData:= PPACKET_OID_DATA(@InBuff);

if (ulOid = OID_GEN_CURRENT_PACKET_FILTER) then
ioctl := ULONG (IOCTL_PROTOCOL_SET_OID);

fillchar(InBuff, 0, cbIn+1);

pOidData.Oid := ulOid;
pOidData.Length := ulLength;
pOidData.Data[0] := UCHAR(data);

cbRet := QueryPacket( hVxD, ioctl, @InBuff, cbIn, @InBuff, cbIn );
result:=0;
end;

SetOid(hVxD, OID_GEN_CURRENT_PACKET_FILTER, 4, NDIS_PACKET_TYPE_PROMISCUOUS);
 
后退
顶部