#!/bin/bash
 
IP=192.168.1 #zacatek adresy (rozsah /24)
PORT=999 #cilovy port
 
#tajna zprava je v souboru
message=`cat msg.txt`
maxindex=`echo -n "$message"|wc -c`
myIndex=`expr \( $RANDOM % $maxindex \) + 1`
 
msgPart="$myIndex":`echo $message|tr " " "_" | cut -b $myIndex`
 
#nalezeni tech co poslouchaji na danem portu
ips=`nmap -Pn -p $PORT  $IP.1/24|grep "$IP" |sed 's/^.*\('"$IP"'[^ ]*\).*$/\1/g'`
 
for ip in $ips
do
 (wget http://$ip:$PORT/?m=$msgPart -t 1 --max-redirect 0 -o /dev/null -O /dev/null) &
done
Nahoru