Created
March 11, 2017 15:13
-
-
Save anu1097/4a77b96b0791f033f6729db4920b16ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# rm /home/hackerman/TecMul/TM/*.txt #Cambiar ruta por la que contenga los txt #Change route containing the txt | |
cd ~/p2psp-console/bin/ #Cambiar ruta por la que tenga el p2psp-console #Change path for the p2psp-console | |
#clear | |
#echo -e "\n\nKilling All VLC\n\n" | |
#killall Vlc | |
while getopts "a:" opt; do | |
case ${opt} in | |
a) | |
NUM_PEERS="${OPTARG}" | |
;; | |
\?) | |
echo "Invalid option: -${OPTARG}" | |
;; | |
esac | |
done | |
TIME=`shuf -i 15-20 -n 1` | |
echo "TIME is - " $TIME | |
read LOWERPORT UPPERPORT < /proc/sys/net/ipv4/ip_local_port_range | |
while : | |
do | |
SourcePort="`shuf -i $LOWERPORT-$UPPERPORT -n 1`" | |
ss -lpn | grep -q ":$SourcePort " || break | |
done | |
cvlc ~/Videos/Big_Buck_Bunny_small.ogv --sout "#http{mux=ogg,dst=:$SourcePort/BBB.ogv}" :sout-keep & | |
while : | |
do | |
SplitterPort="`shuf -i $LOWERPORT-$UPPERPORT -n 1`" | |
ss -lpn | grep -q ":$SplitterPort " || break | |
done | |
timeout $TIME ./splitter --source_addr 127.0.0.1 --source_port $SourcePort --splitter_port $SplitterPort --channel BBB-134.ogv --header_size 30000 > ~/Documents/Codes/automatic-test/TM/splitter.txt & | |
while : | |
do | |
MonitorPort="`shuf -i $LOWERPORT-$UPPERPORT -n 1`" | |
ss -lpn | grep -q ":$MonitorPort " || break | |
done | |
timeout $TIME ./monitor --splitter_addr 127.0.0.1 --splitter_port $SplitterPort --player_port $MonitorPort > ~/Documents/Codes/automatic-test/TM/monitor.txt & | |
timeout $TIME vlc http://localhost:$MonitorPort & | |
for ((i=0; i < $NUM_PEERS; i++)) | |
do | |
PORT_RANDOM=`shuf -i 2000-65000 -n 1` | |
echo -e "#################### PORT IS "$PORT_RANDOM " #####################" | |
timeout $TIME ./peer --splitter_addr 127.0.0.1 --splitter_port 8001 --player_port $PORT_RANDOM > ~/Documents/Codes/automatic-test/TM/peers$PORT_RANDOM.txt & | |
sleep 0.5 | |
timeout $TIME nc localhost $PORT_RANDOM & | |
#timeout $TIME vlc http://localhost:$PORT_RANDOM & | |
done | |
sleep $TIME; | |
echo -e "\n\n\nSpliter.txt\n\n\n" | |
cat ~/Documents/Codes/automatic-test/TM/splitter.txt | |
echo -e "\n\n\nMonitor.txt\n\n\n" | |
cat ~/Documents/Codes/automatic-test/TM/monitor.txt | |
echo -e "\n\n\nPeer$PORT_RANDOM.txt\n\n\n" | |
cat ~/Documents/Codes/automatic-test/TM/peer$PORT_RANDOM.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment