Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Automating the annoying WiFi login screen

  • 22-08-2011 1:55pm
    #1
    Closed Accounts Posts: 3,689 ✭✭✭


    There may be a better solution to this but thought I'd share as it might be useful to others.

    That annoying login screen that you need to sign into every time you use the WiFi in college was irritating me. Auto form fillers didn't seem to work. So had a look at the source of the page and a few very simple changes and it can be automated.
    1. Copy the edited html source from below into notepad.
    2. Replace ENTER_STUDENT_ID_HERE with your student ID.
    3. Replace ENTER_PASSWORD_HERE with your password.
    4. Save as a .html file.
    5. Make this your homepage, or bookmark. The easiest way is to right-click in the folder and open with your browser of choice. Then you'll see the correct web address to the file on your computer (file:///C:/...).
    6. Now when you connect to the wifi, hit Home or the Bookmark and it'll log you in.

    Basic stuff but very handy non the less. Note that your username and password will be openly stored on your computer though.

    [PHP]<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>NUI Galway "Easy Access" Wireless Web Authentication</title>
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">

    <style>
    <!--

    DIV.header {
    BACKGROUND-POSITION: right 50%; LEFT: 0px; BACKGROUND-IMAGE: url(images/header_background.png); WIDTH: 100%; BACKGROUND-REPEAT: repeat; POSITION: absolute; TOP: 0px; HEIGHT: 52px; BACKGROUND-COLOR: #FFFFFF}


    DIV.content {
    LEFT: 14px; MARGIN: 15px; POSITION: absolute; TOP: 60px; width: 80%;
    }
    H1 {
    FONT-WEIGHT: bold; FONT-SIZE: 19px; MARGIN: 16px 0px 0px 25px; COLOR: #ffffff; FONT-FAMILY: Tahoma, Arial, Helvetica, sans-serif
    }
    H2 {
    FONT-WEIGHT: bold; FONT-SIZE: 15px; MARGIN: 10px 0px 0px 10px; COLOR: #336666; FONT-FAMILY: Arial, Helvetica, sans-serif
    }
    INPUT {
    FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif
    }
    INPUT.button {
    MARGIN-TOP: 10px; FONT-WEIGHT: bold; WIDTH: 80px; COLOR: #ffffff; BACKGROUND-COLOR: #669999
    }
    P {
    FONT-SIZE: 12px; MARGIN: 0px 0px 10px; COLOR: #001133; FONT-FAMILY: Arial, Helvetica, sans-serif
    }
    TD {
    FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #336666; FONT-FAMILY: Arial, Helvetica, sans-serif; MARGIN: 0px 0px 20px;
    }
    TD.message {
    FONT-WEIGHT: normal; COLOR: #000000
    }
    -->
    </style>
    <script>
    function getHtmlForButton(nameStr, str, bClass,onClickFn){
    if(nameStr == null || nameStr ==""
    || str == null || str ==""
    || onClickFn == null || onClickFn =="") {
    debugMsg("One of the input params for the button is not available");
    return;
    }
    document.writeln('<input type="button" name="',nameStr,'" value="',str,'" class="',bClass,'" onClick="',onClickFn,'">');
    }

    function submitAction(){
    if(document.forms[0].err_flag.value == 1){
    // This case occurs when user's attempt to login failed
    // and he is going to login again. This means we have already
    // extracted redirect url in his first attempt and its stored
    // in redirect_url input element. so just submit the form
    document.forms[0].err_flag.value = 0;
    document.forms[0].buttonClicked.value = 4;
    document.forms[0].submit();
    }else{
    var link = document.location.href;
    //alert("Link is "+link);
    var searchString = "?redirect=";
    var equalIndex = link.indexOf(searchString);
    var redirectUrl = "";
    if(equalIndex > 0) {
    equalIndex += searchString.length;
    redirectUrl=link.substring(equalIndex);
    var index=0;
    //add http only if url does not have
    index=redirectUrl.indexOf("http");
    if(index != 0){
    redirectUrl = "http://"+ redirectUrl;
    }
    }
    if(redirectUrl.length > 255){
    redirectUrl = redirectUrl.substring(0,255);
    }
    document.forms[0].redirect_url.value = redirectUrl;
    //alert("redirect url is "+document.forms[0].redirect_url.value);
    document.forms[0].buttonClicked.value = 4;
    document.forms[0].submit();
    }
    }

    function submitOnEnter(event)
    {
    var NS4 = (document.layers) ? true : false;
    var code = 0;
    if (NS4)
    code = event.which;
    else
    code = event.keyCode;
    if (code==13) submitAction(); // 12 corresponds to enter event
    }

    function checkForMsg(){
    if(document.forms[0].info_flag.value == 1){
    alert(document.forms[0].info_msg.value);
    }
    }

    var url = "";
    if(url != ""){
    var link = document.location.href;
    var searchString = "?redirect=";
    var equalIndex = link.indexOf(searchString);
    var redirectUrl = "";
    if(equalIndex > 0) {
    equalIndex += searchString.length;
    redirectUrl += link.substring(equalIndex);
    //attach the redirect url only if the ext web auth url doesn't contain it
    searchString = "&redirect=";
    equalIndex = url.indexOf(searchString);
    if(equalIndex < 0){
    url+= "&redirect=";
    url+=redirectUrl;
    }
    }
    window.location.href = url;
    }

    function getErrorMsgIfAny(){
    if(document.forms[0].err_flag.value == 1){
    document.writeln(' \
    <tr align="center"> <td colspan="2" style="color:#CC0000">Login Error.</td>\
    </tr><tr align="center"> <td width="350" class="message" colspan="2">The User Name and Password combination you have entered is invalid. Please try again.</td></tr>\
    <tr> <td class="caption" colspan="2"> </td></tr>');
    }else{
    document.writeln(' ');
    }
    }

    function loadAction(){
    var url = window.location.href;
    var args = new Object();
    var query = location.search.substring(1);
    var pairs = query.split("&");
    for(var i=0;i<pairs.length;i++){
    var pos = pairs.indexOf('=');

    if(pos == -1) continue;
    var argname = pairs.substring(0,pos);
    var value = pairs.substring(pos+1);
    args[argname] = unescape(value);
    }
    //alert( "AP MAC Address is " + args.ap_mac);
    //alert( "The Switch URL to post user credentials is " + args.switch_url);
    //document.forms[0].action = args.switch_url;
    // This is the status code returned from webauth login action
    // Any value of status code from 1 to 5 is error condition and user
    // should be shown error as below or modify the message as it suits
    // the customer
    if(args.statusCode == 1){
    alert("You are already logged in. No further action is required on your part.");
    }
    else if(args.statusCode == 2){
    alert("You are not configured to authenticate against web portal. No further action is required on your part.");
    }
    else if(args.statusCode == 3){
    alert("The username specified cannot be used at this time. Perhaps the username is already logged into the system?");
    }
    else if(args.statusCode == 4){
    alert("The User has been excluded. Please contact the administrator.");
    }
    else if(args.statusCode == 5){
    alert("Invalid username and password. Please try again.");
    }
    }

    </script>

    </head>
    <body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="submitAction();">
    <form method="post" action="https://wism-core1-1.nuigalway.ie/login.html"&gt;

    <input type="hidden" name="buttonClicked" size="16" maxlength="15" value="0">
    <input type="hidden" name="err_flag" size="16" maxlength="15" value="0">
    <input type="hidden" name="err_msg" size="32" maxlength="31" value="">
    <input type="hidden" name="info_flag" size="16" maxlength="15" value="0">
    <input type="hidden" name="info_msg" size="32" maxlength="31" value="">
    <input type="hidden" name="redirect_url" size="255" maxlength="255" value="">
    <div class="header">

    <h1>Login - NUI Galway WiFi </h1>
    </div>

    <p> </p>
    <p> </p>
    <p> </p>
    <table border="0" cellspacing="0" cellpadding="10" width="100%">
    <tbody><tr>
    <td width="20" rowspan="4" class="message">
    <p> </p> </td>
    <td colspan="2" class="message">Please authenticate with your assigned student or staff or guest account.</td>
    <td rowspan="4" valign="top" class="message"><img src="./NUI Galway Easy Access Wireless Web Authentication_files/nuigalway_logo.png" alt="NUi Galway Logo" width="204" height="130"></td>
    </tr>
    <script>
    getErrorMsgIfAny();
    </script>

    <tr>
    <td>User Name</td>
    <td>
    <input type="TEXT" name="username" size="25" maxlength="63" value="ENTER_STUDENT_ID_HERE"> </td>
    </tr>
    <tr>
    <td>Password</td>
    <td>

    <input type="Password" name="password" emweb_type="PASSWORD" autocomplete="off" onkeypress="submitOnEnter(event);" size="25" maxlength="63" value="ENTER_PASSWORD_HERE"> </td>
    </tr>
    <tr>
    <td> </td>
    <td valign="top">



    <script>getHtmlForButton("Submit","Login","button","submitAction()"); </script><input type="button" name="Submit" value="Login" class="button" onclick="submitAction()">
    <br>By clicking the "Login" button, you acknowledge
    that you have read and accept the <a href="https://wism-core1-1.nuigalway.ie/fs/customwebauth/terms.html&quot; target="_blank">Terms of Use</a>.</td>
    </tr>
    </tbody></table>


    </form>



    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="0">


    </body></html>[/PHP]


Comments

  • Registered Users, Registered Users 2 Posts: 3,568 ✭✭✭ethernet


    Very good!

    If you're paranoid, you could take this and change remove the autocomplete="off" for the password text field and your browser should offer to remember your login credentials.

    The only potential hiccup is the form target: there are a few core routers (have only seen wism-core1-1.nuigalway.ie and wism-core1-2.nuigalway.ie to date). Your form sends the login details to core1-1 and probably sets some cookie(s) for that specific domain. Just wonder if it might cause a hissy fit having wism-core1-1.nuigalway.ie as the target when, for example, actually connecting to wism-core1-2.nuigalway.ie. Too lazy/busy to test :p


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    Just got it working on my mobile too. :)

    For Android users...

    Email yourself the file. Then check your emails and download the attached file.

    Then on your browser bookmark this;
    file://sdcard/download/wifi.html (or whatever you named the file)

    That works on my HTC anyway, use a file explorer app to find the file if that doesn't work for you.

    Connect to the wifi then click the bookmark and you're in. No more walking into people on the concourse while trying to type in your details every time! :p


  • Registered Users, Registered Users 2 Posts: 1,380 ✭✭✭TheCosmicFrog


    Nice little hack. Could also be done with a Greasemonkey script.

    There are two other solutions to this:
    • You could use the LastPass addon for Firefox and Chrome (still involves clicking "Login" but at least it autofills the username and password fields).



  • Registered Users, Registered Users 2 Posts: 13,507 ✭✭✭✭dastardly00


    thanks Joe, I have it working on my Samsung Galaxy S :)


  • Closed Accounts Posts: 5 mamoonkay


    WOW thanks for the post. :D:D:D


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,568 ✭✭✭ethernet


    Just to say: this login screen will be redundant when NUIG *finally* jumps on the Eduroam train (expected in Q4 2011).

    This will mean being able to use your uni login credentials at any participating Eduroam university to use their services, such as wifi.

    It's less straight forward to set up but no more crappy client authentication, thankfully.


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    ethernet wrote: »
    The only potential hiccup is the form target: there are a few core routers (have only seen wism-core1-1.nuigalway.ie and wism-core1-2.nuigalway.ie to date). Your form sends the login details to core1-1 and probably sets some cookie(s) for that specific domain. Just wonder if it might cause a hissy fit having wism-core1-1.nuigalway.ie as the target when, for example, actually connecting to wism-core1-2.nuigalway.ie. Too lazy/busy to test :p

    Just tried in Áras Ui Chathail on core1-4 and it worked fine. I'll check on other routers when I pick them up.


  • Registered Users, Registered Users 2 Posts: 2,570 ✭✭✭Squeeonline


    Could have done with this for the last 4 years. Now I'm out and wont need it, but thanks for the work anyway. I may be back...


  • Registered Users, Registered Users 2 Posts: 1,666 ✭✭✭charlie_says


    Thanks, this is well handy.

    I notice that in chrome, unless I am connecting to core1-1 then a security warning page appears.

    In the past I would enter http://1.1.1.1 into the browser and the wifi authentication would deliver me to the correct core x-x login page. Where in the code can you enter the 1.1.1.1 so to always be redirected to the correct core x-x login page?

    Kudos for posting the script. :)


  • Banned (with Prison Access) Posts: 10,087 ✭✭✭✭Dan_Solo


    Opera Mobile remembers the username/password fields. It's the only browser I've seen that does (although I think the login page is specifically designed not to allow this...)


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 112 ✭✭japanesebanana


    Thanks for this, very handy. Any workaround for Apple devices?


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    Yeah for an Apple device here's the instructions...
    1. List your Apple device for sale on adverts.ie
    2. Meet buyer and exchange for cash
    3. Purchase a PC
    4. Turn on PC and copy the edited html source from above into notepad.
    5. Replace ENTER_STUDENT_ID_HERE with your student ID.
    6. Replace ENTER_PASSWORD_HERE with your password.
    7. Save as a .html file.
    8. Make this your homepage, or bookmark. The easiest way is to right-click in the folder and open with your browser of choice. Then you'll see the correct web address to the file on your computer (file:///C:/...).
    9. Now when you connect to the wifi, hit Home or the Bookmark and it'll log you in.


  • Registered Users, Registered Users 2 Posts: 112 ✭✭japanesebanana


    Wow. Helpful AND funny. I have plenty of non-Apple devices so thanks for your concern.


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    I don't currently have any Apple devices but I'm sure the MacBook solution would be similar to above. For an iPhone/iPad, I had a look and it seems you can't load local files in the browser without jailbreaking.


  • Registered Users, Registered Users 2 Posts: 414 ✭✭apoeiguq3094y


    Wow. Helpful AND funny. I have plenty of non-Apple devices so thanks for your concern.

    Well why can't you just do the same on a mac as a pc? does mac prevent you from opening a saved webpage?


  • Registered Users, Registered Users 2 Posts: 112 ✭✭japanesebanana


    Well why can't you just do the same on a mac as a pc? does mac prevent you from opening a saved webpage?

    Not a mac, an ipad.

    Cheers joe, should be a jailbreak available soon


  • Registered Users, Registered Users 2 Posts: 414 ✭✭apoeiguq3094y


    J o e wrote: »
    I don't currently have any Apple devices but I'm sure the MacBook solution would be similar to above. For an iPhone/iPad, I had a look and it seems you can't load local files in the browser without jailbreaking.

    It seems you can open attachements from emails though. Would it be possible to email the file to yourself, and keep it in some folder (like starred in gmail) that would be available offline. then when you open this attachment it would sign you in. not easy i know, but a few clicks is still easier than having to type in your password.


  • Registered Users, Registered Users 2 Posts: 24 WreckinBar


    This shouldn't be needed anymore! I'm starting to see (and successfully connect to) the Eduroam network, seems like a good few of the Irish third levels are jumping on to this.

    Eduroam
    Eduroam at NUI Galway


  • Registered Users, Registered Users 2 Posts: 112 ✭✭japanesebanana


    What login credentials do you use? Do you have to register somewhere first? I have this set up alright but can't seem to login


  • Registered Users, Registered Users 2 Posts: 24 WreckinBar


    The credentials are:

    Username: STUDENTID@uds.nuigalway.ie
    Password: your student password

    It's all explained here.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,568 ✭✭✭ethernet


    They took their time with this!

    You should be able to use your NUIG credentials - needs a bit of setting up first with choosing auth settings, inputting your login credentials and whatnot.

    Some institutions seem to block members of that local institution from using edurom at that institution, unfortunately, instead favouring users to connect to the previous network.


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    Well spotted. I had a go at connecting. Windows 7 didn't seem happy connecting to it at first...

    wifi.jpg

    Got connected though. I ran a speed test on it to see if it was different to the NUIGWiFi;

    eduroam
    1703168602.png

    NUIGWiFi
    1703176958.png

    Seems to be considerably slower, and eduroam is giving a stronger signal...


  • Closed Accounts Posts: 119 ✭✭click_here!!!


    J o e wrote: »
    Well spotted. I had a go at connecting. Windows 7 didn't seem happy connecting to it at first...

    wifi.jpg

    Got connected though. I ran a speed test on it to see if it was different to the NUIGWiFi;

    eduroam
    1703168602.png

    NUIGWiFi
    1703176958.png

    Seems to be considerably slower, and eduroam is giving a stronger signal...

    Well at least the eduroam wireless is encrypted. The NUIGWiFi one isn't.

    Maybe the speed of eduroam will improve as it's being rolled out.

    I use eduroam on my iPod, it's really convenient.


  • Closed Accounts Posts: 1,533 ✭✭✭the keen edge


    I cant get this original hack to work on my laptop.

    I think I am following the instruction correctly, however when I open the bookmarked modified page I'm brought to the ususal WIFI login page with the log in data fields blank, and the addition of a small window telling me that I'm logged in and dont need to take further action however I'm not logged in and do need to enter my username and password to login.

    Are there only two single place in the code where I need to replace ENTER_STUDENT_NAME and password?. Maybe I'm missing additional modification.


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    If you're getting that message it does sound like you're logged in.... :o When you type in a new web address does it bring you back to the login screen?


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    Connected to eduroam on my Android (HTC Desire).

    It asked for a new password to save the login credentials under (not too sure what this is for), then asked for username and password.

    Connected fine, much better setup!


  • Banned (with Prison Access) Posts: 10,087 ✭✭✭✭Dan_Solo


    Connected via my N97 Mini.
    Nice way to spend the afternoon!


  • Closed Accounts Posts: 1,533 ✭✭✭the keen edge


    J o e wrote: »
    If you're getting that message it does sound like you're logged in.... :o When you type in a new web address does it bring you back to the login screen?

    Yeah, for example I clicked on my boards bookmark but I was brought to the web login screen.


  • Banned (with Prison Access) Posts: 10,087 ✭✭✭✭Dan_Solo


    Would anyone know how to get this saved page into Opera Mini? (on an S60V5 device?)
    It works great with the stock browser, but I prefer Opera Mini and that will not open local files. There is a "Saved Pages" folder, but the format is proprietary.
    Maybe there's a way to save the page online and then download it?


  • Advertisement
  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73


    Not really much need for this now with the eduroam network, connect once then it'll connect automatically for you without further logins.


  • Banned (with Prison Access) Posts: 10,087 ✭✭✭✭Dan_Solo


    I had eduroam working for a while, but then suddenly it stopped connecting and every time I tried to search for the eduroam network my phone would lose ALL networks! Very annoying. There's no installation package available either like there is for Android/iOS.


  • Closed Accounts Posts: 3,689 ✭✭✭joeKel73




  • Banned (with Prison Access) Posts: 10,087 ✭✭✭✭Dan_Solo


    No problems with inbuilt browser or Opera Mobile, but it looks like my favourite, Opera Mini, can't open local files at all. Annoying.


  • Registered Users, Registered Users 2 Posts: 71 ✭✭oldbie


    Thanks all-

    A victory for thread searching eduroadm works a dream on Android.


  • Registered Users, Registered Users 2 Posts: 2,570 ✭✭✭Squeeonline


    Eduroam is possibly the greatest thing in the university. It means that when you travel (I had interviews in foreign universities), you don't need to even think, just switch on wifi and it autoconnects.


  • Advertisement
Advertisement