본문 바로가기

Programming

netcat proxy

이런 방법이 있었다니..

named pipe 가 이렇게 유용하게 쓰이는구나...


Proxying

Another useful behaviour is using netcat as a proxy. Both ports and hosts can be redirected. Look at this example:

nc -l 12345 | nc www.google.com 80

Port 12345 represents the request

This starts a nc server on port 12345 and all the connections get redirected to google.com:80. If a web browser makes a request to nc, the request will be sent to google but the response will not be sent to the web browser. That is because pipes are undirectional. This can be worked around with a named pipe to redirect the input and output.

mkfifo backpipe
nc -l 12345 0<backpipe | nc www.google.com 80 1>backpipe


'Programming' 카테고리의 다른 글

Difference between Ntxxx and Zwxxx API  (0) 2013.05.22
Windows Library Structure  (0) 2013.05.22
Android Rootkit  (0) 2013.04.24
Android rootkit developing environment  (0) 2013.04.23
fork and exec.c  (0) 2013.03.19