Skip to content

Instantly share code, notes, and snippets.

@gboddin

gboddin/nce.sh

Last active Aug 29, 2015
Embed
What would you like to do?
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