Solved

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

Posted on 2011-09-30
2
1,446 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

622 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