I have a compiled client application without the source code. It connects via TCP to my server on port 7777 (this is the destination). I would like to change the application to use a diffe开发者_如何学JAVArent port and there is no settings on the client to change it easily. This leads me to believe that it is hard-coded into the application.
I have messed around a little bit with it but I am not a professional reverse-engineer and this proves to be too difficult for me to figure out alone. Is what I am trying to accomplish even possible?
How did you compile this without the source code? That question aside.
Look for 7777 (hex 1e61) i.e. 1e followed by 61 (or the other way around) in a binary editor and change it.
This will depend on the platform and the available tools. If you can use strace
on your environment, you can process the output and determine where the port is opened, and with that information go back to the binary, disassemble it, locate the function that is making the call, and try to determine how the port number got there.
You can use socat to create a TCP forwarding proxy. From socat examples:
socat TCP4-LISTEN:www TCP4:www.domain.org:www
installs a simple TCP port forwarder. With TCP4-LISTEN it listens on local port "www" until a connection comes in, accepts it, then connects to the remote host (TCP4) and starts data transfer. It will not accept a econd connection.
It is a less flexible approach than using iptables
because the socat proxy must run on that server your client connects to.
精彩评论