Questions tagged [netcat]

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

300 questions
19
votes
5 answers

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 < message.bin The -q option states: -q seconds after EOF on…
15
votes
1 answer

How to know when NC is done transferring a file

Is there a way to know when netcat is done transferring a file between machines? Current commands: Machine #2: nc -lp 5555 > test.txt Machine #1: nc MachineIP Port < test.txt The transfer happens, but there's no visual indication that it has…
9
votes
1 answer

Does netcat support proxy authentication?

How to deal with this: nc: Proxy error: "HTTP/1.1 407 Proxy Authentication Required" nc has a -P option for proxy username, but what's for password?
Cyker
  • 4,274
  • 7
  • 36
  • 46
7
votes
1 answer

Using up arrow to get previous command in netcat

I'm working a lot with netcat recently to test a server, and having use of the up arrow to repeat previous commands would be extremely helpful. Right now however, it only enters ^[[A. Is there any way I can change this behavior?
bendl
  • 171
3
votes
2 answers

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 want to "man-in-the-middle", in this case FireFox,…
IQAndreas
  • 10,345
3
votes
3 answers

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 this option without the -l option. But nc --help…
Murat
  • 31
3
votes
1 answer

netcat echo server - possible with pipes instead of commands as strings?

I want to create an echo server without specifying any of my commands inside strings. I want all commands to be connected by pipes. This doesn't appear possible because the response gets returned before the request can be passed to the response…
Sridhar Sarnobat
  • 1,802
  • 20
  • 27
2
votes
0 answers

portable way to terminate command (netcat) after timeout

I've got a solution using netcat / nc as a service listening for input, but the service never returns any input to the client. Somewhat like this: server$ nc -l 12345 and then: client$ echo message | nc server 12345 The trick is that because the…
2
votes
2 answers

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 scratched this itch...
hildred
  • 5,829
  • 3
  • 31
  • 43
1
vote
1 answer

Netcat with device or interface flag?

Traceroute has an -i flag, -i interface, --interface=interface Specifies the interface through which traceroute should send packets. By default, the interface is selected according to the routing table. ping also provides this with -I. Netcat has…
Evan Carroll
  • 30,763
  • 48
  • 183
  • 315
1
vote
0 answers

How can I send a Hex value to a specific IP address and port number

I am using bash script to send hex values to my network. I need to send 0001000011050000FF00 hex value to IP: 192.168.1.5 Port# 502 using netcat. I tried $ echo '0001000011050000FF00' | xxd -r -p | nc -l 192.168.1.5 502 and it seems to be…
Roman
  • 19
1
vote
1 answer

Receive only ONE packet using netcat

I would like to use netcat to listen to data and receive only ONE packet. How does one do this?
Xofo
  • 639
1
vote
0 answers

Netcat interaction issue

I am following a tutorial where two ports (45678 & 45679) are specified in an Ubuntu Docker container. The container to used to listen to input on 45678 and route them to 45679. Then the video show using the the following command to listing for…
sisko
  • 341
  • 2
  • 4
  • 12
1
vote
2 answers

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 Mar 2016 23:07:31 GMT Location:…
user367890
  • 1,887
  • 2
  • 16
  • 27
1
vote
1 answer

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: #!/bin/bash while true; do { echo -e 'HTTP/1.1 200…
1
2