Skip to content

Instantly share code, notes, and snippets.

@tyzbit
Last active September 21, 2017 03:15
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 tyzbit/f30b8577b870105f6d5c to your computer and use it in GitHub Desktop.
Save tyzbit/f30b8577b870105f6d5c to your computer and use it in GitHub Desktop.
Connect to an arbitrary TCP port to Read/Write. Very basic, will probably break easily but robust enough to test FTP credentials sans FTP
#!/bin/bash
if [ ! -z $2 ]; then
host=$1
port=$2
exec 5<>/dev/tcp/$host/$port
cat <&5 &
trap "exec 5>&- " EXIT
while true; do
read p
echo "$p" >&5
done
else
echo "not enough args"
fi
@tyzbit
Copy link
Author

tyzbit commented Sep 21, 2017

this is better
exec 5<>/dev/tcp/$host/$port; cat <&5 & cat >&5; exec 5>&-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment