Netcat is a computer networking service for reading from and writing network connections using TCP or UDP

learn more… | top users | synonyms

3
votes
2answers
44 views

how to get espeak to continuously speak stdout piped from netcat

I have a Raspberry pi 3 that I want to use as a sort of PA system, using espeak to announce stuff piped from netcat, which is getting input from a remote server. On the pi, I initiate the listener ...
0
votes
1answer
21 views

netcat daemon for calling functions in sh script

I'm new to shell programming and I have created a script that opens a connection to a server of mine. I want to have this script listen for an input from a client node and use that to run a function. ...
3
votes
1answer
42 views

How can I repeatedly send the contents of a file via socat / ncat to a socket

I'm running some performance testing, and I'm trying to send the same file repeatedly to a socket. If I do something like: $ socat -b1048576 -u OPEN:/dev/zero TCP4-LISTEN:9899,reuseaddr,fork $ ...
0
votes
0answers
20 views

netcat output does not write to array if launched from cron

I am able to run this script as a user or root with bash or sh. Doing so gives me the output that I expect (arrayFWS is written to file, then emailed). However, when I run it with crontab with user or ...
0
votes
1answer
11 views

Filter for remote server response from netcat SMTP scan

I am using netcat to test if remote exchange server (lets call it exchange1) is online with this code. nc -w 3 192.168.130.17 25 I want to create a file that has that servers name if and only if ...
0
votes
0answers
41 views

Testing Remote SMTP Server Port

I am currently working in a lab environment to test a script for my production environment. My environment has several remote firewalls, all of which have an external mail Virtual IP (VIP). Our ...
1
vote
1answer
30 views

Can't pipe into netcat

I have a squid proxy running in a docker container, started like this: docker run --privileged -d --publish=3128:3128 --name foo squid I want to get some information from it, from another container ...
0
votes
0answers
39 views

How to Copy Files through Socks 5 Proxy?

I'm trying to copy files from ubuntu server A to debian server B. Accessing both of them via SSH on win7 laptop C. Because of slow transfers the company running A provided a Socks5 proxy. Now when ...
0
votes
0answers
25 views

Netcat missing -z flag

I have a script that checks if a server can connect to another one over port 443, I use the following command in the script: [user@centos6 ~]$ nc -v -w 2 -z 10.3.22.2 443 Connection to 10.3.22.2 443 ...
0
votes
1answer
18 views

How to “nc -z <address>” with socat?

I want to get the behavior of "nc -z host port ; echo $?" with socat, since my network admins have disabled netcat. The purpose is just to test that a TCP connection is open between two servers. How ...
1
vote
1answer
53 views

How to pass received data from netcat to another script as argument?

I have simple bash nc script: #!/bin/bash nc -k -l 127.0.0.1 4444 > filename.out which listens 4444 port for TCP connection. Instead of redirecting received data to filename.out I would like, if ...
0
votes
2answers
65 views

Bash using netcat, send one command's output to file

I need to know how to grab output and store it in a variable. I don't want to send all the output to the file, just one of the commands output I am sending.. Basically AUTH AUTH LIST <---needs to ...
1
vote
1answer
44 views

Empty response on HTTP request with netcat

Testing a simple HTTP request using nc: $ printf 'GET / HTTP/1.1\r\nHost: mozilla.org\r\nAccept: */*\r\n\r\n' | nc mozilla.org 80 HTTP/1.1 301 Moved Permanently Content-Type: text/html Date: Thu, 10 ...
0
votes
1answer
32 views

Reroute mysql connection through external machine

I want (as a first step towards an external mysql proxy) reroute traffic from the local connection of mysql (on a VM) to an external proxy (on the host) which then routes it back to the VM which will ...
0
votes
1answer
31 views

Convert line of ASCII file to binary packet for NetCat

I have an ASCII file, which looks like this: 36,36,0,1 36,36,0,2 ... What I want to do is to send every row of it as one binary TCP segment's payload with NetCat. To convert the number from file ...
1
vote
0answers
34 views

How can I temporarily map a remote host and port to a local port?

Say I have a machine A acting as a router with two NICs and the following IP addresses: eth0: 192.168.1.1 (LAN) eth1: 10.0.0.1 (WAN) And I have another machine B on IP address 10.0.0.2 that I want ...
0
votes
0answers
8 views

