Using BusyBox version of netcat to listen on tcp port

I need to listen to an arbitrary port inside the Linux built-in box. I chose port 6660 because it is designed for unencrypted connections anyway, and since there are several ports open in a Linux box running Linux. I found out that netcat (nc on command line) would be the easiest and best solution for this, so I don’t need to start programming some C program for this purpose.

I managed to catch the command and parameters, and I implemented the simplest way to listen to plain text on my PC from another PC as follows:

sven@sven:~$ nc 192.168.4.110 6660 sven@sven:~$ hello there! anotherUser@userg:~$ nc -l -p 6660 anotherUser@userg:~$ hello there! 

But the fact is that the netcat tool comes with the busybox package in this Linux box. And I'm not sure what will be the syntax of how to listen on a port (e.g. 6660). I always get the same dialog:

 ~ # nc -l -p 6660 BusyBox v1.17.1 (Debian 1:1.17.1-8) multi-call binary. Usage: nc [IPADDR PORT] Open a pipe to IP:PORT 

I also tried many other ways to implement listening, but I can not do it. I assume that at least this will give me some options? also

 nc -h 

or

 nc --help 

do not give any "minus" options

But sending text from the Linux built-in box to my computer works:

 ~ # nc 192.168.4.130 6660 fsdf tere ^C ~ # sven@sven:~$ nc -l -p 6660 fsdf tere 

The Linux embedded box has a fully functional network connection within the same local network and has existing eth0 and lo links

 eth0 Link encap:Ethernet HWaddr D0:E3:47:00:03:5F inet addr:192.168.4.179 Bcast:192.168.4.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:28046281 errors:0 dropped:0 overruns:0 frame:0 TX packets:428464 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2458890234 (2.2 GiB) TX bytes:83021395 (79.1 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2282 errors:0 dropped:0 overruns:0 frame:0 TX packets:2282 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:444956 (434.5 KiB) TX bytes:444956 (434.5 KiB) 

Töövõite!

+8
linux listener port busybox netcat
source share
1 answer

Here is the manual page for implementing busybox nc .

The correct syntax

 nc -l -p <port> 

The problem is that your busybox version was compiled without the ability to listen to nc. Indeed, there is a configuration option during the NC_SERVER assembly that must be enabled in order to enable this function.

Can you build another nc , possibly from this version, and copy the binary to your built-in host? You may need to create a cross-compiler environment.

+11
source share

All Articles