Much like in the socat challenge,
you need to make an already running service available on a different port.
However, this time you'll have to use the nc
command.
There is an HTTP service listening on port 127.0.0.1:5000
.
Your task is to map this address to 0.0.0.0:6000
.
You're not allowed to change the service configuration or restart it.
Hint 1 π‘
netcat
is a versatile networking utility that, in particular, can be used to start a listening TCP socket.
Hint 2 π‘
Unlike socat
, netcat
doesn't have a built-in proxy mode where connections are accepted on one port and forwarded to another.
However, with netcat
you can perform arbitrary commands upon receiving a connection.
The data received from the client will be forwarded to the stdin
of such command.
Hint 3 π‘
netcat
can also be used to connect to a TCP socket and forward data from the stdin
.
Hint 4 π‘
How about combining the two previous hints? π
Hint 5 π‘
Not every version of netcat
supports staying listening for another connection after its current connection is completed.
If the -k
option is not available, you'll have to be a bit more creative.
Hint 6 π‘
Use the force a bash loop, Luke! π
Level up your Server Side game β Join 9,000 engineers who receive insightful learning materials straight to their inbox