Temat: Zmiana skryptu wifianalyzer

Czy ktoś może zmodyfikowac skrypt wifianalyzer.sh ->  http://eko.one.pl/?p=openwrt-wifianalyzer

aby grafika zapisywała se w innym katalogu niz w tmp

RB760iGS + RB260GS / Ryzen 5 2660 / 16G DDR4 / MiniITX - Inea 1G (https://i.imgur.com/TLbJVDw.png)
RB951-2HnD / Celeron J1900 / 4G DDR3 / MiniITX - Satpol 100M

2

Odp: Zmiana skryptu wifianalyzer

Jakim? smile

http://klatka.ovh - CABANA PUBLIC SERVER
http://klatka.ovh/psi/ - phpsysinfo
http://temp.klatka.ovh/ - pogodynka

3

Odp: Zmiana skryptu wifianalyzer

Ta przeróbka w /mnt/dane zapisuje

#!/bin/sh

# (c) 2010 Cezary Jackiewicz <cezary@eko.one.pl>

scan_mac80211()
{
    # taken from Gargoyle project
    cur_ifs=$(iwconfig 2>/dev/null | grep "^wlan" | awk ' { print $1 }')
    cur_sta=""
    for i in $cur_ifs ; do
        is_sta=$(iwconfig $i | grep "Managed" | grep -v "Not.Associated")
        if [ -n "$is_sta" ] ; then
            cur_sta="$i"
        fi
    done
                                                                                
    if [ -n "$cur_sta" ] ; then
        iwlist $cur_sta scanning
    else        
        iw phy phy0 interface add tmpsta type managed
        ifconfig tmpsta hw ether 00:11:22:33:55:77
        ifconfig tmpsta up
        iwlist tmpsta scanning
        ifconfig tmpsta down
        iw dev tmpsta del
    fi
}

GRAPH=wifi
WWW=/mnt/dane

mkdir -p $WWW
touch ${WWW}"/gnuplot_cmd"

scan_mac80211 | \
    awk  'BEGIN { FS="[:=]"} /Channel:/ { printf "%s ", $2 } /Signal level/ { printf "%d ",  100 - ($3 * -1)} /ESSID/ { printf "%s\n", $2 }' | \
    awk ' { print ($1 - 2)" 0 "$3"\n"$1" "$2" "$3"\n"($1 + 2)" 0 "$3"\n\n"}' >  $WWW/dane.txt

GNUPLOT_OUTPUT=${WWW}/${GRAPH}.png.t
GNUPLOT_CMD=${WWW}"/gnuplot_cmd"
cat > ${GNUPLOT_CMD} << __EOF__
set terminal png small size 640,640
set output '${GNUPLOT_OUTPUT}'
set xlabel "Wifi channels"
set ylabel "Signal strength [dBm]"
set grid
set key left
set xrange [ -1 : 16 ] noreverse nowriteback
set xtics 1,1,14
set yrange [ 0 : 100 ]
set ytics ("-100" 0, "-90" 10, "-80" 20, "-70" 30, "-60" 40, "-50" 50, "-40" 60, "-30" 70, "-20" 80, "-10" 90, "0" 100)
plot \\
__EOF__

ILE=$(wc -l /tmp/dane.txt | awk ' { print $1/5-1}')
for i in $(seq 0 $ILE); do
    echo "'"${WWW}"/dane.txt' ind $i:$i using 1:2 noti w filledcurve smooth csplines, \\" >> ${WWW}"/gnuplot_cmd"
done
echo "'"${WWW}"/dane.txt' every ::1::1  using 1:2:3 w labels center offset 0,1 notitle" >> ${WWW}"/gnuplot_cmd"
echo "quit" >> ${WWW}"/gnuplot_cmd"

gnuplot ${GNUPLOT_CMD}
rm ${GNUPLOT_CMD}
mv ${GNUPLOT_OUTPUT} ${WWW}/${GRAPH}.png
http://klatka.ovh - CABANA PUBLIC SERVER
http://klatka.ovh/psi/ - phpsysinfo
http://temp.klatka.ovh/ - pogodynka

4 (edytowany przez zdzichu6969 2012-09-02 09:58:27)

Odp: Zmiana skryptu wifianalyzer

LiO skumałem co trzeba zmodyfikować, twoja modyfikacja prawie trybila;)
KOD:

#!/bin/sh

# (c) 2010 Cezary Jackiewicz <cezary@eko.one.pl>

