Freifunk/Flashscript

Aus Wiki CCC Göttingen
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

<source lang=bash>

  1. !/bin/bash
  1. FIRMWARE="gluon-ffhi-0.4-experimental-20150328-tp-link-tl-wr1043n-nd-v2.bin"
  2. FIRMWARE=gluon-ffhi-wr1043.bin

FIRMWARE=gluon-ffgoe-0.6.5-tp-link-tl-wr1043n-nd-v2.bin

  1. NAME=ccc-geismar-land
  2. LAENGE=9.949756264686584
  3. BREITE=51.52233597559833
  4. CONTACT="freifunk@example.com"

BREITE=$1 LAENGE=$2 NAME=$3

configure_gluon() {

  curl 'http://192.168.1.1/cgi-bin/luci' \
  -H 'Origin: http://192.168.1.1' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36' \
  -H 'Content-Type: multipart/form-data; boundary=----ffgoe-4711' \
  -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \
  -H 'Cache-Control: max-age=0' \
  -H 'Referer: http://192.168.1.1/cgi-bin/luci' \
  -H 'Connection: keep-alive' \
  --compressed \
  --data-binary \

$'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbi.submit"\r\n\r\n1\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbid.wizard.1._hostname"\r\n\r\n'"$NAME"$'\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbi.cbe.wizard.1._meshvpn"\r\n\r\n1\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbid.wizard.1._meshvpn"\r\n\r\n1\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbi.cbe.wizard.1._limit_enabled"\r\n\r\n1\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbi.cbe.wizard.1._location"\r\n\r\n1\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbid.wizard.1._location"\r\n\r\n1\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbid.wizard.1._latitude"\r\n\r\n'"$BREITE"$'\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbid.wizard.1._longitude"\r\n\r\n'"$LAENGE"$'\r\n'\ $'------ffgoe-4711\r\nContent-Disposition: form-data; name="cbid.wizard.1._contact"\r\n\r\n'"$CONTACT"$'\r\n'\ $'------ffgoe-4711--\r\n'

  sleep 1
  curl -v 'http://192.168.1.1/cgi-bin/luci/gluon-config-mode/reboot' \

-H 'Origin: http://192.168.1.1' \ -H 'Connection: keep-alive' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3' \ -H 'Accept-Language: en-us' \ -H 'Referer: http://192.168.1.1/cgi-bin/luci' \ -H 'Accept-Encoding: gzip, deflate'

}

flash_firmware() {

  curl \
  --user admin:admin \
  --user-agent 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0' \
  --referer 'http://192.168.0.1/userRpm/SoftwareUpgradeRpm.htm' \
  --form "Filename=@$FIRMWARE" -F 'Upgrade=Upgrade' \
  http://192.168.0.1/incoming/Firmware.htm
  sleep 1
  curl \
  --max-time 2 \
  --user admin:admin \
  --user-agent 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0' \
  --referer 'http://192.168.0.1/incoming/Firmware.htm' \
  http://192.168.0.1/userRpm/FirmwareUpdateTemp.htm

}

wait_for_ping () {

  ip=$1
  echo -n "ping $ip "
  while true; do
     echo -n "."
     ping -c 1 -W 5 $ip >/dev/null
     if test "$?" = "0"; then
        echo
        echo Es pingt.
        return
     fi
     sleep 3
  done

}

echo "Happy Flashing fuer '$NAME'"

echo Warten auf TP-Link wait_for_ping 192.168.0.1 sleep 5

echo Sende Firmware flash_firmware

echo Warten auf Gluon wait_for_ping 192.168.1.1 sleep 5

echo Konfiguriere Gluon configure_gluon

</source>


<source lang=perl>

  1. !/usr/bin/perl

while (<>) {

       ($x,$x,$x,$b,$l,$n) = split /;/;
       printf "./flash.sh %-20s %-20s %20s", $b, $l, $n;

} </source>

