zxhyxwwu 2015-06-05 02:45 采纳率: 0%
浏览 3721
已结题

应用层代理如何获取wfp实现的连接重定向的原始的连接地址

any helps will be thanks!

I have searched a lot of question,but still can't find a real answer,my goal is to get the original connect address.Some body suggest to walk previousVersion in FWPS_CONNECT_REQUEST0 structure,but not point how to walk and how to make it work,also how to access it in user mode or proxy service.I have known how to query the original connect address in windows 8,but I have no idea about windows 7.I have made the code like this:

 #if(NTDDI_VERSION >= NTDDI_WIN8)

    //SOCKADDR_STORAGE*     pSockAddrStorage = 0;

    if((*ppRedirectData)->redirectHandle)
        pConnectRequest->localRedirectHandle = (*ppRedirectData)->redirectHandle;

    HLPR_NEW_ARRAY(pSockAddrStorage,
        SOCKADDR_STORAGE,
        2,
        TUNNEL_CALLOUT_DRIVER_TAG);
    HLPR_BAIL_ON_ALLOC_FAILURE(pSockAddrStorage,
        status);

    /// Pass original remote destination values to query them in user mode
    RtlCopyMemory(&(pSockAddrStorage[0]),
        &(pConnectRequest->remoteAddressAndPort),
        sizeof(SOCKADDR_STORAGE));

    RtlCopyMemory(&(pSockAddrStorage[1]),
        &(pConnectRequest->localAddressAndPort),
        sizeof(SOCKADDR_STORAGE));

    /// WFP will take ownership of this memory and free it when the flow / redirection terminates
    pConnectRequest->localRedirectContext     = pSockAddrStorage;
    pConnectRequest->localRedirectContextSize = sizeof(SOCKADDR_STORAGE) * 2;

#endif

But I don't know how to coding on windows 7,because everybody knows on windows 7,the code of pConnectRequest->localRedirectContext is unaccessable.Is any body have any idea?thanks very much!

Also,I want to show my idea,on windows 7,I solve this question like this:store the original address by myself in drivers,after the proxy accept a connect from drivers redirect,I get the tcp source port,and I use the tcp source port to query in drivers by using DeviceControl function,but if the system have kaspersky software working,the tcp source port will be changed by kaspersky,so I can't get the right tcp source port,and ofcourse the proxy can't work correct.

  • 写回答

2条回答 默认 最新

  • zxhyxwwu 2015-06-05 06:43
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?