Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-09-30
2
Medium Priority
?
1,497 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 1000 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 1000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

670 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