Comment by ๐Ÿš€ asdf

Re: "Piping prevents commands from fully executing?"

In: s/bash

@jsreed5 running "nc -vz" by itself outputs the following message:

Ncat: Version 7.93 ( https://nmap.org/ncat )

Ncat: You must specify a host to connect to. QUITTING.

running

echo -e -n "localhost / 0\r\n" | nc -vz localhost 301

does not output anything

Edit: I'm a dumbass, accidentally ran it with a greater than sign instead of a pipe (I just went through my bash history until I found the command so I could add the -vz but I edited the wrong command)

the output from

echo -e -n "localhost / 0\r\n" | nc -vz localhost 301

was actually

Ncat: Version 7.93 ( https://nmap.org/ncat )

Ncat: Connected to ::1:301.

Ncat: 0 bytes sent, 0 bytes received in 0.22 seconds.

It's strange, because when running "nc localhost 301" it does respond, so it shouldn't say "0 bytes received"

๐Ÿš€ asdf [OP]

2025-03-01 ยท 1 year ago

2 Later Comments โ†“

๐Ÿš€ clseibold [๐Ÿ›‚] ยท 2025-03-01 at 21:19:

@asdf Is this connecting to spartan server?

๐Ÿš€ asdf [OP] ยท 2025-03-02 at 07:10:

@clseibold yes

Original Post

๐ŸŒ’ s/bash

๐Ÿš€ asdf:

Piping prevents commands from fully executing? โ€” Why is it, that when I pipe a command into another command, the other command doesn't fully execute? Like if I run echo -e -n "localhost / 0\r\n" | nc localhost 301 or echo -e -n "localhost / 0\r\n" | nc -w 100s localhost 301 it does not output the response from localhost, or even wait for 100 seconds and timeout, it just exits. Why is this?

๐Ÿ’ฌ 6 comments ยท 2025-03-01 ยท 1 year ago