scan_mac80211()
{
    # taken from Gargoyle project
    cur_ifs=$(iwconfig 2>/dev/null | grep "^wlan" | awk ' { print $1 }')
    cur_sta=""
    for i in $cur_ifs ; do
        is_sta=$(iwconfig $i | grep "Managed" | grep -v "Not.Associated")
        if [ -n "$is_sta" ] ; then
            cur_sta="$i"
        fi
    done
                                                                                
    if [ -n "$cur_sta" ] ; then
        iwlist $cur_sta scanning
    else        
        iw phy phy0 interface add tmpsta type managed
        ifconfig tmpsta hw ether 00:11:22:33:55:77
        ifconfig tmpsta up
        iwlist tmpsta scanning
        ifconfig tmpsta down
        iw dev tmpsta del
    fi
}

GRAPH=wifi
WWW=/www1

mkdir -p $WWW
touch ${WWW}"/gnuplot_cmd"

scan_mac80211 | \
    awk  'BEGIN { FS="[:=]"} /Channel:/ { printf "%s ", $2 } /Signal level/ { printf "%d ",  100 - ($3 * -1)} /ESSID/ { printf "%s\n", $2 }' | \
    awk ' { print ($1 - 2)" 0 "$3"\n"$1" "$2" "$3"\n"($1 + 2)" 0 "$3"\n\n"}' >  $WWW/dane.txt

GNUPLOT_OUTPUT=${WWW}/${GRAPH}.png.t
GNUPLOT_CMD=${WWW}"/gnuplot_cmd"
cat > ${GNUPLOT_CMD} << __EOF__
set terminal png small size 640,640
set output '${GNUPLOT_OUTPUT}'
set xlabel "Wifi channels"
set ylabel "Signal strength [dBm]"
set grid
set key left
set xrange [ -1 : 16 ] noreverse nowriteback
set xtics 1,1,14
set yrange [ 0 : 100 ]
set ytics ("-100" 0, "-90" 10, "-80" 20, "-70" 30, "-60" 40, "-50" 50, "-40" 60, "-30" 70, "-20" 80, "-10" 90, "0" 100)
plot \\
__EOF__

ILE=$(wc -l [b]/www1/dane.txt[/b] | awk ' { print $1/5-1}')
for i in $(seq 0 $ILE); do
    echo "'"${WWW}"/dane.txt' ind $i:$i using 1:2 noti w filledcurve smooth csplines, \\" >> ${WWW}"/gnuplot_cmd"
done
echo "'"${WWW}"/dane.txt' every ::1::1  using 1:2:3 w labels center offset 0,1 notitle" >> ${WWW}"/gnuplot_cmd"
echo "quit" >> ${WWW}"/gnuplot_cmd"

gnuplot ${GNUPLOT_CMD}
rm ${GNUPLOT_CMD}
mv ${GNUPLOT_OUTPUT} ${WWW}/${GRAPH}.png

WYedytować trzeba jeszcze linijke z adresem pliku dane.txt

GRAPH=wifi
WWW=/www1

echo "'"${WWW}"/dane.txt' every ::1::1  using 1:2:3 w labels center offset 0,1 notitle" >> ${WWW}"/gnuplot_cmd"
echo "quit" >> ${WWW}"/gnuplot_cmd"

Wynik skanowania mojego routera mozna zobaczyc
http://gruchaa.us.to:81/wifi.png

RB760iGS + RB260GS / Ryzen 5 2660 / 16G DDR4 / MiniITX - Inea 1G (https://i.imgur.com/TLbJVDw.png)
RB951-2HnD / Celeron J1900 / 4G DDR3 / MiniITX - Satpol 100M

5 (edytowany przez toka 2013-04-01 22:58:38)

Odp: Zmiana skryptu wifianalyzer

Witam, odświeżę.
Po zmianie w skrypcie na :
GRAPH=wifi
WWW=/mnt/sda1
całość odświeża się za pomocą crone, jednak na wykresie brak kolorów obrazujących siłę oraz szerokość zajętego kanału dla danej sieci,nagłówki z ssid są widoczne, prosze o sugestie

wszystko ok, przeanalizowałem, edycja  ILE=$(wc -l /mnt/sda1/dane.txt | awk ' { print $1/5-1}') przywróciła kolory

Machine: TP-Link TL-WDR3600 v1 OpenWrt Gargoyle PL 1.6.2.2 (r42647) , by obsy - e3372 / Plus - El Capitan 10.11.3