Solved

Uses of netcat (nc) with named pipe (mkfifo)

Posted on 2011-09-30
2
1,319 Views
Last Modified: 2012-05-12
Hello, I would like to know if there is a well known usage of using named pipe with nc. I vaguely remember there was something to put a temporary arrangement on port 80 in case web server goes down using netcat and mkfifo. Please let me know if someone is aware of this. Thanks!
0
Comment
Question by:beer9
2 Comments
 
LVL 31

Accepted Solution

by:
farzanj earned 250 total points
ID: 36896182
Sure there is.

If you may remember, a named pipe is just a pipe except that it is a file in *nix.  So you can redirect data stream to it and at the other end you can read data stream from it.

Netcat is a utility that can act both as a client and as server.  You can listen to any port number as either TCP or UDP.  Then you may redirect that data to a named pipe and then read it from the named pipe.
0
 
LVL 9

Assisted Solution

by:expert_tanmay
expert_tanmay earned 250 total points
ID: 36901834
The following command will listen on port 80. Any request on port 80, will be returned with the file content of work_in_progress.html and also the request from the client will be logged in /tmp/requests.

while true ; do cat /var/httpd/error/work_in_progress.html  | nc -l -p 80 | head --bytes 2000 >>/tmp/requests ; date >>/tmp/requests ; done

Cheers
0

Featured Post

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question