Snippets

Doug Freed mynetcat

Created by Doug Freed
#!/bin/bash
# usage: mynetcat.sh host port
cleanup(){
	kill %1
}
exec 3<>/dev/tcp/"$1"/"$2"
cat <&3 &
trap cleanup EXIT
while true; do
	tosend=()
	while read; do
		tosend+=("$REPLY")
	done
	echo
	for line in "${tosend[@]}"; do
		echo "$line" >&3
	done
done

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.