Log in

View Full Version : Redirect IP Address


WillScram
January 18th, 2007, 17:34
I am working on a program that communicates with a server, however it doesn't resolve the address of the server so i can't use the host file to make it redirect to my local computer.

It is using a ip address, so i am wondering if there is a way to redirect a ip address in windows the same way you can redirect dns information with the host file.

Thanks.

Woodmann
January 18th, 2007, 20:40
Howdy,

Without knowing all the details, if it requires access to the server for verification, you will have to do a lot of work to make it functional.

Woodmann

PizzaPan
January 19th, 2007, 00:14
Sorry to bother, the server simply sends a reply to the program with a verification string, so i built a emulator that listens on the required port and i am sure it would work.

However the problem is i can't force the ip address that the application is looking for, to redirect to my localhost, if the program was simply getting the dns from a host i could modify the hosts file, but it doesn't.

Also i would like to stay away from actually modifying the server ip inside the program if at all possible, so i was looking for a way to make windows whenever it gets a request to visit ip 1.1.1.1 instead go to 2.2.2.2 etc.

Thanks.

PizzaPan
January 19th, 2007, 01:26
Sorry for the double post, also could you delete that account ?

I couldn't remember the email address i used for this account, but i got it back now, sorry!


LLXX
January 19th, 2007, 04:09
Google 'ip routing'

disavowed
January 20th, 2007, 12:30
Set a breakpoint on wsock32!bind(...), check to see where it's being called from and what IP address it's using, then patch the IP address.

evlncrn8
January 20th, 2007, 13:42
WSAConnect i think is the one, or sendto, bind afaik (correct me if wrong plz) is only used locally for incoming data

disavowed
January 21st, 2007, 13:06
Oops... I meant wsock32!connect(...). You'll want the sin_addr.s_addr field of the second argument.

dELTA
January 21st, 2007, 19:28
Yes, in fewer (and more generic) words, hook WSAConnect (with your favorite API hooking technique) and change that IP-address on the fly.

CluelessNoob
January 21st, 2007, 20:41
Quote:
[Originally Posted by dELTA;63915]Yes, in fewer (and more generic) words, hook WSAConnect (with your favorite API hooking technique) and change that IP-address on the fly.


Or just check your router documentation. Many (even the cheap ones) offer IP redirection.

LLXX
January 21st, 2007, 21:19
Actually, even *Windows* itself has a built-in IP routing capability...

Silver
January 22nd, 2007, 14:56
At a push, I bet you could assign the IP of the server to your local machine (as an additional IP) and that would fool it too...

PizzaPan
January 23rd, 2007, 01:36
*EDIT*
Assigning the ip address worked great such a simple way to do it, thanks a million!

Sorry for the late reply, however thanks a lot i appreciate the suggestions.

I did google ip routing first of all, but most of the topics were something i couldn't wrap my self around, i found route.exe and i will be trying that and the rest of the suggestions here (router, assigning the ip)

If that fails i know i can definitely patch it, i just wanted to stay away from it.

Thanks a lot.