Author Topic: Auto Login in Browser, how?  (Read 2201 times)

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Auto Login in Browser, how?
« on: March 06, 2017, 12:36:33 AM »
we have free wifi from 6am to 2am & every time it disconnects we have to login the next day again via firefox or IE. Is there an app that can automatically Login for us or press the login button?

http://gewifi.10000.gd.cn/?wlanuserip=113.79.167.112&wlanacname=DG-HF-BAS-6.MAN.ME60&wlanacip=218.16.0.254&wlanusermac=00-e0-4c-91-89-c4&nasid=ethtrunk/62:500.0
what is love? baby don't hurt me, no more.


Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #2 on: March 06, 2017, 10:25:23 AM »
cool!
thanks calvin, i'll give it a try.
what is love? baby don't hurt me, no more.

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #3 on: March 10, 2017, 12:35:33 AM »
just installed it tonight & see if it works tomorrow after 6am

this is the screen that pops up in browser then we have to press Login every time it logs out @2am.

 
what is love? baby don't hurt me, no more.

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #4 on: March 13, 2017, 11:30:06 PM »
ayaw din

need parin pindutin itong login
what is love? baby don't hurt me, no more.

Offline splerdu

  • Veterans
  • Member
  • ***
  • Posts: 7433
Re: Auto Login in Browser, how?
« Reply #5 on: March 14, 2017, 12:29:19 AM »
^ gawan mo na lang ng userscript

Identify the IDs for the check box and login button, make a script that refreshes the login page, finds the IDs, then use the DOM .click() method to push them if they exist.

5-6 lines of code, max.
fhtagn

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #6 on: March 14, 2017, 09:48:18 AM »
^ ah eh, English please hehehe
what is love? baby don't hurt me, no more.

Offline splerdu

  • Veterans
  • Member
  • ***
  • Posts: 7433
Re: Auto Login in Browser, how?
« Reply #7 on: March 14, 2017, 10:10:14 AM »
^ View source next time you get the page. Copy and post it here using code tags and let's see what we can do.

It'll be something like this and then you install using Chrome or FireFox + GreaseMonkey or TamperMonkey:

Code: [Select]
// ==UserScript==
// @name        Wheelee's Wifi Login
// @namespace   forum.pinoypc.net
// @description Login to Wheelee's Wifi when it disconnects at 2am
// @include     http://the.wifi.login.url/*
// @version     0.0.1
// @grant       none
// ==/UserScript==

if (window.location.href.match('the.wifi.login.url'))
{
  setTimeout(function ()
  {
    document.getElementById('tos_checkbox').click();
    document.getElementById('login_button').click();
  }, 100);
}

Need the source to find out what the element ids are for the TOS checkbox and the login button so they can be .click()ed.
fhtagn

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #8 on: March 14, 2017, 10:38:00 AM »
ah sige sige sige, thanks
what is love? baby don't hurt me, no more.

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #9 on: March 14, 2017, 06:59:46 PM »
Login Screen

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">    <head>       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />       <title>东莞创机电业制品有限公司</title>       <script type='text/javascript' src='/dwr/interface/GEPortal.js'></script>         <script type='text/javascript' src='/dwr/engine.js'></script>        <script type='text/javascript' src='/portal/dgtti/js/fun.js?bate=1'></script>       <link href="/portal/dgtti/css/css.css" rel="stylesheet" type="text/css" />        <script type='text/javascript' src="/pvuvStatistic.do?pvuv=1"></script>    </head>    <body id="contentbody">        <div id="page">          <div id="R0">             <div id="G0" align="center" style="line-height:30px">             <div style="font-size:18px;font-weight:900;line-height:40px">存款到建行,手机免费拿</div>             <div>中国电信携手建设银行感恩服务专场走进TTI!</div> <div><span style="color:red">2月18-20日</span>,TTI员工携身份证及建行卡至<span style="color:red">TTI饭堂门口</span>服务专场即可参加信用0元送机活动,老用户现场可免费升级4G及流量赠送。</div> <div>欢迎前往现场咨询!</div>             </div>             <div id="G1"></div>             <a href="javascript:login();"><div id="G2"></div></a>             <a href="/portal/dgtti/noblame.html"><div id="G3"></div></a>             <div id="G4"></div>              <a href="javascript:checkNoblame();"><div id="G5" style="background:url(/portal/dgtti/images/allbgs.gif) no-repeat 0px -521px;"></div></a>          </div>       </div>       <div id="wait" style="display: none;">请稍后......</div>    </body> </html> 
what is love? baby don't hurt me, no more.

Offline wheelee

  • Member
  • **
  • Posts: 3817
  • Nobody's tomorrow is guaranteed
Re: Auto Login in Browser, how?
« Reply #10 on: March 14, 2017, 07:01:34 PM »
Log out Screen

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">    <head>       <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />       <title>东莞创机电业制品有限公司</title>       <script type='text/javascript' src='/dwr/interface/GEPortal.js'></script>         <script type='text/javascript' src='/dwr/engine.js'></script>        <script type='text/javascript' src='/portal/dgtti/js/fun.js?bate=1'></script>       <link href="/portal/dgtti/css/css.css" rel="stylesheet" type="text/css" />    </head>    <body>       <div id="page">          <div id="R0">             <div id="G0" align="center" style="line-height:30px">             <div style="font-size:18px;font-weight:900;line-height:40px">存款到建行,手机免费拿</div>             <div>中国电信携手建设银行感恩服务专场走进TTI!</div> <div><span style="color:red">2月18-20日</span>,TTI员工携身份证及建行卡至<span style="color:red">TTI饭堂门口</span>服务专场即可参加信用0元送机活动,老用户现场可免费升级4G及流量赠送。</div> <div>欢迎前往现场咨询!</div>             </div>             <div id="G7">             <p><font color="green" size="5">登录成功</font></p>             <p><br/></p>             <p><font size="5">欢迎使用WiFi服务!</font></p>             </div>             <a href="javascript:logout()"><div id="G9"></div></a>          </div>       </div>    </body> </html>
what is love? baby don't hurt me, no more.

Offline splerdu

  • Veterans
  • Member
  • ***
  • Posts: 7433
Re: Auto Login in Browser, how?
« Reply #11 on: March 14, 2017, 11:56:36 PM »
Not sure if some stuff is inserted by javascript and not included in your copy pasta, but try this.

Change all instances of the.wifi.login.url to the url of the login page, then install the script below using TamperMonkey.

'G5' seems to be the checkbox
'G2' is the login button

The script will just load the page and then click those two items after 100ms.

Code: [Select]
// ==UserScript==
// @name        Wheelee's Wifi Login
// @namespace   forum.pinoypc.net
// @description Login to Wheelee's Wifi when it disconnects at 2am
// @include     http://the.wifi.login.url/*
// @version     0.0.1
// @grant       none
// ==/UserScript==

if (window.location.href.match('the.wifi.login.url'))
{
  setTimeout(function ()
  {
    document.getElementById('G5').click();
    document.getElementById('G2').click();
  }, 100);
}

See TamperMonkey FAQ #102 on installing scripts.
You'll be doing this using the second to last option (copy paste) [preferred, click the video tutorial link]
or save into a file like xyz.user.js and install using the last option.
http://tampermonkey.net/faq.php#Q102
fhtagn