Author Topic: Script For Connecting To A Wifi Network  (Read 4873 times)

patzoul

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • http://
Script For Connecting To A Wifi Network
« on: May 29, 2010, 04:53:53 am »
I have the following script to connect to a wifi network that will allow me to automatically input the login and password on a webpage. Where should I put this script so that it launches automatically?

script:
#!/bin/sh
CURL=`which curl`
login=SAISIR LOGIN
password=SAISIR MOT DE PASSE
IWGETID=`which iwgetid`
ESSID="FreeWifi"
isFreeWifi="`$IWGETID |grep $ESSID |wc -l`"
if [ $isFreeWifi = "1" ]
then
    priv=`$CURL https://wifi.free.fr/ |grep "<input name=\"priv\" id=\"priv\" type=\"hidden\"" | sed -e 's/^.*value=\"\(.*\)\"\s.*/\1/'`
    $CURL -d "login=$login&password=$password&priv=$priv&submit=Valider&url=http://www.free.fr" https://wifi.free.fr/
    espeak "FreeWifi network connected"
fi

sdjf

  • Sr. Member
  • ****
  • Posts: 447
    • View Profile
    • http://www.sdjf.wordpress.com and http://www.sdjf.esmartdesign.com
Script For Connecting To A Wifi Network
« Reply #1 on: May 30, 2010, 02:24:12 am »
I think it depends on what you want to have trigger the automatic launch.

It would also help if you specified your model and ROM.

sdjf
http://www.sdjf.esmartdesign.com
http://www.sdjf.wordpress.com
-----------------
sl5500 running Sharp ROM 2.38 (dead batteries)
sl6000L running Sharp ROM 1.12 (still working)
Opera 7.25 and 7.30
Socket CF 56k modem
3Com USB Ethernet Adapter
Toshiba, Lexar and Kingston SD cards
Lexar, Kingston and Transcend CF cards

patzoul

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • http://
Script For Connecting To A Wifi Network
« Reply #2 on: May 31, 2010, 02:58:18 pm »
Quote from: sdjf
I think it depends on what you want to have trigger the automatic launch.

It would also help if you specified your model and ROM.

sdjf

I have a Zaurus C760 running Cacko 1.23. I would like the script to run when I select this Wifi connection in the Network app.

koan

  • Sr. Member
  • ****
  • Posts: 370
    • View Profile
    • http://www.lyndonhill.com
Script For Connecting To A Wifi Network
« Reply #3 on: June 03, 2010, 04:22:08 am »
Quote from: patzoul
I have a Zaurus C760 running Cacko 1.23. I would like the script to run when I select this Wifi connection in the Network app.

1. Change your script so that it is safe to run when you connect to any network
2. Write a small program to listen for the qcop signal QPE/Network/up() and run your script when it is received.

qcop
Zocalo Feed Reader : Thai on Zaurus : Dictionaries for zbedic : Sharp ROM package feed
HELUX Handheld Embedded Linux Blog
SL-C3200 Multiboot : SL-C750  Sharp ROM