Solved

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

Posted on 2011-09-30
2
1,386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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