Home › Forums › Discussions › Support › IP-Adress Redirect?
- This topic has 7 replies, 2 voices, and was last updated 17 years, 3 months ago by kf.
-
AuthorPosts
-
August 13, 2007 at 7:40 pm #5124
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.jpgMaybe 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);
}
August 14, 2007 at 7:15 am #6410Maybe 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?
August 17, 2007 at 7:39 am #64111) 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.August 17, 2007 at 1:55 pm #6412Okay 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?
August 17, 2007 at 4:25 pm #6413That depends from proxy, if it is HTTP proxy there is no problem since HTTP GET request contains the exact URL.
August 18, 2007 at 2:01 am #6414Hm 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
August 18, 2007 at 8:16 am #6415How can i modify the destination MAC?
MAC header is right before IP header.
August 18, 2007 at 12:47 pm #6416ok thx. i think i got it.
-
AuthorPosts
- You must be logged in to reply to this topic.