Freifunk/Flashscript: Unterschied zwischen den Versionen
Kjo (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<source lang=bash> #!/bin/sh #FIRMWARE="gluon-ffhi-0.4-experimental-20150328-tp-link-tl-wr1043n-nd-v2.bin" #FIRMWARE=gluon-ffhi-wr1043.bin FIRMWARE=gluon-ffgo…“) |
Kjo (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
Zeile 9: | Zeile 9: | ||
LAENGE=9.949756264686584 | LAENGE=9.949756264686584 | ||
BREITE=51.52233597559833 | BREITE=51.52233597559833 | ||
CONTACT="freifunk@ | CONTACT="freifunk@example.com" | ||
gluon() | gluon() |
Version vom 9. Juni 2015, 22:23 Uhr
<source lang=bash>
- !/bin/sh
- FIRMWARE="gluon-ffhi-0.4-experimental-20150328-tp-link-tl-wr1043n-nd-v2.bin"
- FIRMWARE=gluon-ffhi-wr1043.bin
FIRMWARE=gluon-ffgoe-0.6.5-tp-link-tl-wr1043n-nd-v2.bin
NAME=ccc-geismar-land LAENGE=9.949756264686584 BREITE=51.52233597559833 CONTACT="freifunk@example.com"
gluon() { curl -v '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() { 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 5
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 while true; do echo ping $ip ping -c 1 -W 5 $ip | grep '1 packets received' if test "$?" = "0"; then echo success return fi sleep 1 done }
echo Warte auf TP-Link GUI
wait_for_ping 192.168.0.1
sleep 2
echo Sende Firmware
flash
sleep 2
echo Warte auf Gluon GUI wait_for_ping 192.168.1.1 sleep 2 echo Konfiguriere Gluon gluon </source>