这是一个IP重定向的驱动,基于IMD中间层

coded by kk

1。这重定向还是挺简单的,

只要是在发送的时候把目标地址改成要要重定向的IP

接收的时候,把源IP改成原本的目标IP地址即可

2。由于只是改IP地址,所以数据包长度不会变化,这样就不需要维护tcp seq序列号。容易多了。

3。完

下载地址

PS:我的那个CyberInterceptor工具里面的重定向并不是基于IMD的

windbg输出如下:

void dumphex(  void *pBuffer2, ULONG LEN)

{

ULONG i=0,j=0,space=0;

unsigned char *pBuffer=(unsigned char *)pBuffer2;

ULONGuoffset=0;

DbgPrint("\r\nBegin dumpping=========================\r\n");

DbgPrint("size: 0x%x\n", LEN);

DbgPrint("offset: ");

for (; i<16; i++)

{

DbgPrint("%X  ", i);

if ((i+1)%8==0)

{

DbgPrint(" ");

}

}

DbgPrint("\r\n%x\t ", (uoffset++)*0x10);

for (i=0; i<LEN; i++)

{

DbgPrint("%02x ", pBuffer[i]);

if ((i+1)%8==0)

{

DbgPrint(" ");

}

if ((i+1)%16==0)

{

DbgPrint(" |   ");

for (j= i-0xf; j!=i; j++)

{

if(pBuffer[j]==0xc || pBuffer[j]==0x0d)

{

DbgPrint(" ");

continue;

}

DbgPrint("%c", pBuffer[j]);

}

DbgPrint("\r\n%x\t ", (uoffset++)*0x10);

}

}

if (LEN%16!=0)

{

i =LEN%16;

space = 16-i;

space = space*2+space+1;

for (i=0; i<space; i++)

{

DbgPrint(" ");

}

DbgPrint(" |   ");

i =LEN%16;

for (j= LEN-i; j<LEN; j++)

{

if(pBuffer[j]==0xc || pBuffer[j]==0x0d)

{

DbgPrint(" ");

continue;

}

DbgPrint("%c", pBuffer[j]);

}

}

DbgPrint("\r\n");

DbgPrint("End dumpping=========================\r\n");

}

----------------------------

共享锁,宏使用

#define STARTLOCK(lock,WriteOrRead)\

if(1)\

{\

PLOCK_STATEpLockState1=NULL;\

pLockState1=kmalloc(sizeof(LO

朋友PowerTool 在写 TDI的时候,发现这函数虽然能拦截IRP请求获取,并替换掉(如果想HOOK),但却只能在netbt驱动加载之前加载自己的驱动,否则没戏, 所以TDI就动态加载就没法支持。刚好我也想写个东西,所以顺手研究了下,发现可以在XP和2K3下netbt把这个tcpip!TCPSendData函数指针放在一个比较固定的位置,如下:

XP环境

b2d4164c 0f8cf7440000    jl      netbt!NbtTdiOpenConnection+0x174 (b2d45b49)

b2d41652 8b4d0c          mov     ecx,dword ptr [ebp+0Ch]  //netbt的deviceobj(到时候要遍历)

b2d41655 8b89b4010000    mov     ecx,dword ptr [ecx+1B4h] //deviceobject+1B4处即为tcpip!TCPSendData函数指针,替换这个即可

b2d4165b 8b5508          mov     edx,dword ptr [ebp+8]

b2d4165e 894a64          mov     dword ptr [edx+64h],ecx

b2d41661 5f              pop     edi

b2d41662 5e              pop     esi

netbt生成了3个设备,其中2个设备是有tcpip!TCPSendData函数指针的,分别为:

NetBT_Tcpip_{4C3B9528-B1D7-40E6-BD83-22A7097EC44D}

NetbiosSmb

==================================================

2k3 Windows Server 2003 Enterprise Edition和上面XP一样,也是1B4

baedf8f7

如果Process->SeAuditProcessCreationInfo.ImageFileName有值,NULL掉,并ExFreePool了。

然后再遍历进程(简单zwqueryxxx即可),有神奇效果

PS:进程名先查找Process->SeAuditProcessCreationInfo.ImageFileName,如果为空则obquery获取,并赋值到Process->SeAuditProcessCreationInfo.ImageFileName中,上面获取方法都没成功才会直接取Process->ImageFileName