Pipe output of netcat -k as soon as something is received [duplicate]

I have a nc command that's supposed to save anything received to a file immediately, yet it only dumps everything once I kill the parent process: nc -kl 9876 > log.txt How can I fix that?
1
vote
0answers
121 views

Half-close netcat connection

How can I have a netcat connection terminate the sending half of a TCP connection if its input reaches EOF? I have a (non-standard) TCP service which reads all its input (i.e. until the client sends ...
1
vote
0answers
51 views

Netcat server/client for a social thread

I have been learning nc for a while now, and I decided to make a social thread server for it in bash. Surprisingly, I got it working, but I have a couple problems with it. My main problem I want to ...
1
vote
1answer
60 views

How to have netcat server close after n seconds

I need to use nc in a weird way, where I want the server to first send a file, and then recieve a file, and this repeats. I would like to have every instance of the server server close after some ...
1
vote
0answers
88 views

Pipe Text Into and Out of Netcat Server Using mkfifo

I wanted to make two pipes for a netcat server that inputs text into the server, and one that outputs text from the server. I have the server running in a seperate script with the input and output ...
2
votes
1answer
96 views

How to pipe a sample log message manually to logstash for processing

I have set-up an ELK server in testing environment. I intend to send log messages from different clients to ELK, but first i want to test it from localhost to verify it running properly. Previously ...
1
vote
1answer
28 views

Replicating growing log files in a near real-time manner over the network

I have a server with a bunch of processes writing log files as they run. I need to enable a client host to get a replica of the server-side log files in a near real-time manner. Is there a better way ...
2
votes
1answer
34 views

tunnel netcat video streams to mplayer

I am sending a video stream over my network and I want to encrypt it with ssh. This solution below works: on machine 1 I run ./capture | nc 192.168.1.65 5001 on machine 2 I run netcat -l -p 5001 ...
1
vote
2answers
114 views

How can I “man-in-the-middle” a specific port?

When I want to figure out how a certain protocol works (let's say in this case, the HTTP protocol on port 80), I open two terminal windows: nc -l 80 nc google.com 80 I then fire up the program I ...
1
vote
0answers
30 views

What command line tools can be used to manually perform each step of an entire network “conversation”?

I know, I know; the phrase "network conversation" is imprecise almost to the point of meaninglessness. Let's take this specific scenario: I plug in a computer to a DHCP enabled router, open a browser ...
7
votes
3answers
3k views

How does netcat know if a UDP port is open?

So I can use this netcat command to check if a UDP port is open: $ nc -vz -u 10.1.0.100 53 Connection to 10.1.0.100 53 port [udp/domain] succeeded! Unlike TCP, UDP is connectionless (fire and ...
2
votes
0answers
174 views

named pipe proxy over SSH

I am used to forwarding a remote service port on localhost using ssh like: ssh -L 2181:localhost:2182 user@server (forward remote host port 2182 to local port 2181) now, from the machine I ssh to, I ...
1
vote
2answers
98 views

How do I only get whois data for an exact domain?

When I query a whois server with something like google.com, I get a whole slew of unrelated results, including things like GOOGLE.COM.SPAMMING.IS.UNETHICAL.PLEASE.STOP.THEM.HUAXUEERBAN.COM. Here I'm ...
0
votes
1answer
82 views

Why netcat says that the host isn't authoritative?

When trying to establish a TCP connection to my IP address, 192.168.1.42, netcat tells me that the host isn't authorative. That is, [~] $ echo "Hello, world"|nc -c -vv 192.168.1.42 8080 & nc -l ...
1
vote
1answer
147 views

Can't redirect cut output

When I try to redirect the output of cut it always seems to be empty. If don't redirect it, the output shows in terminal as expected. This is true for OS X 10.10 and Linux 4.1.6. This works: ...
1
vote
1answer
316 views

Netcat not working as expected when executed remotely in a non interactive shell

I have observed many unexpected behaviour when trying to start netcat in listen mode remotely. 1. When following command is used : ssh root@198.18.40.13 'nc -l -k 80 &' I observed that the ...
1
vote
1answer
376 views

grep not matching in nc output

I'm using nc to scan for open ports but I'm scanning a wide range and it's displaying too many results. Trying to grep it for the word "succeeded" doesn't work for some reason: $ nc -zv localhost ...
1
vote
1answer
316 views

NetCat ignoring (not sending) network data to broadcast addresses

If I run these NetCat below commands (no error messages at all) during a WireShark capture running (capture filter= udp dst port 4000) : luis@Zarzamoro:~$ echo "Hello" | nc -w1 -4u 255.255.255.255 ...
1
vote
1answer
59 views

Is there a way to have netcat listen and place incoming files in a destination directory?

I'd like to use netcat to regularly transfer files to a media server on my network. However, I can't figure out how (or if it's possible) to do something like nc -l 5959 > /media/data/, where ...
1
vote
1answer
347 views

Need help using Netcat

I have a file on my server that has HL7 messages spread out by a space. Example below. I am wanting to send one of these messages at a time in a continual loop until stopping the script with ctrl+c. I ...
0
votes
1answer
125 views

Can you force netcat to succeed only if all ports in port range succeed?

I use nc as part of a verification script, and check the output of each nc command listed against what the expected output should be. e.g., nc -zvw1 serv1.host.com 443 | gawk '{print $7}' Expected ...
2
votes
1answer
250 views

Jumping ssh hosts without netcat

I have access to an intermediate server to which I can connect with ssh. From there I can connect to other servers: A→B→C, where A is my laptop, B is an intermediate server accepting connections from ...
0
votes
0answers
211 views

Using Ubuntu as a SOCKS Proxy for Torrents - How to allow UDP for trackers?

This is my build: 14.04 LTS (GNU/Linux 2.6.32-042stab094.7 x86_64). I'm a complete noob at linux but have some experience in bind and ISC DCHP on some old solaris boxes (to define the audience!). I ...
8
votes
4answers
2k views

Simplest way to send files over network

What is the simplest and most versatile way to send files over the network to other computers? By that I mean computers that other people are using at the moment. I don't think SSH works if the ...
1
vote
2answers
962 views

nc command's -k option

man page of the nc command has following information -k Forces nc to stay listening for another connection after its current connection is completed. It is an error to use ...
1
vote
1answer
2k views

Write output from netcat to a file

I'm currently trying to write a scan port result to a text file Here is the command I tried to use: nc -vv -z localhost 1-80 > file.txt This doesn't work (that is, the error messages from nc ...
1
vote
0answers
247 views

netcat doesn't terminate when stdin closes

I'm trying to send a message through netcat. After sending the message, netcat must terminate. I've tried the following: cat tsmmessage.bin | nc -u localhost 4300 nc -u localhost 4300 < ...
1
vote
0answers
190 views

'nc' using ~100% CPU when transferring a FIFO file

On the server which is always connected I’m using this in a crontab: @reboot nc -k -l 1337 < /tmp/fifo.fifo On the client which is not always on the network or switched on I’m using this ...
0
votes
2answers
77 views

Is there a netcat like utility that uses unix sockets?

netcat is wonderful, let me count the ways -- is to much let me sum up -- tcp/ip4, udp/ip4, tcp/ip6, udp/ip6, but what I need is stream/unix. I could write it in half a day, but If someone has already ...
0
votes
1answer
211 views

Saving from arecord on a raspberry pi across a network to a mac

I've currently got a usb mic plugged into a Raspberry Pi B+ and am using the following code to record data: arecord --buffer-time=5000000 -D plughw:1,0 -f cd -t raw | lame -r - stream.mp3 I then ...
-1
votes
1answer
39 views

Can this be done in a one-liner? [duplicate]

Is there a way to do these two lines of code in one line? nc -l 17500 > listenToNetcat.txt chmod 754 listenToNetcat.txt
1
vote
0answers
145 views

Pipe a device via USB or wlan

I have an Android phone and I want to use some of its onboard device from PC. To be more clear, there is a node in /dev/ and I want to have on PC a file (or named pipe which is accessable as a file) ...
1
vote
1answer
400 views

What does the %h and %p do in this command?

$ ssh -o User=fred -o ProxyCommand="nc -X 5 -x localhost:9150 %h %p" server.example.org It's from http://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts I can't find any comments about ...
1
vote
1answer
123 views

NetCat never ending http session

I'm trying to use netcat to server some bash command results via a web interface, that stays running. The page is dynamic and needs to be updated upon loading. Just an example with what I'm using: ...