View Single Post
Posts: 20 | Thanked: 11 times | Joined on Aug 2010
#11
Originally Posted by tremby View Post
I have it working.

I couldn't find iwconfig (though I didn't look very hard) and so found no way right away of getting the SSID.

So I took the dbus-scripts approach. I was confused at first that the script wasn't called and tried restarting dbus and dbus-scripts. Restarting dbus gave me an error -- it was calling sort with --reverse which doesn't exist on this device. I replaced the --reverse with -r (beware, --reverse appears twice and only one of them is to do with sort) and then dbus restarted properly. I don't know if this was a necessary change.

But then I lost all wifi. I double checked my scripts and they were fine. I rebooted the device and then everything was working.

I had the script append all arguments to a file at first so I could check what was what and get the network ID I needed. Then I commented that line out and wrote the rest of the script. (I left the line in since it may be helpful to others.)

The scripts I'm left with:

/etc/dbus-scripts/wlan
Code:
/home/user/isslogin.sh * * com.nokia.icd status_changed * WLAN_INFRA
/home/user/isslogin.sh
Code:
#!/bin/bash
USER='--my university username--'
PASS='--my university password--'
IP=$(ifconfig wlan0 | grep "inet addr" | cut -d : -f 2 | awk '{print $1}')

#echo $* >>/home/user/dbus

if [ $5 = "d49d3--my university network ID--3e410" -a $7 = "CONNECTED" ]; then
	wget --no-check-certificate --post-data '_FORM_SUBMIT=1&which_form=reg&destination=http%3A%2F%2Fgoogle.com%2F&source='$IP'&error=&bs_name='$USER'&bs_password='$PASS https://--network login URL--.pl -O /dev/null
fi
Obviously the form data and URL will have to be different for different networks.

I generated mine by connecting to the network and then, before logging in, doing wget http://google.com and then inspecting the HTML returned.
Hi. i'm trying to connect to free wifi with your script but i 'm not able to retrive form data. i tried type:

wget --no-check-certificate google.com (before i connected to free wifi without logging)

but it didn't save any index.html. I only found a file called cp?r\=http\:\%2F. I open it but I don't know what i have to search.

that file contain:

<!DOCTYPE html>
<html lang="it" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>FreeWi-Fi Genova</title>
<link rel="stylesheet" href="/cp/assets/fullpage.css" charset="utf-8"/>
<script type="text/javascript" src="/cp/assets/jquery.js"></script>
<script type="text/javascript" src="/cp/assets/jquery_url_parser.js"></script>
<script type="text/javascript" src="/cp/assets/utilities.js"></script>
</head>
<body>
<div id="container">
<div id="banner">
<div class="navcontainer">

<h1>Benvenuto in FreeWi-Fi Genova</h1>
<h2>Il portale di accesso gratuito ad Internet offerto dal Comune di Genova</h2>

</div>
</div>
&nbsp;
<div id="main">

<!--
<div style="float:left;border-right:1px dotted gray;padding-right:50px;">
-->
<div style="margin:0 auto;width:51%;border-right:1px dotted gray;border-left:1px dotted gray;padding-right:60px;padding-left:60px;">
<h4>Inserisci le tue credenziali per navigare!</h4>
<form method="post" action="https://selfcare.freewifigenova.it:8081/login" onSubmit="redirectOnSubmit('r', '#original_url')">
<input id="original_url" name="original_url" value="http://www.google.com" type="hidden" />
<table>
<tr><td><label for="username">Nome Utente:</label></td><td><input id="username" name="username" type="text"></td></tr>
<tr><td><label for="password">Password:</label></td><td><input id="password" name="password" type="password"></td></tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="2">
<center><input name="commit" type="submit" value="Login"></center>
</td>
</tr>
</table>
</form>
&nbsp;
<p>
Hai dimenticato la password? <a href="https://selfcare.freewifigenova.it/owums/account/reset">Recuperala!</a>
</p>
&nbsp;
<p>
Se non sei registrato, puoi registrarti <a href="https://selfcare.freewifigenova.it/owums/account/signup">qui</a>
</p>
&nbsp;
<p>
Per gestire il tuo account, vai alla <a href="https://selfcare.freewifigenova.it/owums/account/login">pagina personale</a>
</p>
&nbsp;
</div>

</div>
<div id="footer">
<div class="fotext" align="center">
Copyright (C) 2011 - <a href="http://www.caspur.it/">CASPUR</a> |
Cambia lingua:
<img src="/cp/images/admin/it.gif" alt="it" />

<a href="/cp/en/" onclick="redirectOnClick2('#change-locale')" id="change-locale">
<img src="/cp/images/admin/en.gif" alt="en" />
</a>

</div>
</div>
</div>
</body>
</html

this is the right file where can I retrive the informations I need?

thank's