bertlea
Posts: 282
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Questions about nc (netcat) in Raspbian

Tue Dec 18, 2018 5:55 am

I found the nc (netcat) included in Raspbian is an OpenBSD version which I cannot find the support for running a program after a connection is established (i.e. the “-e” flag). While the version in Debian RPi desktop is a traditional version that does support the “-e” and “-c” flags. Why Raspbian choose include an OpenBSD version? Security concerns? License concerns?

Also, is there a way to use the OpenBSD version that can achieve the same effect as using the traditional version with “-e” parameter?

Lastly, if I really want the “-e” capability of netcat, which version I should install (recommendation)? E.g. netcat-traditional, netcat6, netcat (TCP/IP swiss army knife….)? or ncat (from nmap)? <-- actually I cannot find that ncat using apt-cache search.

epoch1970
Posts: 3532
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Questions about nc (netcat) in Raspbian

Tue Dec 18, 2018 11:03 am

This one seems to have -e.
https://manpages.debian.org/stretch/net ... .1.en.html

On ubuntu currently if you apt-get netcat, both variants do install. I suppose it is the same for Raspbian Stretch?
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

fruitoftheloom
Posts: 20427
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Questions about nc (netcat) in Raspbian

Tue Dec 18, 2018 11:20 am

bertlea wrote:
Tue Dec 18, 2018 5:55 am
I found the nc (netcat) included in Raspbian is an OpenBSD version which I cannot find the support for running a program after a connection is established (i.e. the “-e” flag). While the version in Debian RPi desktop is a traditional version that does support the “-e” and “-c” flags. Why Raspbian choose include an OpenBSD version? Security concerns? License concerns?

Also, is there a way to use the OpenBSD version that can achieve the same effect as using the traditional version with “-e” parameter?

Lastly, if I really want the “-e” capability of netcat, which version I should install (recommendation)? E.g. netcat-traditional, netcat6, netcat (TCP/IP swiss army knife….)? or ncat (from nmap)? <-- actually I cannot find that ncat using apt-cache search.

Yes it does appear that Debian offer older possibly outdated software.

nmap ncat version 7.70 which appears the newest implementation is only shown as for Debian Buster / Sid:

https://packages.debian.org/buster/ncat

https://nmap.org/book/ncat-man-options-summary.html
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Questions about nc (netcat) in Raspbian

Tue Dec 18, 2018 1:58 pm

The situation with netcat really is a mess. First of all is the insanity of having (at least) two different names for the same program ("nc" and "netcat" - oh, and, also, "ncat"). Second is the fact that there are so many versions floating around.

Then the insanity of whether or not it is (i.e., should be, from a moral perspective) possible to spawn a program (the "-e" option that is the topic of this thread). Obviously, this is a feature that people want, but that the original author thought was "too dangerous".

I find that the overall best way to deal with it is to self-compile "nc6", which seems to be the best version I've found, and then use that exclusively.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

bertlea
Posts: 282
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Re: Questions about nc (netcat) in Raspbian

Wed Dec 19, 2018 2:54 am

Thank you all for the comments and suggestions! Before I am confident to compile from source, I decided to install and use the ncat from nmap. Because I successfully installed that not only on my Raspberry Pi but also on Macbook and my Windows7 system. It also got the --ssl feature that I may find useful in the future. Yes, agree with n67's comments about the original author that it is pretty dangerous if you spawn a shell after connection. I will be careful on using that –e feature.

bertlea
Posts: 282
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Re: Questions about nc (netcat) in Raspbian

Wed Dec 19, 2018 7:44 am

Just a suggestion to the Raspberry Pi Foundation: As both Raspbian and Debian Rpi desktop are under the foundation’s control, it will be nice if the packages included on both are kept as similar as possible. I actually thought that was the case and was surprised on my findings on the netcat package. I use Debian Rpi desktop instead of other distributions mainly because I want to have the similar environment as Raspbian and hoping I will have less issues and flatter learning curve.

I can understand there are cases out of control by the foundation, such as node.js no longer supports 32-bit X86 Linux after version 8, but I cannot imagine a reason for using different packages for common tools like netcat.

fruitoftheloom
Posts: 20427
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Questions about nc (netcat) in Raspbian

Wed Dec 19, 2018 8:03 am

bertlea wrote:
Wed Dec 19, 2018 7:44 am
Just a suggestion to the Raspberry Pi Foundation: As both Raspbian and Debian Rpi desktop are under the foundation’s control, it will be nice if the packages included on both are kept as similar as possible.

That statement is not factually correct, the x86 Debian with Raspberry Pi Desktop is pure Debian x86-32 base using a kernel compatible with the CPU Architecture and 32bit Userland.

SL who is responsible for the Raspberry Pi Desktop Environment makes very few changes to the Debian base packages offered.


Raspbian is a differing ball game as it is a fork of Debian ARMHF ARMv7 but compiled to be compatible with ARMv6. The RPF/RPT take Raspbian and add their own packages as required which may / does impact on software offered by default.
adieu

Asus CS10 Chromebit / HP Envy 4500 Wireless Printer / Raspberry Pi Model 2B v1.1 / RealVNC Software...

bertlea
Posts: 282
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Re: Questions about nc (netcat) in Raspbian

Wed Dec 19, 2018 1:32 pm

@fruitoftheloom, thank you for commenting on that. Do you mean it is the Debian Stretch for ARM distro includes the different (OpenBSD) version of nc and Raspbian just inherited that from that Debian ARM distro? If that is true, then I agree my question / suggestion should go to Debian maintainer instead of Raspberry Pi Foundation.

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Questions about nc (netcat) in Raspbian

Wed Dec 19, 2018 2:42 pm

bertlea wrote:
Wed Dec 19, 2018 1:32 pm
@fruitoftheloom, thank you for commenting on that. Do you mean it is the Debian Stretch for ARM distro includes the different (OpenBSD) version of nc and Raspbian just inherited that from that Debian ARM distro? If that is true, then I agree my question / suggestion should go to Debian maintainer instead of Raspberry Pi Foundation.
I'm really curious why you are faffing around with this - and trying to make trouble for the various maintainers (Note: People on this forum tend to get real testy real quick if you start implying that the maintainers and/or Linux in general are anything less than perfect)

As I said, the best is to get the source for nc6, compile it (it is an easy build - just do ./configure && make), and put the binary in your ~/bin directory (*). Thereafter, everything will work fine. In particular:

1) nc6 support ipv6 (hence the 6 in the name). I don't think any of the others do.

2) It supports the -e option (so no worrying about whether or not that works).

3) It supports the "half-close" option - which is nice when interfacing with certain kinds of servers. Again, I don't think any of the others have this.

(*) Once you've compiled it, you can, of course, copy the binary to any/all of your Pis and it will "just work". For the x86 versions of Linux (e.g., the Raspberry Pi Desktop for Mac/Windows - or whatever they are calling it this week), you will, of course, have to do a separate compile.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

Return to “Raspbian”