Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active March 24, 2019 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/205520edd6f067922f75878d77b8d06e to your computer and use it in GitHub Desktop.
Save miguelmota/205520edd6f067922f75878d77b8d06e to your computer and use it in GitHub Desktop.
Bash pipe exec stderr and stderr to file descriptor which is an open tcp socket
exec 3<>/dev/tcp/127.0.0.1/1337 && head -1 <&3
exec &> >(tee >(cat >&3))
# netcat equivalent:
# exec > >(nc localhost 1337) 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment