Skip to content

Instantly share code, notes, and snippets.

@gboddin
Last active August 29, 2015 14: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 gboddin/06df09f9142087773c69 to your computer and use it in GitHub Desktop.
Save gboddin/06df09f9142087773c69 to your computer and use it in GitHub Desktop.
net corruption test
#!/bin/bash
#quick nt wrapper thanks V****** Franck
[ -z "$1" ] && echo "First arg is <server/client>"&&exit 1
if [ "$1" = "server" ]; then
[ -z "$2" ] && echo "Second arg is listening port"&&exit 1
while /bin/true; do
nc -lp $2 2>/dev/null > /tmp/tcptest || nc -l $2 2> /dev/null > /tmp/tcptest
md5sum /tmp/tcptest
sleep 1
done
elif [ "$1" = "client" ]; then
[ -z "$2" ] && echo "Second arg is target IP"&&exit 1
[ -z "$3" ] && echo "Third arg is target port"&&exit 1
while /bin/true; do
dd if=/dev/urandom bs=64 count=99999 | tee /tmp/tcptest > /dev/tcp/$2/$3 && md5sum /tmp/tcptest
sleep 2
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment