Skip to main content
5 of 5
English contractions use apostrophes.
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265

/dev/tcp listen instead of nc listen

With a netcat listener like:

nc -l <port> < ~/.bashrc

I can grab my .bashrc on a new machine (doesn't have nc or LDAP) with:

cat < /dev/tcp/<ip>/<port> > ~/.bashrc

My question is: Is there a way to mimic the capabilities of nc -l <port> in my first line with /dev/tcp instead of nc?

The machines I'm working on are extremely hardened lab/sandbox environment RHEL (no ssh, no nc, no LDAP, no yum, I can't install new software, and they are not connected to the internet)

h3rrmiller
  • 13.5k
  • 5
  • 34
  • 42