0
Is there a way to make netcat
receive UDP packets from any ip:port? I don't want it to bind to a specific host as the first packet comes.
I can consider alternatives, but they have to be bash friendly (allow piping).
0
Is there a way to make netcat
receive UDP packets from any ip:port? I don't want it to bind to a specific host as the first packet comes.
I can consider alternatives, but they have to be bash friendly (allow piping).
0
With some nc
versions, it's possible to specify a -k
option:
-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. When used together with the -u option, the server socket is not connected and it can receive UDP datagrams from multiple hosts.
0
If you you are doing this on Linux then you could set up an iptables rule using the REDIR target. Just redirect all UDP traffic to a single port and then listen on that port with netcat.
0
What you are trying to achieve is not possible without root permission.
I don't need to listen UDP packets that arrive to any port. The target ip port is specified, but not the source. This is possible as a normal user, and as a side note I've alredy written a minimal c program that can do it, but I asked because I lost half an hour trying to get nc
to do it, and now I want to know if it's totally impossible with common shell utilities. – Lorenzo Pistone – 2012-07-15T19:16:39.177
aaah so you are trying to connect to a port? – Lucas Kauffman – 2012-07-15T20:18:55.087
no, the source port will change at every packet. – Lorenzo Pistone – 2012-07-16T10:17:31.423
what are you trying to achieve? – Lucas Kauffman – 2012-07-14T20:05:44.213
1@LucasKauffman just dump whatever udp packet arrives to a specific port. I cannot use tcpdump as I don't have root privileges on the machine. – Lorenzo Pistone – 2012-07-15T11:37:00.553