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

learn more… | top users | synonyms

1
vote
0answers
21 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
7 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
21 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
27 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
29 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
33 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 ...
3
votes
1answer
46 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
21 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
26 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
45 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
25 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 ...
6
votes
2answers
979 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
129 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
63 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
59 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
104 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
178 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
252 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
173 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
46 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
265 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
97 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
178 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
172 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
1k 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 ...
0
votes
0answers
130 views

command line tool group chat utility under linux

I am working on mac osx Yosemite. I want to reach to a user under a certain IP address. (It might be local network or thru internet). I want to do it thru terminal using the default tools that ...
1
vote
2answers
777 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
1k 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
193 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
172 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
73 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
178 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
37 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
0
votes
0answers
197 views

/usr/bin/ld: cannot find -lc when compiling netcat

I'm trying to compile external-netcat (first for my system, then I'll try for an external embedded device, hence the 'external-netcat') When trying to compile it for my desktop, by running make ...
1
vote
0answers
117 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
279 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
106 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: ...
7
votes
6answers
1k views

How to grep netcat output

I'm trying to grep live text stream from netcat, but it doesn't work for me: netcat localhost 9090 | grep sender returns nothing, but I'm sure that it should. If I redirect the netcat output to a ...
3
votes
0answers
226 views

Remote Mouse netcat (/dev/input/mice)

I was playing around with nc and I'm discovering how powerful and versatile this tool is. I was wondering how the file /dev/input/mice works because when I do cat /dev/input/mice you see the output, ...
1
vote
2answers
95 views

Using netcat to launch a program? [duplicate]

Assume I let netcat listen on some port on PC1 (IP:10.0.0.1) with: PC1:~$ nc -l 9999 I connect from PC2 (IP:10.0.0.2) and send some strings: PC2:~$ nc 10.0.0.1 9999 hello touchit test ...
1
vote
2answers
124 views

Capturing data from a Fluke 1620a via netcat

I am trying to pull temperature and humidity data from Fluke DewK 1620a thermo-hygrometers and write the temp/humidity readings to a log. I can connect to the device via netcat with a simple 'nc ...
0
votes
2answers
1k views

How can I use netcat (nc) for chat client server model?

I am trying to write a daemon using bash. I will enter my partner's IP address and the connection will start using nc partner_ip 2015, likewise on the server I will start the connection using nc -l -p ...
0
votes
2answers
31 views

net cat client and server model

I tried to make server client model as below on one shell nc -l -p 8080 this works as a server and on another nc 127.0.0.1 8080 and this works as a client all of this is fine ... the ...
0
votes
1answer
34 views

Getting filetype of netcat output?

How can I use the file command on an output from netcat? For example: nc 192.168.1.1 1234 dGhpcyBpcyBhIHNhbXBsZSBzdHJpbmc= dGhpcyBpcyBhIHNhbXBsZSBzdHJpbmc= being the output, (sample base64 for ...
2
votes
2answers
127 views

How to write to a file with netcat? And set it to grow to a certain size and begin overwriting itself?

I'm currently writing a program that prints to a Zebra printer. Because my office doesn't have a zebra printer, we print to a linux VM running netcat with nc -k -l -p 9100 | tee labels.txt so that we ...
6
votes
3answers
8k views

Test if telnet port is active within a shell script

I am trying to create a script to test whether it is possible to login via telnet. I do not want to really log in; therefore, expect is not needed. I just want to see if I am able to get a login ...
1
vote
1answer
405 views

tcpdump and nc with udp

I don't understand the behaviour of netcat. Let's say that I have one host acting as server: [root@localhost tmp]# nc -u -l -p 670 Then I try to connect from a client: root@debian:/tmp# nc -u ...
1
vote
3answers
2k views

How can I pipe data over network or serial to the display of another linux machine?

I have a second monitor that I'd like to use for a text-based debugging log and/or console. I don't want to have it as part of my GUI / "desktop" / main system. I have this display connected to an ...
1
vote
2answers
226 views

netcat to capture ethernet

How can I make sure the result of the following command: nc eth0 &> capture.txt would capture the data + errors transmitted via eth0?
1
vote
3answers
679 views

nc not waiting for server disconnect on OS X

How to make nc client on OS X Mavericks keep socket open and read data until server disconnects the socket? I want to send data to a server through nc and then use the response. Problem is that nc ...