# Goettingen:
./flash.sh 51.502538568153156   9.902989268302917    Feinbaeckerei_Ruch_59
./flash.sh 51.52715549198952    9.91589069366455     Feinbaeckerei_Ruch_04
./flash.sh 51.53313912617003    9.934709072113037    Feinbaeckerei_Ruch_05
./flash.sh 51.527349063016814   9.950051307678223    Feinbaeckerei_Ruch_06
./flash.sh 51.53687307599091    9.926013350486755    Feinbaeckerei_Ruch_07
./flash.sh 51.529912132818495   9.945834875106812    Feinbaeckerei_Ruch_08
./flash.sh 51.54530420220255    9.930176138877867    Feinbaeckerei_Ruch_09
./flash.sh 51.53183100338405    9.934076070785522    Feinbaeckerei_Ruch_10
./flash.sh 51.51381713409578    9.955029487609863    Feinbaeckerei_Ruch_11
./flash.sh 51.512354884322896   9.955925345420837    Feinbaeckerei_Ruch_12
./flash.sh 51.54207807128854    9.914828538894653    Feinbaeckerei_Ruch_13
./flash.sh 51.53039602954396    9.938222765922546    Feinbaeckerei_Ruch_14
./flash.sh 51.531841014670526   9.937530755996704    Feinbaeckerei_Ruch_15
./flash.sh 51.53962579189816    9.94264841079712     Feinbaeckerei_Ruch_16
./flash.sh 51.542595201771135   9.949799180030823    Feinbaeckerei_Ruch_17
./flash.sh 51.51515248101072    9.94013249874115     Feinbaeckerei_Ruch_18
./flash.sh 51.528887589675044   9.926066994667051    Feinbaeckerei_Ruch_19
./flash.sh 51.53467078339061    9.936929941177368    Feinbaeckerei_Ruch_20
./flash.sh 51.57874306327084    9.759174585342407    Feinbaeckerei_Ruch_21
./flash.sh 51.58850629232994    9.927461743354797    Feinbaeckerei_Ruch_22
./flash.sh 51.50285579510823    9.765300750732422    Feinbaeckerei_Ruch_23
./flash.sh 51.50255526436374    9.761003851890564    Feinbaeckerei_Ruch_24
./flash.sh 51.51246839397649    10.25948703289032    Feinbaeckerei_Ruch_25
./flash.sh 51.508946124423126   10.255286693572998   Feinbaeckerei_Ruch_26
./flash.sh 51.78783373327458    10.062666535377502   Feinbaeckerei_Ruch_27
./flash.sh 51.82073590612012    9.872143864631653    Feinbaeckerei_Ruch_28
./flash.sh 51.81830862006357    9.865947961807251    Feinbaeckerei_Ruch_29
./flash.sh 51.55195257991039    9.871907830238342    Feinbaeckerei_Ruch_30
./flash.sh 51.431898980502545   9.64473009109497     Feinbaeckerei_Ruch_33
./flash.sh 51.41698044851287    9.651864767074585    Feinbaeckerei_Ruch_34
./flash.sh 51.417833545176194   9.651778936386108    Feinbaeckerei_Ruch_35
./flash.sh 51.41101167200516    9.643405079841614    Feinbaeckerei_Ruch_36
./flash.sh 51.64851618597645    9.835386872291563    Feinbaeckerei_Ruch_37
./flash.sh 51.857828585762874   9.9593585729599      Feinbaeckerei_Ruch_53
./flash.sh 51.70541835968561    9.999339580535889    Feinbaeckerei_Ruch_54
./flash.sh 51.70633254826029    9.991545081138609    Feinbaeckerei_Ruch_55
./flash.sh 51.69041970568905    9.983407258987425    Feinbaeckerei_Ruch_56
./flash.sh 51.63002240144565    9.9363774061203      Feinbaeckerei_Ruch_57

# Hildesheim:
./flash.sh 52.148958258516465   9.937713146209717    Feinbaeckerei_Ruch_38
./flash.sh 52.151048416345176   9.973622560501099    Feinbaeckerei_Ruch_39
./flash.sh 52.154063337297565   9.955195784568787    Feinbaeckerei_Ruch_40
./flash.sh 52.15090688119581    9.93088960647583     Feinbaeckerei_Ruch_41
./flash.sh 52.13966492024524    9.939993023872375    Feinbaeckerei_Ruch_42
./flash.sh 52.15336557899155    9.950260519981384    Feinbaeckerei_Ruch_43
./flash.sh 52.159276430590616   9.940513372421265    Feinbaeckerei_Ruch_44

# Kasseler Block:
# Fuldabrueck:
./flash.sh 51.27328643729277    9.501843452453613    Feinbaeckerei_Ruch_31
# Harleshausen:
./flash.sh 51.33653057987049    9.438816905021667    Feinbaeckerei_Ruch_32
# Hofgeismar:
./flash.sh 51.494199716235535   9.381396174430847    Feinbaeckerei_Ruch_45
# Kassel
./flash.sh 51.289704482241135   9.471845626831055    Feinbaeckerei_Ruch_46
./flash.sh 51.29184815912083    9.45449709892273     Feinbaeckerei_Ruch_47
./flash.sh 51.316846975739736   9.496994018554688    Feinbaeckerei_Ruch_48
./flash.sh 51.3145703464324     9.494735598564148    Feinbaeckerei_Ruch_49
./flash.sh 51.33396669250336    9.492627382278442    Feinbaeckerei_Ruch_50
./flash.sh 51.31794333864989    9.49968695640564     Feinbaeckerei_Ruch_51
./flash.sh 51.313095003491476   9.445066452026367    Feinbaeckerei_Ruch_52
# Reinhardshagen
./flash.sh 51.489537041989      9.606696367263794    Feinbaeckerei_Ruch_58
# Vellmar
./flash.sh 51.36275442884671    9.468364119529724    Feinbaeckerei_Ruch_60
# Witzenhausen
./flash.sh 51.34131611932317    9.860449433326721    Feinbaeckerei_Ruch_61

2. Flash-Aktion für Ruch mit Keys für Kassel

# Feinbaeckerei_Ruch_49
a66db04d6ea85f7394ab5df01bcdbf096726236d0c43059f82cf1d298b7a9782
(schon per Email nach Kassel gegangen)

2. Flash-Aktion für Ruch mit Keys für Hildesheim

(Die folgenden Keys sind am 18.6. an keys@freifunk-hi.de gegangen)

# Feinbaeckerei_Ruch_38
f60190ec56f7c5f5a295d4c9f07a57251b41c572bb4f2461608cd68f053c6b5f
# Feinbaeckerei_Ruch_39
0a758b5f34c45fa66b2760be23e040dce7e27a54920e09496699e11ca7786ec7
# Feinbaeckerei_Ruch_40
6598c8e713a0fcdbca104feee06714194f2d9835d3dc0adcd19a6e3e80f7357c
# Feinbaeckerei_Ruch_41
ac19164198e5a685836ad13b942c1e401eb1439e750ee79973e592c201f990cf
# Feinbaeckerei_Ruch_42
efff191cdda02c73c2b87dbf6fc6b5bd2ddc95dcc59912203744625500138d53
# Feinbaeckerei_Ruch_43
5533ea7cc26adc5d5f4a780d954dd97566808fa631740a47a62333e650392479
# Feinbaeckerei_Ruch_44
c9851071540ea2e64399154abc38aed26fa88f8baa66ea1ee4491bab514bdf6c