4 ms·
It requires Python. Bashbro, on the other hand, seems to require socat. I wonder if there's any bash-istic method of listening to a port...
by bheadmaster 2y ago
It requires Python.
Bashbro, on the other hand, seems to require socat. I wonder if there's any bash-istic method of listening to a port...
- striking 2y agoFor Bash with `--enable-net-redirections` set at configure time (not a default, not enabled on popular distros to my knowledge), `/dev/{udp,tcp}/$host/$port` is available for this purpose.
- dfc 2y agoDoes anyone know if there is a good reason to disable net-redirections?
- xyzzy_plugh 2y agoSure. It makes it incredibly easy to establish, for example, a reverse shell. In a purpose-built environment there is practically no need for such a feature aside from mischief.
- ahoka 2y agogawk can: https://www.gnu.org/software/gawk/manual/gawkinet/gawkinet.html https://www.gnu.org/software/gawk/manual/gawkinet/gawkinet.h...
- baumschubser 2y agoI solved that problem some time ago with netcat, „coproc nc -l -p PORT“. Makes bash listen to nc‘s stdout and let’s it write to it‘s stdin. But nc is not bash.
- alganet 2y agoHere's my nc version, works on all shells: https://gist.github.com/alganet/140c7c12d1603c244a01 https://gist.github.com/alganet/140c7c12d1603c244a01 nc is almost everywhere, you can count on it. Ultimately, this is a toy, but it can be handy. I originally made it to attempt using for serving config for networked debian unattended installations[1] while automating VM creation, but never went that far. [1]: https://debian-handbook.info/browse/en-US/stable/sect.automated-installation.html https://debian-handbook.info/browse/en-US/stable/sect.automa...
- herewulf 2y agoYou can't count on nc being installed but you can count on it being installable. That's a problematic distinction in some situations.
- deleted 2y ago[deleted]
- NikkiA 2y agoThere might be a way to create a listener using bash's /dev/tcp but I can't remember (I haven't used bash for decades) edit: https://unix.stackexchange.com/questions/49936/dev-tcp-listen-instead-of-nc-listen https://unix.stackexchange.com/questions/49936/dev-tcp-liste... gives some pointers