Challenge,Β Medium, Β onΒ  Linux,Β Networking

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.

Port forwarding with a user-space proxy (socat, netcat, etc.)

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! πŸš€

Categories:Β Linux,Β Networking
Discussion:Β  Discord

Level up your Server Side game β€” Join 9,000 engineers who receive insightful learning materials straight to their inbox