Author: Philip Walls
Description: Redirect listen ports of any program using LD_PRELOAD
This tool uses LD_PRELOAD to override the bind() function call in glibc. This
allows you to force a program with non-configurable port bindings to bind to
a particular port of your choosing.
To build the code:
To use the script:
$ ./portjack [:port2[:portN]]
$ ./portjack 9090 nc -l -p 80
The portjack script is a simple Bash shim that sets the LD_PRELOAD environment
variable as well as the PORTJACK_PORTS environment variable that tells
libportjack which ports to redirect to.
If you don't specify enough ports to satisfy the needs of the program being run
all future bind() calls will be passed through unmodified.