Re: Prosze o opinie o exatel-u

Autor: spit <spitek1_at_NOSPAM.gazeta.pl>
Data: Tue 22 May 2007 - 16:06:30 MET DST
Message-ID: <f2utd7$46j$1@inews.gazeta.pl>

Użytkownik "Lukasz Trabinski" <lukasz@trabinski.nospam.net> napisał w
wiadomości news:f2t37m$sc8$1@portraits.wsisiz.edu.pl...
> spit <spitek1@nospam.gazeta.pl> wrote:
>
>> Jestem na etapie skryptu:
>
> Ponieważ mam dobry humor:
>
> for a in `peval as5617`;do iptables -A FORWARD -s 0/0 -d `echo $a|sed
> s/","/""/g|sed s/"{"/""/g|sed s/"}"/""/g|sed s/")"/""/g|sed s/"("/""/g` -j
> ACCEPT ;done
>
>
> --
> ŁT
>
gotowe rozwiazanie z wyk. iptables
Wyszlo mi teraz ok 7% pkt tpsa na laczu czas pomiaru dalem 30m tak na
szybko ;) .

#!/bin/sh
sieci=`whois -i origin as5617 | grep route | tr -ds " " "" | cut -d
":" -f2`
iptables -N TPSA_PKT
iptables -A TPSA_PKT -j RETURN
iptables -N ALL_PKT
for ip in $sieci
do
iptables -A ALL_PKT -d $ip -j TPSA_PKT
done
iptables -A ALL_PKT -j RETURN
iptables -I FORWARD -j ALL_PKT
sleep 1m #czas pomiaru
allpkt=`iptables -t filter -L ALL_PKT -nxv | grep RETURN | tr -s " " |
cut -d" " -f2`
allbytes=`iptables -t filter -L ALL_PKT -nxv | grep RETURN | tr -s " " |
cut -d" " -f3`
tpsapkt=`iptables -t filter -L TPSA_PKT -nxv | grep RETURN | tr -s " " |
cut -d" " -f2`
tpsabytes=`iptables -t filter -L TPSA_PKT -nxv | grep RETURN | tr -s " " |
cut -d" " -f3`

#kasowanie regul pomiarowych iptables
iptables -D FORWARD -j ALL_PKT
for ip in $sieci
do
iptables -D ALL_PKT -d $ip -j TPSA_PKT
done
iptables -D TPSA_PKT -j RETURN
iptables -D ALL_PKT -j RETURN
iptables -X TPSA_PKT
iptables -X ALL_PKT
echo ......statystyki........
echo ilosc wszystkich pakietow $allpkt pkts
echo pojemnosc wszystkich pakietow $allbytes bytes
echo ilosc pakietow tpsa $tpsapkt pkts
echo pojemnosc pakietow tpsa $tpsabytes bytes
echo pakietow tpsa $[ $[$tpsapkt *100] / $allpkt ] %
echo pojemnosci tpsa $[ $[$tpsabytes *100] / $allbytes ] %

ps. moze spacje lykac :
  tr -ds " " ""(dwie spacje ,brak spacji)
  tr -s " " (dwie spacje)
  cut -d" " (jedna spacja)
Received on Tue May 22 16:10:06 2007

To archiwum zostało wygenerowane przez hypermail 2.1.8 : Tue 22 May 2007 - 16:40:01 MET DST