IP-Adress Redirect?

Home Forums Discussions Support IP-Adress Redirect?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #5124
    kf
    Participant

      Hi, I’ve postet a topic in Windows Internal, maybe here is a better location for my problem:

      I want to redirect an outgoging dest. address to my own(192.168.1.9). All Messages are captured correctly.
      Without my code(program) the messages are sent/received perfectly. But with my code nothing no messages are received or sent.

      NEW EDIT

      So, the messages are sent, but there are some problems. I Capture the packages from port 80 and want to send these to an proxy (installed on an other computer in my network (192.168.1.8 )).
      If i handle the ip directly in firefox it works fine. But i want to handle that feature about Winpkfilter.

      Something seems to be wrong. I’ve a Ethernet output for you:
      http://www.imagehack.eu/uploads/01eec671ad.jpg

      Maybe there is a problem with the Port (3175)?

      Some Code:


      if( PacketBuffer.m_dwDeviceFlags == PACKET_FLAG_ON_SEND )
      {
      if( pTcpHeader->th_dport == htons (80) ||
      pTcpHeader->th_sport == htons (80) )
      {
      pIpHeader->ip_dst.S_un.S_addr = inet_addr("192.168.1.8");
      RecalculateIPChecksum( pIpHeader );
      RecalculateTCPChecksum( &PacketBuffer );
      }
      }
      [...]

      if ( PacketBuffer.m_dwDeviceFlags == PACKET_FLAG_ON_SEND )
      {

      // Place packet on the network interface
      api.SendPacketToAdapter(&Request);
      }
      else
      {
      // Indicate packet to MSTCP
      api.SendPacketToMstcp(&Request);
      }
      #6410
      kf
      Participant

        Maybe i’ve the problem:

        in may case i modify the ip-header – i change the destination requested IP (e.g. google.de) to my proxy(192.168.1.8).
        In that case i delete the orginal destination IP and the proxy do not know where the packages should be sent…..

        hmm.. Ok. But how can i say, that the package should first be sent to an other IP? (And how can i keep the orginal destionation IP?

        #6411
        Vadim Smirnov
        Keymaster

          1) In addition to IP address you also have to change the destination MAC address if proxy is located in the same network segment as you are.
          2) You have to memorize the connection {source IP, source port, original remote IP, original remote port, new remote IP, new remote port}. When receiving a response on the redirected packet you have to find the connection in your connections table by destination IP/port which in your table should match source IP/port and substitute source IP/port in the packet.

          #6412
          kf
          Participant

            Okay thx.

            The IP-Header stores the source and destination ip and port. if i capture a specific IP-Address (e.g. 66.127.13.23) and want to redirect the request over a proxy i change the destination ip to my proxy ip-address.

            But how does the proxy know, where the ip-packages should be sent? The original ip (here 66.127.13.23) is at the proxy not available?

            #6413
            Vadim Smirnov
            Keymaster

              That depends from proxy, if it is HTTP proxy there is no problem since HTTP GET request contains the exact URL.

              #6414
              kf
              Participant

                Hm okay, would try some things. Big thx for you help.

                Last-Question:
                How can i modify the destination MAC?

                In addition to IP address you also have to change the destination MAC

                #6415
                Vadim Smirnov
                Keymaster

                  How can i modify the destination MAC?

                  MAC header is right before IP header.

                  #6416
                  kf
                  Participant

                    ok thx. i think i got it.

                  Viewing 8 posts - 1 through 8 (of 8 total)
                  • You must be logged in to reply to this topic.